Binance Pay API documentation
Take Binance Pay with our hosted checkout. Your server creates the payment in USD, the customer pays the exact amount to a Binance Pay ID and pastes the Order ID on our page, and we verify it with Binance in seconds.
Introduction
ZurvaPay Binance payments let any customer with a Binance account pay you in USDT (or USDC / FDUSD) through Binance Pay, while you price the order in USD. No wallet address, no blockchain wait: the customer pays inside the Binance app and we verify the payment with Binance by its Order ID.
Your server creates the payment, the customer pays on our hosted checkout, and we tell your server the result with a signed IPN.
| Create | POST https://zurvapay.com/payment/initiate (hosted checkout) |
|---|---|
| Amount | Always USD (currency=USD). The customer pays exactly that USD amount. |
| Minimum | USD 1.00. |
| Maximum | No limit. |
| Rate lock | 30 minutes from creation. |
| Accepted at Binance | USDT, USDC, FDUSD. |
How it works
- Create the payment — your server calls
POST /payment/initiatewithcurrency=USDand the USD amount, and gets a checkouturl. - Redirect — send the customer to that
urland they choose Binance. - Customer pays in Binance — sends the exact USD amount to the Pay ID shown and pastes the Order ID on our page. We verify it with Binance in seconds.
- Confirmed — the signed IPN is POSTed to your
ipn_url, the customer returns to yoursuccess_url, and you deliver the order once.
Rate lock & limits
- USD in, USD out. You send the amount in USD and the customer pays exactly that amount; it comes back in
binance_txid.usd_amount. - 30-minute lock. Until
expires_at. After that create a new payment. - Minimum: USD 1.00. Smaller amounts answer
validation_error. Maximum: no limit. - Exact amount. The Binance payment must match the USD amount within 1% (at least about USD 0.01) — that only absorbs rounding. Anything else answers
amount_mismatchand is not credited. - Coins: USDT, USDC or FDUSD. Any other coin answers
currency_not_supported. - Fresh payments only. The Binance payment must be made after the payment was created (
order_id_too_old) and within the last 7 days. - One Order ID, one payment. A used Order ID answers
order_id_already_used.
IPN (Webhook)
When the payment is settled we POST the result to your ipn_url as form fields. Answer with any HTTP 2xx. Until you do, we retry: 3 quick tries, then with back-off for about 11 hours (10 tries in total).
| Field | Value |
|---|---|
status | success |
identifier | Your identifier. |
signature, status_signature | See Verify the signature. |
data[payment_trx] | Our transaction ID. |
data[amount] | The USD amount of the payment, as a string (e.g. 5.30). |
data[currency][code] | USD |
data[payment_method] / data[payment_type] | binance-txid / direct |
data[charge] | The fee charged on this payment. |
POST https://yourshop.com/zurvapay/ipn.php
Content-Type: application/x-www-form-urlencoded
status=success
signature=9F2C4E...A41B
status_signature=5D7A0C...E9F3
identifier=ORD1002
data[payment_trx]=TRX3NB7Q0LKA
data[amount]=5.30 <- USD amount of the payment
data[account_holder]=
data[payment_type]=direct
data[payment_method]=binance-txid
data[payment_timestamp]=2026-12-05 14:00:00
data[charge]=0
data[currency][code]=USD
data[currency][symbol]=$
Verify the signature
Both signatures are HMAC-SHA256 with your secret key, hex, upper case. Use the amount string exactly as received.
signature | UPPER(HMAC_SHA256(amount + identifier, SECRET_KEY)) |
status_signature | UPPER(HMAC_SHA256("success|" + identifier + "|" + amount, SECRET_KEY)) |
- Check both signatures (constant-time compare).
- Find the order by
identifier. Already paid? Answer 200 and stop — IPNs can arrive more than once. - Compare
data[amount]with the USD amount of your order. - Mark the order paid once, then answer 200.
The submit answer and the status answer carry the same two signatures when status = success, so you can verify the same way without waiting for the IPN.
<?php
// ipn.php - the URL you send as ipn_url
require 'config.php';
$status = $_POST['status'] ?? '';
$identifier = $_POST['identifier'] ?? '';
$amount = $_POST['data']['amount'] ?? ''; // use the RAW string, do not round it
$sig = strtoupper(hash_hmac('sha256', $amount . $identifier, SECRET_KEY));
$sig2 = strtoupper(hash_hmac('sha256', $status . '|' . $identifier . '|' . $amount, SECRET_KEY));
if ($status !== 'success'
|| !hash_equals($sig, $_POST['signature'] ?? '')
|| !hash_equals($sig2, $_POST['status_signature'] ?? '')) {
http_response_code(400);
exit('invalid');
}
$order = find_order_by_identifier($identifier); // your own function
if (!$order) { http_response_code(404); exit('unknown order'); }
if ($order['paid']) { exit('OK'); } // already done: answer 2xx, do nothing
// Binance: data[amount] is the USD amount you created - compare it with the order.
if (number_format((float) $amount, 2) !== number_format((float) $order['amount_usd'], 2)) { http_response_code(400); exit('amount'); }
mark_order_paid($identifier, $_POST['data']['payment_trx']); // once, in a DB transaction
http_response_code(200);
echo 'OK'; // any 2xx stops the retries
// ipn route (Express): app.use(express.urlencoded({ extended: true }))
const crypto = require('crypto');
const SECRET = process.env.SECRET_KEY;
function hmac(text) {
return crypto.createHmac('sha256', SECRET).update(text).digest('hex').toUpperCase();
}
function same(a, b) {
const x = Buffer.from(String(a)), y = Buffer.from(String(b));
return x.length === y.length && crypto.timingSafeEqual(x, y);
}
app.post('/zurvapay/ipn', async (req, res) => {
const { status, identifier, signature, status_signature } = req.body;
const amount = req.body.data && req.body.data.amount; // raw string
if (status !== 'success'
|| !same(hmac(amount + identifier), signature)
|| !same(hmac(status + '|' + identifier + '|' + amount), status_signature)) {
return res.status(400).send('invalid');
}
const order = await findOrder(identifier);
if (!order) return res.status(404).send('unknown order');
if (!order.paid) await markOrderPaid(identifier, req.body.data.payment_trx); // once
res.send('OK'); // 2xx stops the retries
});
# ipn view (Flask)
import hmac, hashlib, os
from flask import Flask, request
app = Flask(__name__)
SECRET = os.environ["SECRET_KEY"].encode()
def sign(text):
return hmac.new(SECRET, text.encode(), hashlib.sha256).hexdigest().upper()
def ipn():
f = request.form
status, identifier = f.get("status", ""), f.get("identifier", "")
amount = f.get("data[amount]", "") # raw string
ok = (status == "success"
and hmac.compare_digest(sign(amount + identifier), f.get("signature", ""))
and hmac.compare_digest(sign(f"{status}|{identifier}|{amount}"), f.get("status_signature", "")))
if not ok:
return "invalid", 400
order = find_order(identifier)
if not order:
return "unknown order", 404
if not order.paid:
mark_order_paid(identifier, f.get("data[payment_trx]")) # once
return "OK", 200 # 2xx stops the retries
app.add_url_rule("/zurvapay/ipn", view_func=ipn, methods=["POST"])
Company vs own mode
| Mode | Customer pays to | Settlement |
|---|---|---|
company (default) | Our company Binance Pay ID. | The payment is credited to your Binance wallet with ZurvaPay. |
own | Your own Binance Pay ID (set with your Binance API key and secret in the merchant panel). | Straight to your Binance account — no platform balance, no fee. |
Your code does not change: always show the binance_id from the create answer, and binance_txid.mode tells you which mode this payment is in.
Security checklist
- Keep the secret key on your server only. Rotate it in the merchant panel if it ever leaks.
- Never mark an order paid from the browser, a return URL or the create answer — only from a verified
success(submit answer, status answer or IPN). - Verify
signatureandstatus_signaturewith a constant-time compare. - Make your IPN handler idempotent: the same IPN can arrive more than once.
- Use a new
identifierfor every attempt. - Strip everything but digits from the Order ID before you submit it.
- Keep a cron job (cron job guide) for orders still pending, in case your server was down when the IPN came.