jangopay/php-sdk

Server-side PHP SDK for JangoPay invoice payments

Maintainers

Package info

github.com/JangoPayOrg/JangoPay_SDK_PHP

Issues

pkg:composer/jangopay/php-sdk

Transparency log

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

v0.14.0 2026-08-27 14:39 UTC

This package is not auto-updated.

Last update: 2026-08-30 14:08:55 UTC


README

PHP 7.0+ server-side SDK for the API Key invoice payment flow. It requires only PHP and its cURL extension at runtime.

composer require jangopay/php-sdk
use JangoPay\JangoPayClient;

$client = new JangoPayClient($_ENV['JANGOPAY_API_KEY']);
$invoice = $client->createInvoice([
    'currencyCode' => 'USD', 'amount' => '10.00', 'orderId' => 'merchant-order-123', 'allowedCurrency' => ['USDT'],
    'extraInfo' => ['customer_id' => 'CUS-10001'],
])['invoice'];
$payment = $client->confirmPaymentCoin($invoice['invoice_id'], 'USDT', 'tron');
echo $client->getTransactionStatus($payment['txn_id'])['status'];

Wait for completion

waitForTransactionCompletion polls every 3 seconds by default and waits at most 15 minutes. It returns only after settled; failed, rejected, and expired throw JangoPayTransactionWaitError.

$settled = $client->waitForTransactionCompletion($payment['txn_id'], 3, 900, function (array $transaction) {
    markMerchantOrderPaid($transaction);
});

The second and third arguments set polling interval and timeout in seconds. Use the trusted payment.completed webhook for actual fulfillment; polling is a synchronous-flow helper or fallback and does not replace webhook verification or idempotency.

The SDK uses https://api.jangopay.org by default, holds API Key tokens only in memory, refreshes them 30 seconds before expiry, and retries one protected request after a 401. Keep API Keys on trusted server infrastructure, never in browser code. For sandbox or a private deployment, pass the base URL as the second constructor argument.

Merchant API resources

For new integrations, use the grouped resource properties. Existing flat methods remain available.

$invoices = $client->invoices->list(['status' => 'pending', 'pageSize' => 20]);
$wallet = $client->ledger->getWallet('USDT', 'tron');
$rates = $client->exchange->listRates(['baseCurrency' => 'USDT', 'fiat' => 'USD']); // public; no token sent
$order = $client->exchange->convert([
    'fromCurrency' => 'USDT', 'fromChain' => 'tron', 'fromAmount' => '10', 'toCurrency' => 'USD', 'toChain' => 'fiat',
]);
$payout = $client->payouts->create([
    'currencyCode' => 'USDT', 'chain' => 'tron', 'amount' => '5', 'destinationAddress' => 'T...',
    'idempotencyKey' => 'merchant-payout-20260802-1',
]);

Resources are auth, invoices, ledger, exchange, and payouts. Assign only the necessary API Key permissions (invoice:create, order:read, exchange:trade, payout:create). API Key payout calls are non-interactive: withdrawal-password and TOTP input is rejected. Always provide a unique idempotencyKey for a payout.

Run composer test locally.

License

MIT License. Copyright (c) 2026 JangoPayOrg.