Going live

Go-live checklist

What to check before you send your first live payout.

Work through this list before your first live payout. The API behaves the same in test and live mode. What changes is your credentials, your data, your money and, possibly, the account types a payout can reach.

Live credentialsLive business verificationLive depositLive originators and beneficiariesConvertFirst payoutEvents and reconciliation
#CheckSection
1Live secret stored server-side, in a secret managerCredentials
2Tokens and objects show livemode: trueCredentials
3One access token cached and renewed shortly before it expiresTokens
4Every request that takes an Idempotency-Key sends one, and retries reuse itIdempotency
5Business verification ACTIVE in live mode, and stablecoins in a live custody walletFund your live conversions
6Originators and beneficiaries created again in live mode, and the account types live payouts can reach confirmed with SuperpayLive data
7A live webhook subscription, with signatures verified and a backfill from the event logEvents
8UNKNOWN is never treated as failedAsync states
9Errors branch on code, and only the right errors are retriedRetries
10Every payout carries your own reference, and you store its idReconciliation
11X-Request-Id logged for every callContact

Live credentials#

  • Separate credentials per mode. Superpay issues a client ID (cli_…) and a client secret for each mode. Live secrets start with sk_live_, test secrets with sk_test_. A test secret never works with a live client ID.
  • Same host. Test and live both use https://api.withsuperpay.com. The credential decides the mode. No header, path or parameter can switch it.
  • Assert the mode. The token response and every object carry livemode. In production, fail fast if it is not true.
  • Secrets stay server-side. Keep them in a secret manager. Never put them in a browser or mobile app, a repository or a log.
  • Treat the secret as opaque. Do not validate its length or characters beyond the prefix.
  • Least privilege. Request only the scopes a process needs, with the scope parameter on the token request. Omit scope to get every scope your credential holds.
ProcessScopes
Business verification and custodytreasury:manage treasury:read. Only treasury:read if your business is verified with the form and its people upload its documents there
Conversionfx:quote fx:execute fx:read balances:read treasury:read
Onboardingoriginators:write originators:read beneficiaries:write beneficiaries:read
Payoutspayouts:write payouts:read balances:read
Events and webhooksevents:read webhooks:manage
Reporting and reconciliationpayouts:read balances:read fx:read events:read

Secrets are shown once

Superpay stores only a one-way hash of your secret and cannot show it again. If a secret is lost or exposed, ask Superpay for a new credential and to revoke the old one. Revocation stops new token requests at once. Tokens already issued keep working until they expire.

There is no API for creating, rotating or revoking credentials. See Authentication.

Access tokens#

  • Cache the token. Reuse one token across requests. Token requests are slow by design, so never fetch a token per API call.
  • Renew before expiry. Read expires_in (seconds) from the token response instead of hard-coding a lifetime. There is no refresh token: call /oauth2/token again.
  • Form-encode the token request. Send application/x-www-form-urlencoded. A JSON body returns 400 unsupported_grant_type.
  • Recover from expiry once. On 401 INVALID_TOKEN, fetch a new token and retry the request once. Do not loop. With the cache below, call accessToken({ renew: true }).
  • Renew inside long polling loops. A loop that outlives expires_in needs a new token.
Token cache (Node.js 18+)
let cached = null; // { token, renewAt }

