jangopay / php-sdk
Server-side PHP SDK for JangoPay invoice payments
Requires
- php: >=8.1
This package is not auto-updated.
Last update: 2026-08-04 05:56:40 UTC
README
PHP 8.1+ 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'], ])['invoice']; $payment = $client->confirmPaymentCoin($invoice['invoice_id'], 'USDT', 'tron'); echo $client->getTransactionStatus($payment['txn_id'])['status'];
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.