Enterprise Payment Infrastructure - Professional-grade card processing with instant cryptocurrency settlements
axiomepayments/php-sdk is a Laravel package for enterprise payment infrastructure - professional-grade card processing with instant cryptocurrency settlements.
It currently has 0 GitHub stars and 0 downloads on Packagist (latest version v1.0.1).
Install it with composer require axiomepayments/php-sdk.
Discover more Laravel packages by axiomepayments
or browse all Laravel packages to compare alternatives.
Last updated
Enterprise Payment Infrastructure
Professional-grade card processing with instant cryptocurrency settlements. Built for businesses that demand reliability.
Official PHP SDK for the AxiomePayments payment processing API.
Install via Composer:
composer require axiomepayments/php-sdk
<?php
require_once 'vendor/autoload.php';
use AxiomePayments\AxiomePayments;
// Initialize the client
$axiomepayments = new AxiomePayments([
'api_key' => 'your-api-key',
'api_secret' => 'your-api-secret',
'environment' => 'production' // or 'sandbox'
]);
// Create a payment
$payment = $axiomepayments->payments->create([
'amount' => 99.99,
'currency' => 'USD',
'title' => 'Payment for Order #123', // Required - title of the payment link
'customer_details' => [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => '[email protected]'
],
//'redirect_url' => 'https://yourstore.com/status',
// OR:
'success_url' => 'https://yourstore.com/success',
'cancel_url' => 'https://yourstore.com/cancel',
]);
// Redirect to payment page
header('Location: ' . $payment->payment_url);
// OR for iframe embedding (fullscreen with transparent background):
// echo '<iframe src="' . $payment->embed_url . '" style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; border: none; z-index: 9999;" allowpaymentrequest></iframe>';
exit;
The SDK supports two environments:
sandbox - For testing (https://sandbox-api.axiomepayments.com)production - For live transactions (https://api.axiomepayments.com)Get your API credentials from your AxiomePayments merchant dashboard:
$payment = $axiomepayments->payments->create([
'amount' => 100.00,
'currency' => 'USD',
'title' => 'Digital Product Purchase', // Required - title of the payment link
//'redirect_url' => 'https://yourstore.com/status',
// OR:
'success_url' => 'https://yourstore.com/success',
'cancel_url' => 'https://yourstore.com/cancel',
'customer_details' => [
// learn more about this at: https://axiomepayments.com/api-documentation#pre_fill or examples/create_payment_full_prefill.php
'first_name' => 'John',
'middle_name' => 'Jay', // Optional
'last_name' => 'Doe',
'email' => '[email protected]', // Optional
'phone' => '+1234567890', // Optional
'date_of_birth' => '1990-01-01', // Optional - YYYY-MM-DD format
'country_of_residence' => 'US', // Optional - if present, has to be alpha-2 country short code
'state_of_residence' => 'CA', // Optional - Required for US customers
// rules for usage of "state_of_residence":
// - if present, has to be a valid US state short code (alpha-2 uppercase)
// - required if "country_of_residence" is "US" (we will ask for it if you don't prefill it)
// - has to be dropped (not be in the payload) when "country_of_residence" is not "US"
'card_country_code' => 'US', // Optional - alpha-2 country short code card billing address
'card_city' => 'California', // Optional - prefill card billing address
'card_state_code' => 'CA', // Optional - US state alpha-2 short code card billing address
// rules for usage of "card_state_code":
// - if present, has to be a valid US state short code (alpha-2 uppercase)
// - required if "card_country_code" is "US" (we will ask for it if you don't prefill it)
// - has to be dropped (not be in the payload) when "card_country_code" is not "US"
'card_post_code' => '12345', // Optional - zip/post code card billing address
'card_street' => 'Street 123', // Optional - address line 1 (& 2) card billing address
],
'metadata' => [
// Optional - use this to identify the customer or payment session
// This data will be returned in webhooks and API responses
'order_id' => 'order_123',
'product_id' => 'prod_456',
'user_id' => 'user_789',
'session_id' => 'sess_abc'
],
'lang' => 'en' // the language for the payment page - possible values: en, es, fr, de, it, pt, ru, zh, ja, ko, tr
]);
echo "Payment URL: " . $payment->payment_url;
echo "Reference ID: " . $payment->reference_id;
$payment = $axiomepayments->payments->status('txn_abc123def456');
echo "Status: " . $payment->status;
echo "Amount: " . $payment->amount;
echo "Currency: " . $payment->currency;
$payments = $axiomepayments->payments->list([
'limit' => 20,
'status' => 'completed',
'from_date' => '2024-01-01',
'to_date' => '2024-01-31'
]);
foreach ($payments->payments as $payment) {
echo "Payment {$payment->reference_id}: {$payment->status}\n";
}
// Handle pagination
if ($payments->has_more) {
$nextPage = $axiomepayments->payments->list([
'page_token' => $payments->next_page_token
]);
}
// Get all supported currencies
$currencies = $axiomepayments->currencies->all();
foreach ($currencies as $currency) {
echo "{$currency->short_code}: {$currency->name} ({$currency->symbol})\n";
}
// Use in a payment form to build a currency dropdown
$currenciesArray = $axiomepayments->currencies->allAsArray();
<?php
// webhook.php
require_once 'vendor/autoload.php';
use AxiomePayments\Webhook;
$webhook = new Webhook('your-webhook-secret');
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
if ($webhook->verifySignature($payload, $signature)) {
$event = json_decode($payload, true);
switch ($event['event']) {
case 'payment_intent.created':
// Handle successful payment
$transaction = $event['data']['transaction'];
echo "Payment intent created: " . $transaction['reference_id'];
break;
case 'payment_intent.attempting':
// Handle a payment being attempted
$transaction = $event['data']['transaction'];
echo "Payment attempting: " . $transaction['reference_id'];
break;
case 'payment_intent.processing':
// Handle successful payment
$transaction = $event['data']['transaction'];
echo "Payment processing: " . $transaction['reference_id'];
break;
case 'payment_intent.succeeded':
// Handle successful payment
$transaction = $event['data']['transaction'];
echo "Payment completed: " . $transaction['reference_id'];
break;
case 'payment_intent.failed':
// Handle failed payment
$transaction = $event['data']['transaction'];
echo "Payment failed: " . $transaction['reference_id'];
break;
case 'payment_intent.cancelled':
// Handle cancelled payment
$transaction = $event['data']['transaction'];
echo "Payment cancelled: " . $transaction['reference_id'];
break;
case 'payment_intent.expired':
// Handle expired payment
$transaction = $event['data']['transaction'];
echo "Payment expired: " . $transaction['reference_id'];
break;
case 'system.health_check':
// Handle health check
$message = $event['data']['message'];
echo "Health check received: " . $message;
break;
}
} else {
http_response_code(400);
echo "Invalid signature";
}
?>
use AxiomePayments\Exception\AxiomePaymentsException;
use AxiomePayments\Exception\AuthenticationException;
use AxiomePayments\Exception\InvalidRequestException;
use AxiomePayments\Exception\ApiException;
try {
$payment = $axiomepayments->payments->create([
'title' => 'My NFT',
'amount' => 99.99,
'currency' => 'USD'
]);
} catch (AuthenticationException $e) {
echo "Authentication failed: " . $e->getMessage();
} catch (InvalidRequestException $e) {
echo "Invalid request: " . $e->getMessage();
} catch (ApiException $e) {
echo "API error: " . $e->getMessage();
} catch (AxiomePaymentsException $e) {
echo "AxiomePayments error: " . $e->getMessage();
}
$axiomepayments = new AxiomePayments([
'api_key' => 'sandbox-api-key',
'api_secret' => 'sandbox-api-secret',
'environment' => 'sandbox'
]);
4242 4242 4242 4242 with a future expiry date| CVV | Result | |-----|--------| | 400 | β General failure | | 401 | π³ Declined by card issuer | | 402 | π Incorrect card details | | 403 | π Transaction limits exceeded | | 404 | π° Insufficient funds | | 405 | π Incorrect CVV | | 406 | ποΈ Failed card validation (card deleted) | | 407 | π Failed card validation (contact support) | | ANY OTHER (e.g., 123) | β SUCCESS |
$client = new AxiomePayments([
'api_key' => 'your-api-key',
'api_secret' => 'your-api-secret',
'environment' => 'production', // 'sandbox' or 'production'
'timeout' => 30 // Request timeout in seconds
]);
Request Parameters:
amount (required): Payment amount (minimum 0.01)currency (required): Currency code - see Get Available Currencies for the list of supported currencies. For NFT checkout and Onramp, payment is always charged in USD or EUR but prices can be displayed as any of the listed currencies!title (optional): Title of the payment linkdescription (optional): Description of the paymentredirect_url (optional): Success redirect URL (uses sales channel configuration if empty)success_url (optional): URL to redirect to after successful paymentcancel_url (optional): URL to redirect to after cancelled paymentcustomer_details (optional): Customer information object
email (optional): Customer's email addressfirst_name (optional): Customer's first namemiddle_name (optional): Customer's middle namelast_name (optional): Customer's last nameid (optional): Customer's unique identifierphone (optional): Customer's phone numberdate_of_birth (optional): Customer's date of birth (YYYY-MM-DD format)country_of_residence (optional): Customer's country code (ISO format, e.g., 'US', 'GB')state_of_residence (optional): US state short code alpha-2 - Required if country_of_residence is 'US', has to be dropped from the payload for any other countrycard_country_code (optional): Prefill card billing address countrycard_city (optional): Prefill card billing address citycard_state_code (optional): Prefill card billing address state - US state short code alpha-2 - Required if country_of_residence is 'US', has to be dropped from the payload for any other countrycard_post_code (optional): Prefill card billing address postal codecard_street (optional): Prefill card billing address street addressmetadata (optional): Use this to identify the customer or payment session (returned in webhooks and API responses)custom_fields (optional): Custom key-value pairs for additional dataexpires_at (optional): ISO 8601 timestamp when payment link expirestheme (optional): UI theme customization
color (optional): Primary theme color (hex format, e.g., '#7014f4')lang (optional): Language code (en, es, fr, de, it, pt, ru, zh, ja, ko, tr, ka)multiple_use (optional): Boolean - if payment link is meant for one or multiple paymentscancel_on_first_fail (optional): Boolean - when true, payment link fails permanently after first failed attempt (default: false)is_price_dynamic (optional): Boolean - when true, allows customers to set their own payment amount during checkout. The amount parameter becomes optional when this is enabled (default: false)customer_commission_percentage (optional): Commission percentage charged to customerResponse - Payment Object:
id: Payment link IDtransaction_id: Internal transaction ID (only present after payment is initiated)title: Payment titledescription: Payment descriptionreference_id: Unique payment referencepayment_link_id: Payment link ID (same as id in create response)payment_url: URL where customer can complete paymentflow_type: Flow type (e.g., 'nft')amount: Amount in fiat currencyfiat_base_amount: Base fiat amount (before fees)fiat_total_amount: Total fiat amount (including fees)currency: Fiat currency codefiat_currency: Fiat currency code (same as currency)commodity: Commodity type (e.g., 'USDT')commodity_amount: Amount of commodity to be purchasedstatus: Payment status (pending, attempting, processing, completed, failed, expired, cancelled)fail_reason: Reason for payment failure (if failed)created_at: ISO 8601 timestamp when payment was createdupdated_at: ISO 8601 timestamp when payment was last updatedpaid_at: ISO 8601 timestamp when payment was completed (if completed)expires_at: ISO 8601 timestamp when payment expirescustom_fields: Custom fields arraycustomer_commission_percentage: Customer commission percentagemultiple_use: Whether payment link can be used multiple timescustomer_details: Customer details objectmetadata: Metadata objectpayment_method: Payment method information with keys:
card_id: Card identifiercard_brand: Card brand (e.g., 'VISA', 'MASTERCARD')payment_type: Payment type (e.g., '3ds_v2')processed_through: Payment processor (e.g., 'safecharge')blockchain_tx_hash: Blockchain transaction hash for completed crypto transfers (string or null)Get the status of a payment by transaction UUID.
$payment = $axiomepayments->payments->status('...');
Returns a Payment object with all the fields listed above.
Get the status of a payment link by payment link UUID.
$payment = $axiomepayments->payments->paymentLinkStatus('...');
Returns a Payment object with all the fields listed above.
Get all active processing currencies supported by the AxiomePayments API.
// Get all currencies as Currency objects
$currencies = $axiomepayments->currencies->all();
foreach ($currencies as $currency) {
echo $currency->getShortCode() . ': ' . $currency->getName();
echo ' (' . $currency->getSymbol() . ')' . PHP_EOL;
echo 'USD Value: ' . $currency->getCurrentUsdValue() . PHP_EOL;
if ($currency->isProcessedViaAnotherCurrency()) {
echo 'Processed via: ' . $currency->getProcessedViaCurrencyCode() . PHP_EOL;
}
}
// Or get as arrays for easier manipulation
$currenciesArray = $axiomepayments->currencies->allAsArray();
Response - Currency Object:
short_code: Currency code (e.g., 'USD', 'EUR', 'GBP')name: Currency full name (e.g., 'US Dollar')symbol: Currency symbol (e.g., '$', 'β¬', 'Β£')current_usd_value: Current USD exchange rate valueprocessed_via_currency_code: Currency code this currency is processed via (null if processed directly)Currency Object Methods:
getShortCode(): Get the currency codegetName(): Get the currency namegetSymbol(): Get the currency symbolgetCurrentUsdValue(): Get the current USD exchange rate valuegetProcessedViaCurrencyCode(): Get the currency code this currency is processed viaisProcessedViaAnotherCurrency(): Check if this currency is processed via another currencyThe SDK includes built-in Laravel support. After installing via Composer, add the service provider to your config/app.php providers array:
'providers' => [
// ...
AxiomePayments\Laravel\AxiomePaymentsServiceProvider::class,
],
Add the facade to your aliases array:
'aliases' => [
// ...
'AxiomePayments' => AxiomePayments\Laravel\Facades\AxiomePayments::class,
],
Publish the configuration file:
php artisan vendor:publish --provider="AxiomePayments\Laravel\AxiomePaymentsServiceProvider" --tag="axiomepayments-config"
This will create a config/axiomepayments.php file. You can also use environment variables in your .env file:
AXIOMEPAYMENTS_API_KEY=your-api-key
AXIOMEPAYMENTS_API_SECRET=your-api-secret
AXIOMEPAYMENTS_ENVIRONMENT=sandbox
AXIOMEPAYMENTS_API_URL=https://custom-api.axiomepayments.com/v1.0 # Optional
Using the Facade:
use AxiomePayments\Laravel\Facades\AxiomePayments;
// Create a payment
$payment = AxiomePayments::payments->create([
'amount' => 99.99,
'currency' => 'USD',
]);
// Check payment status
$status = AxiomePayments::payments->status('payment_id');
// List payments
$payments = AxiomePayments::payments->list([
'limit' => 10,
'status' => 'completed'
]);
Using Dependency Injection:
use AxiomePayments\AxiomePayments;
class PaymentController extends Controller
{
public function store(Request $request, AxiomePayments $axiomepayments)
{
$payment = $axiomepayments->payments->create([
'amount' => $request->amount,
'currency' => 'USD',
]);
return redirect($payment->payment_url);
}
}
Create a webhook controller:
use Illuminate\Http\Request;
use AxiomePayments\Laravel\Facades\AxiomePayments;
class WebhookController extends Controller
{
public function handle(Request $request)
{
$payload = $request->all();
$signature = $request->header('X-Webhook-Signature');
if (!$this->verifySignature($payload, $signature)) {
abort(400, 'Invalid signature');
}
switch ($payload['type']) {
case 'payment_intent.succeeded':
// Handle successful payment
$payment = $payload['data'];
event(new PaymentCompletedEvent($payment));
break;
//...
case 'payment_intent.failed':
// Handle failed payment
event(new PaymentFailedEvent($payload['data']));
break;
}
return response()->json(['message' => 'Webhook processed']);
}
}
The SDK includes Laravel-specific test helpers. In your tests:
use AxiomePayments\Laravel\Facades\AxiomePayments;
class PaymentTest extends TestCase
{
public function test_can_create_payment()
{
$payment = AxiomePayments::payments->create([
'amount' => 99.99,
'currency' => 'USD',
]);
$this->assertNotNull($payment->id);
$this->assertEquals(99.99, $payment->amount);
$this->assertEquals('USD', $payment->currency);
}
}
This SDK is released under the MIT License. See LICENSE for details.