export async function accessToken({ renew = false } = {}) {
  if (!renew && cached && Date.now() < cached.renewAt) return cached.token;

  const credentials = Buffer.from(
    `${process.env.SUPERPAY_CLIENT_ID}:${process.env.SUPERPAY_CLIENT_SECRET}`
  ).toString('base64');

  const res = await fetch('https://api.withsuperpay.com/oauth2/token', {
    method: 'POST',
    headers: {
      Authorization: `Basic ${credentials}`,
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: new URLSearchParams({ grant_type: 'client_credentials' }),
  });
  const body = await res.json();
  if (!res.ok) throw new Error(`token request failed: ${body.error}`);

  // Catch test credentials deployed to production, or the reverse.
  const wantLive = process.env.SUPERPAY_LIVEMODE === 'true';
  if (body.livemode !== wantLive) throw new Error(`unexpected livemode: ${body.livemode}`);

  // Renew at 80% of the lifetime.
  cached = { token: body.access_token, renewAt: Date.now() + body.expires_in * 800 };
  return cached.token;
}

Idempotency keys#

  • Send Idempotency-Key wherever it is taken: creates, corrections, cancels, conversions and webhook changes. 16–64 printable ASCII characters, no spaces. A UUID works. See When to send a key.
  • One key per operation. Generate the key and save it with your own record before you send the request, so a retry after a crash finds the same key.
  • Retries reuse the key, the body and the path. Change the body and the API returns 409 IDEMPOTENCY_KEY_REUSED.
  • Never reuse a key for a different operation. Every credential on your account shares one set of keys per mode. Treat a key as bound to its first request for good.
  • Replays can be out of date. A replayed response carries Idempotent-Replayed: true. Its body can show an older status. GET the object for its current status.
First request ended withA retry with the same key returnsWhat you do
2xxThe same status and the same objectNothing more. GET for current state
4xx (validation, REFERENCE_EXISTS, BENEFICIARY_NOT_PAYABLE…)The same 4xx, every timeFix the cause, then send with a new key
5xx, timeout or no responseA fresh attempt, or the object the first attempt already createdRetry with the same key
Still running409 RESOURCE_LOCKEDWait briefly, retry with the same key

DELETE requests and document uploads take no key, and are safe to repeat. See Idempotency.

Fund your live conversions#

Your live business verification and custody account are separate from your test ones. Set them up again with a live token.

  • Verify your business in live mode. POST /v1/business-verification, then wait for status: ACTIVE, announced by business.verification_updated. Upload any documents it asks for. If your business is verified with the form, you submit nothing: your people fill in the live form Superpay emails them, and you wait for the same event. See Business verification.
  • Deposit into a live custody wallet. GET /v1/custody lists your live wallets. Send only the listed asset, on the listed network, to its address. Live wallets are on the real networks. See Custody account.
  • Size your wallets for your conversions. A conversion is funded from one wallet only. If no single wallet holds what it needs, accepting it returns 422 CUSTODY_BALANCE_INSUFFICIENT.
  • Convert to INR before paying out. Payouts draw on your INR balance. Create a quote, accept it before its expires_at, and wait for EXECUTED. Quotes expire quickly, so accept straight away. See Conversions.
  • Cover amount plus fee. When a payout is processed, amount plus fee moves from INR available to reserved. If available is short, the payout fails with INSUFFICIENT_FUNDS.
  • Watch reserved. It holds money for payouts and conversions in progress. It returns to available if they fail or are cancelled, and leaves your balance when they complete.
GET/v1/balancesbalances:read
Shell
curl https://api.withsuperpay.com/v1/balances \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"

Amounts are in minor units: 7305750 is ₹73,057.50. pending is always 0 today. See The balance object.

Recreate your data in live mode#

  • Test objects do not exist in live mode. An ID created in test mode is not found with a live token. Remove hard-coded test IDs.
  • Create originators again and check that each one's verification.payable is true. An originator with everything a payout needs, its email included, is ACTIVE as soon as it is created. See Originators.
  • Create beneficiaries again once their originator is ACTIVE, and wait until each one is payable. Send the account number, IFSC, holder name and declared account type, and the account holder's date of birth, nationality, address and identity document: a beneficiary without them is accepted but cannot be paid. See Beneficiaries.
  • Confirm which account types can be paid in live mode. Superpay sets them per mode, so an account type you paid in test mode is not necessarily paid in live mode, and a verified beneficiary does not prove it. Ask Superpay before your first live payout. A payout to an account type that cannot be paid fails with failure.code BENEFICIARY_NOT_PAYABLE straight after it is created, with nothing held. See Account types that can be paid.
  • Do not send UPI IDs yet. Payouts to UPI IDs work in test mode only. In live mode a beneficiary with account.type IN_UPI is refused with 422 INSTRUMENT_NOT_AVAILABLE, so pay bank accounts in live mode until Superpay tells you UPI is enabled there. See UPI payouts.
  • Create your webhook subscriptions again. Test subscriptions are not sent live events. Live URLs must use https. See Webhooks.

Events and webhooks#

  • Subscribe an endpoint with POST /v1/webhook-subscriptions, and store its secret from the response.
  • Verify every delivery on the raw body before you parse it. A stock Standard Webhooks library does it. See Verify the signature.
  • Answer fast. Any 2xx, with headers within 10 seconds. Store the event, answer, then process.
  • Deduplicate and order. Deduplicate on Webhook-Id. Order one object's events by resource.version.
  • Backfill. Keep a watermark and walk GET /v1/events forward from it, so a delivery your endpoint missed is still processed. See Keep up without gaps.
  • Watch the subscription's health, and listen for webhook_subscription.disabled on a second endpoint.

Asynchronous states#

A 201 means Superpay accepted the request, not that the work is done. Your balance is not checked when a payout is created: everything that involves your balance, Superpay's partners or the beneficiary's bank happens after the response. Accepting a conversion reads your custody wallets first, but the pull and the conversion happen after it.

Waiting forEventOr pollDone when
Business verificationbusiness.verification_updatedGET /v1/business-verificationstatus is ACTIVE. REJECTED needs you
Originatororiginator.verifiedGET /v1/originators/{id}verification.payable is true
Beneficiarybeneficiary.verifiedGET /v1/beneficiaries/{id}payouts_enabled and verification.payable are true. verification.status REQUIREMENTS_DUE needs you
Conversionfx.executed, fx.failedGET /v1/conversions/{id}status is EXECUTED or FAILED
Payoutpayout.completed, payout.failed, …GET /v1/payouts/{id}status is COMPLETED, FAILED, CANCELLED or REVERSED
  • Poll with backoff if you poll. Start at a few seconds. Back off to a minute or more for payouts still with the bank.
  • Poll lists for volume. Use GET /v1/payouts?status=SUBMITTED (or any other status) instead of one request per payout.
  • Handle every final status, including CANCELLED and REVERSED.
  • Cancellation is a request. POST /v1/payouts/{id}/cancel stops a payout only before it is sent to the banking partner. After that, the payout continues to its normal outcome. Read status afterwards.
  • A payout waiting in FUNDS_RESERVED has no banking partner that can take it yet. It waits with no time limit. Cancel it to release the funds, or contact Superpay.

UNKNOWN is not FAILED#

  • Show UNKNOWN as in progress to your users, not as failed.
  • Keep waiting, patiently. Resolution can take days in rare cases. Contact Superpay if it lasts longer than you can wait.
  • Same rule for conversions. A conversion in UNKNOWN keeps its funds reserved. Do not accept another quote for the same conversion.

COMPLETED can become REVERSED#

  • Watch recent completions. If the beneficiary's bank returns the money, a COMPLETED payout becomes REVERSED with failure.code PROVIDER_RETURNED, announced by payout.reversed. The amount is credited back to your available INR balance. The fee is not.
  • Returns can arrive days after completion. Keep listening, or re-check recently completed payouts for several days.

Failed payouts#

  • Branch on failure.code. failure.reason is human-readable text that can change. Do not parse it. Treat a code you do not recognise as a generic failure.
  • Create a new payout to try again, with a new reference and a new Idempotency-Key. A failed payout is never retried. Any funds it held are back in your available balance.
failure.codeStatusWhat you do
INSUFFICIENT_FUNDSFAILEDConvert more to INR, then create a new payout
ORIGINATOR_NOT_ACTIVEFAILEDIf the originator is PENDING, supply what its verification lists or wait, then create a new payout. If it is REJECTED or SUSPENDED, see originator statuses. If failure.reason names missing fields, correct the originator with them first
BENEFICIARY_NOT_PAYABLEFAILEDThe beneficiary changed after the payout was created, for example it was deleted, or it lacked a field the payout must carry: failure.reason then names it. Fix it or use another. Or its account type cannot be paid in live mode: do not resubmit to the same account, and see Account types that can be paid
LIMIT_EXCEEDEDFAILEDThe amount is under ₹1.00, or over a per-payout cap, where the route to the account has one. Create a new payout of at least ₹1.00, or ask Superpay what the cap is
COMPLIANCE_REJECTEDFAILEDA party was rejected on sanctions screening. Contact Superpay. Do not resubmit
PROVIDER_REJECTEDFAILEDThe banking partner refused the instruction, or the route cannot take a party's address (over 128 characters) or the account holder's identity document (not a passport or a national ID). Check the payout and both parties, then create a new payout
ACCOUNT_TYPE_REJECTED_BY_BANKFAILEDThe bank refused the credit for this account type. Create a new payout: it goes to a partner that may credit the account, or fails with BENEFICIARY_NOT_PAYABLE when none may in live mode. Contact Superpay if it fails with this code again
RETRY_WINDOW_EXPIREDFAILEDThe payout could not be sent in time. Create a new payout
PROVIDER_FAILEDFAILEDThe payment failed at the bank. Create a new payout if appropriate
PROVIDER_RETURNEDREVERSEDThe beneficiary's bank returned the money. Confirm the account details with the beneficiary

See Payout statuses and Failure codes.

Errors and retries#

  • Branch on code, and on sub_code where there is one. Errors under /v1 are application/problem+json with a stable code. title and detail are for people and can change. The token endpoint returns OAuth errors instead: branch on error.
  • Log X-Request-Id from every response. Error bodies repeat it as request_id. You can send your own X-Request-Id (letters, digits and _ . : -, up to 128 characters). Any other value is replaced without an error.
  • Send exact bodies. Unknown fields are rejected. Money amounts are integers in minor units, never floats or strings.
  • Parse responses tolerantly. Ignore fields you don't recognise. Most objects leave out empty fields; webhook subscriptions and deliveries send null.
  • Back off with jitter and cap the number of attempts.
ResponseRetryHow
Timeout, dropped connection, no responseYesSame key, same body. A retry never creates a duplicate, though a retried quote may be priced again
5xxYesSame key, same body, with backoff
503 or 429YesWait Retry-After seconds, then retry with the same key
409 RESOURCE_LOCKED, 409 IDEMPOTENCY_LEASE_LOSTYesSame key, after a short wait
401 INVALID_TOKENOnceFetch a new token first
401 UNAUTHENTICATEDNoSend Authorization: Bearer <access_token>
403 INSUFFICIENT_SCOPENoRequest a token with the scope, or ask Superpay to grant it
403 TENANT_NOT_ACTIVENoYour account is not active. Contact Superpay. A new token does not help
Any other 400, 404, 409, 410 or 422NoFix the cause. Send again with a new key

Some error bodies also carry "retryable": true: retrying the same request can succeed. See When to retry.

Reconciliation#

  • Set reference on every payout to your own identifier, up to 128 bytes. It must be unique across all your payouts in a mode, including failed and cancelled ones. A duplicate returns 409 REFERENCE_EXISTS.
  • Store the payout id next to your record as soon as the 201 arrives. You cannot look a payout up by reference.
  • Lost the response? Retry with the same Idempotency-Key to get the payout back. If you no longer have the key and a new attempt returns 409 REFERENCE_EXISTS, list payouts filtered by beneficiary_id and match on reference.
  • Match on id, reference, amount, fee, tax_withheld, status, failure.code, bank_reference and completed_at.
  • Trace money with bank_reference. It is the reference from the beneficiary's banking network (typically the UTR), present once known. It can be missing, even on a completed payout. Do not validate its format.
  • Account for tax_withheld. When tax is withheld at source, the beneficiary receives amount minus tax_withheld. What leaves your balance is still amount plus fee.
  • Detect changes from status, not updated_at. updated_at can change while status does not.
  • Read completed_at as "reached a final status". It is also set on FAILED, CANCELLED and REVERSED payouts. On a REVERSED payout it is the time of the return, not of the original completion.
  • Sweep daily. Page through your payouts and compare them with your own ledger. Include recently completed payouts, to catch returns.
GET/v1/payoutspayouts:read

Lists are newest first. While has_next is true, pass the last id on the page as starting_after.

Shell
curl -G https://api.withsuperpay.com/v1/payouts \
  -H "Authorization: Bearer $SUPERPAY_TOKEN" \
  -d limit=100 \
  -d beneficiary_id=ben_01M2FPNHGGT6JC9PXS2HM4VA7E

Contact Superpay#

Talk to Superpay about anything the API cannot do for you.

SituationAsk for
New credential, rotation, or a lost or exposed secretA new credential, and revocation of the old one
400 invalid_scope, or 403 INSUFFICIENT_SCOPE on a token with every scope you holdThe scope granted to your credential
403 TENANT_NOT_ACTIVEThe status of your account
The custody partner's end-user agreement and its versionThe agreement your business must accept before business verification
A business verification REJECTED and not correctable, or a document request marked document.otherA review, or what is needed
A deposit that does not show in your wallet's balance, or coins sent on the wrong networkA review of the deposit
USD left in your balance after a failed conversion that you want back in custodyIts return
An originator or beneficiary REJECTED or MISMATCH that is not correctable and that you believe is rightA review of the party
A payout in UNKNOWN, waiting in FUNDS_RESERVED, or still in progress for longer than expectedThe outcome of the payout
The account types your live payouts can reach, or a payout to a verified beneficiary that failed with BENEFICIARY_NOT_PAYABLE without naming a missing fieldThe account types that can be paid in your live mode

Include in every request:

  • The request_id of the failing call, or its X-Request-Id header
  • The object ID (po_…, ben_…, org_…, fxo_…, cus_…) and your reference
  • livemode
  • The time of the call, in UTC
  • The error code and sub_code, or the object's status and failure code

Never send a client secret, an access token or a webhook signing secret to anyone, including Superpay.