A crypto payment gateway in PHP needs three calls: one that gives your customer an address to pay, one that converts
your price into the coin, and one endpoint on your side that receives a signed notification when the money arrives.
NoncePay is a non-custodial crypto payment API: every payment is forwarded to your own wallet, minus 1%. There is no
account, no API key and no SDK to install: curl and openssl, which every PHP host has, are enough.
Short answer
- Call
https://api.noncepay.app/{ticker}/create/with your callback URL and your wallet. You get anaddress_in. - Convert your order total with
/{ticker}/convert/and show the amount and the address to your customer. - When the payment is forwarded to your wallet, your callback URL receives a signed request. Verify the signature,
mark the order paid and answer
*ok*.
Using WooCommerce or PrestaShop? A plugin does all of this for you: see the WooCommerce and PrestaShop guides.
Step 1: create a payment address
Every coin has its own route: trc20/usdt for USDT on Tron, bep20/usdt for USDT on BNB Smart Chain, btc for
Bitcoin, base/usdc for USDC on Base. The full list, with each coin's minimum, is on the
coins page.
<?php
function createAddress(string $ticker, int $orderId, string $wallet): array {
$query = http_build_query([
'callback' => "https://your-shop.com/paid.php?order={$orderId}",
'address' => $wallet,
'pending' => 1,
]);
$body = json_decode(file_get_contents("https://api.noncepay.app/{$ticker}/create/?{$query}"), true);
if (($body['status'] ?? '') !== 'success') {
throw new RuntimeException($body['error'] ?? 'Unknown error');
}
return $body; // address_in, minimum_transaction_coin, ...
}
$payment = createAddress('trc20/usdt', 1042, 'TYourTronWallet');
The same callback URL always returns the same address, so calling it again for the same order is safe. Store
address_in on the order.
Step 2: show the amount and a QR code
Convert the order total from your currency to the coin, then show the amount and the address. /qrcode/ returns a
base64 PNG your customer can scan with a wallet app.
<?php
$api = 'https://api.noncepay.app/trc20/usdt';
$conversion = json_decode(file_get_contents("{$api}/convert/?" . http_build_query([
'value' => '49.90',
'from' => 'usd',
])), true);
$amount = $conversion['value_coin']; // a string, such as "49.97"
$qr = json_decode(file_get_contents("{$api}/qrcode/?" . http_build_query([
'address' => $payment['address_in'],
'value' => $amount,
])), true);
echo '<img src="data:image/png;base64,' . $qr['qr_code'] . '" alt="Payment QR code">';
echo '<p>Send ' . htmlspecialchars($amount) . ' USDT on Tron to ' . htmlspecialchars($payment['address_in']) . '</p>';
Keep amounts as strings and compare them with bccomp, never as floats.
Step 3: receive and verify the callback
NoncePay calls your URL once when the payment is seen (pending=1, because the address was created with pending=1)
and once when it has been forwarded to your wallet (pending=0). Every callback is signed with RSA-SHA256 in the
x-ca-signature header.
<?php
$pubkey = json_decode(file_get_contents('https://api.noncepay.app/pubkey/'), true)['pubkey'];
$url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$signature = base64_decode($_SERVER['HTTP_X_CA_SIGNATURE'] ?? '');
if (openssl_verify($url, $signature, $pubkey, OPENSSL_ALGO_SHA256) !== 1) {
http_response_code(401);
exit;
}
if (($_GET['pending'] ?? '') === '0') {
$order = $_GET['order'];
$amount = $_GET['value_coin'];
// mark the order paid if $amount covers it, once per $_GET['uuid']
}
echo '*ok*';
Cache the public key instead of fetching it on every request. A callback can arrive more than once: use uuid to
record each payment a single time. The callback reference lists every field.
Laravel and other frameworks
The calls are the same in any framework. Runnable shops with this flow are on GitHub, in plain PHP and Laravel.
Questions
Do I need Composer or an SDK? No. Two HTTP GET requests and openssl_verify are the whole integration.
Do I need an account or an API key? No. The callback URL identifies the payment and the money goes to the wallet you pass.
What does it cost? 1% per payment, down to 0.5% with volume, plus the network cost. No monthly fee. Fees in detail.
Is there a test mode? Make a small real payment above the coin's minimum: it goes through the same flow and lands in your wallet. The quickstart walks through it.
The short version of this code is in the PHP guide.