Testing
Build and verify your integration in test mode before you move real money.
Test mode is a separate copy of your Superpay account. Same host, same endpoints, same validation and error codes. No real money moves.
Test and live mode#
Your credential decides the mode. Nothing in a request can switch it.
| Test mode | Live mode | |
|---|---|---|
| Client secret prefix | sk_test_ | sk_live_ |
| Host | https://api.withsuperpay.com | https://api.withsuperpay.com |
livemode on tokens and objects | false | true |
| Business verification and custody account | Test only | Live only |
| Custody wallets | On test networks: ethereum is Sepolia, polygon is Amoy, tron a Tron test network | On the real networks |
| Originators, beneficiaries, quotes, conversions, payouts | Test only | Live only |
| Balances, events, webhook subscriptions | Test only | Live only |
| Money movement | None. Requests run against the test environments of Superpay's partners. | Real transfers to the beneficiary's bank. |
The two modes never share data
An id created in test mode does not exist in live mode. Reading it with a live token returns 404 with that resource's not-found code, for example PAYOUT_NOT_FOUND. Verify your business and onboard your originators and beneficiaries again in live mode. They go through live verification.
Get test credentials#
Superpay issues a client ID (cli_…) and a client secret for each mode. A test secret starts with sk_test_. It is shown once, so store it in your secret manager. A test secret does not work with a live client ID, and a live secret does not work with a test client ID.
Exchange the credentials for an access token. See Request an access token.
/oauth2/tokencurl https://api.withsuperpay.com/oauth2/token \
-u "$SUPERPAY_CLIENT_ID:$SUPERPAY_CLIENT_SECRET" \
-d grant_type=client_credentials \
--data-urlencode "scope=payouts:write payouts:read balances:read"{
"access_token": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjViZDc0ZmQ1MzUyOTExYzIiLCJ0eXAiOiJKV1QifQ...",
"expires_in": 300,
"livemode": false,
"scope": "payouts:write payouts:read balances:read",
"token_type": "Bearer"
}This token can only create and read payouts and read balances. For the happy path, omit scope so the token carries every scope your credential holds.
Check the mode#
The token response and every resource carry livemode. Assert it when your service starts. A test deployment that sees livemode: true, or a production deployment that sees livemode: false, has the wrong secret.
What stays the same#
- Endpoints, scopes and request formats.
- Validation rules, error codes and problem documents.
- Idempotency: keys, replays and conflicts.
- Payout fee and conversion spread rules, and the maximum quote lifetime.
- Asynchronous processing, events and webhooks.
What is different#
| Area | In test mode |
|---|---|
| Data | Separate from live. Nothing you create carries over. |
| Business verification | Decided by the custody partner's test environment. It can still ask for documents or reject. |
| Custody wallets | On test networks. Ask Superpay how to get test USDC or USDT. Never send real coins to a test-mode address. |
| Balances | Separate from live, and start empty. GET /v1/balances returns "data": [] until your first conversion. |
| Verification | A beneficiary's account is verified by the test environment of Superpay's banking partner. An originator waits for no partner: it is ACTIVE once it holds what a payout needs and no check by Superpay is outstanding. |
| Conversions | Rates and execution come from the test environment. Do not treat test rates as live prices. |
| Payouts | Outcomes and bank_reference values come from the test environment. No beneficiary is credited. |
| Account types | A declared NRE, NRO or SAVINGS bank account can be paid. Live mode may pay fewer of them: see Account types that can be paid. |
| UPI IDs | A beneficiary can be a UPI ID in test mode only: live mode refuses IN_UPI. A UPI ID is not verified, and is paid only when its holder declared an NRO or SAVINGS account. See UPI IDs. |
| Webhooks | A test subscription's URL may use http, for example for a tunnel to your machine. Live URLs must use https. |
| Timing | Superpay's own processing runs the same way. The partners' response times come from their test environments and do not predict live timing. Wait on events, or poll with backoff, not fixed waits. |
No magic values
Superpay does not define test amounts, names or account numbers that force a particular outcome. Trigger failures with the requests in Exercise failure paths. Outcomes you cannot trigger are listed in What you cannot trigger.
Run the happy path#
Run the full journey once in test mode before you build error handling. The Quickstart has every request.
| # | Call | Continue when |
|---|---|---|
| 1 | POST /oauth2/token without scope | livemode is false |
| 2 | POST /v1/webhook-subscriptions with enabled_events: ["*"] | Response is 201. Store its secret |
| 3 | POST /v1/business-verification. If your business is verified with the form, have your people submit the test form instead | Response is 201 |
| 4 | GET /v1/business-verification | status is ACTIVE, or business.verification_updated says so |
| 5 | GET /v1/custody, then deposit test stablecoins to a wallet | The wallet's balance is above zero |
| 6 | POST /v1/originators, with an email | Response is 201, status is ACTIVE |
| 7 | GET /v1/originators/{id} | verification.payable is true |
| 8 | POST /v1/originators/{id}/beneficiaries, with the account type and the holder's identity | Response is 201, payouts_enabled is false, verification.requirements_due is empty |
| 9 | GET /v1/beneficiaries/{id} | payouts_enabled is true |
| 10 | POST /v1/conversions/quotes | Response is 201, status is ACTIVE |
| 11 | POST /v1/conversions | Response is 201, status is CREATED |
| 12 | GET /v1/conversions/{id} | status is EXECUTED, or fx.executed arrived |
| 13 | POST /v1/payouts | Response is 201, status is CREATED |
| 14 | GET /v1/payouts/{id} | status is COMPLETED, or payout.completed arrived |
Your endpoint should have received and verified the events of every step. Once the payout's ledger_status is RESERVED, GET /v1/balances shows the amount plus fee moved from INR available to INR reserved. When the payout completes, the reservation leaves reserved. bank_reference appears on the payout once Superpay's banking partner reports it.
Exercise failure paths#
Every scenario below is triggered by what you send, not by a special value, and behaves the same way in live mode. The payout scenarios assume a beneficiary whose account type can be paid in the mode: where it cannot, the payout fails with BENEFICIARY_NOT_PAYABLE first. Send an Idempotency-Key with every request that takes one unless the scenario says otherwise.
Authentication and access#
| Scenario | How to trigger | Expect |
|---|---|---|
| Missing token | Call any /v1/ endpoint without Authorization | 401 UNAUTHENTICATED |
| Expired token | Reuse a token more than 30 seconds after expires_in has run out | 401 INVALID_TOKEN. Fetch one new token and retry once. |
| Scope not granted | Request a scope your client ID was not issued, for example scope=example:none, at /oauth2/token | 400 with "error": "invalid_scope" |
| Missing scope | Get a token with scope=balances:read, then call POST /v1/payouts | 403 INSUFFICIENT_SCOPE |
| Wrong credentials | Send a wrong client secret | 401 with "error": "invalid_client" |
Requests and idempotency#
| Scenario | How to trigger | Expect |
|---|---|---|
| No idempotency key | POST /v1/payouts without Idempotency-Key | 400 IDEMPOTENCY_KEY_REQUIRED |
| Invalid idempotency key | Send Idempotency-Key: abc. Keys are 16 to 64 printable ASCII characters, no spaces. | 400 IDEMPOTENCY_KEY_INVALID |
| Safe retry | Send the same POST twice with the same key and body | Same status and body. The second response has the header Idempotent-Replayed: true. |
| Key reused | Reuse a key with a different body | 409 IDEMPOTENCY_KEY_REUSED |
| Invalid fields | Send {"originator_id": "x", "amount": {"amount": 5, "currency": "INR"}} to POST /v1/payouts | 400 INVALID_ARGUMENT, with errors entries for originator_id, beneficiary_id and purpose_code |
| Malformed money | Send "amount": {"amount": "5000000", "currency": "INR"}, or 10.50 as the amount | 400 REQUEST_BODY_INVALID |
| Duplicate reference | Create a payout with a reference you already used, under a new key | 409 REFERENCE_EXISTS |
Errors are replayed too
Once a key is accepted, a 4xx response (validation, precondition or conflict) is stored against it. Retrying with the same key returns the same error. Fix the request and send it with a new key. Reuse a key only after a network error, a 5xx, a 401 or 403 (fix the token first), 409 RESOURCE_LOCKED or 409 IDEMPOTENCY_LEASE_LOST. See Idempotency.
Beneficiaries and payouts#
These checks run inside the create request. The beneficiary or payout is refused and never created.
| Scenario | How to trigger | Expect |
|---|---|---|
| Unknown originator | Create a beneficiary under a well-formed org_ id that does not exist | 422 ORIGINATOR_NOT_FOUND |
| Beneficiary not verified | Create a payout straight after creating the beneficiary | 422 BENEFICIARY_NOT_PAYABLE, sub_code KYC_PENDING |
| Beneficiary with something due | Create a beneficiary without the holder's identity. Its verification.status is REQUIREMENTS_DUE. Then create a payout to it | 422 BENEFICIARY_NOT_PAYABLE, sub_code KYC_REQUIREMENTS_DUE |
| Deleted beneficiary | DELETE /v1/beneficiaries/{id}, then create a payout to it | 422 BENEFICIARY_NOT_PAYABLE |
| Wrong originator | Create two originators. Pay the first one's beneficiary with the second one's originator_id. | 422 BENEFICIARY_ORIGINATOR_MISMATCH |
| Wrong currency | Pay a payable beneficiary with "currency": "USD" | 422 CURRENCY_MISMATCH |
A payout to a beneficiary that is still being verified:
curl https://api.withsuperpay.com/v1/payouts \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-H "Idempotency-Key: 7f3c1a9e-test-not-payable-01" \
-H "Content-Type: application/json" \
-d '{
"originator_id": "org_01M2FPKH20W4N5X6M3P9R2T1VA",
"beneficiary_id": "ben_01M2FPNHGG6C8D0F2H4K6M8P0R",
"amount": {"amount": 1000000, "currency": "INR"},
"purpose_code": "P1301",
"reference": "INV-TEST-0001"
}'{
"type": "about:blank",
"title": "FAILED_PRECONDITION",
"status": 422,
"detail": "Verification is still in progress; retry once the party is verified.",
"instance": "/v1/payouts",
"code": "BENEFICIARY_NOT_PAYABLE",
"request_id": "req_01M2FPRWY05F7H9K1N3Q5S7V9X",
"sub_code": "KYC_PENDING"
}UPI IDs#
A beneficiary can be a UPI ID in test mode. These are decided by Superpay itself, so they behave the same on every run. Send the holder's identity with each beneficiary, as for a bank account.
| Scenario | How to trigger | Expect |
|---|---|---|
| A payable UPI ID | Create a beneficiary with account.type IN_UPI, a vpa and bank_account_type SAVINGS | 201, status ACTIVE, payouts_enabled true, account.vpa_handle and no vpa. beneficiary.created and beneficiary.verified both arrive |
| A UPI payout | Pay that beneficiary ₹500.00 (50000) | 201, corridor IN-INR-UPI. Follow it as any payout: once paid it shows rail UPI |
| No declared account type | Create a UPI beneficiary without bank_account_type, then pay it | The beneficiary is PENDING with account.bank_account_type in verification.requirements_due. The payout is refused: 422 BENEFICIARY_NOT_PAYABLE, sub_code KYC_REQUIREMENTS_DUE |
| Declaring the type later | PATCH that beneficiary with {"account": {"bank_account_type": "SAVINGS"}} | 200, status ACTIVE, payouts_enabled true |
| An account type UPI does not pay | Create a UPI beneficiary with bank_account_type NRE, then pay it | The beneficiary is ACTIVE with payouts_enabled true. The payout is created with 201, then FAILED with BENEFICIARY_NOT_PAYABLE. Nothing is held |
| Over the UPI cap | Pay a payable UPI beneficiary ₹1,00,000.01 (10000001) | 201, then FAILED with LIMIT_EXCEEDED. Nothing is held |
| Two accounts in one request | Send account_number or ifsc with IN_UPI, or vpa with IN_BANK | 400 INVALID_ARGUMENT, with a field error on each field that does not belong |
| Not a UPI ID | Send "vpa": "not a upi id" | 400 INVALID_ARGUMENT, field account.vpa |
No one checks that a UPI ID exists, in test mode or in live mode, so any well-formed UPI ID is accepted. The outcome of a UPI payout that passes these checks comes from the test environment, like a bank payout's.
Corrections#
| Scenario | How to trigger | Expect |
|---|---|---|
| Fixed field | PATCH /v1/originators/{id} with a new reference | 400 INVALID_ARGUMENT, parameter_not_patchable on reference |
null | PATCH /v1/beneficiaries/{id} with {"account": {"relationship": null}} | 400 REQUEST_BODY_INVALID |
| Locked field | PATCH /v1/beneficiaries/{id} with a new account.holder_name once its verification has started: verification.status is PENDING or ACTIVE | 400 INVALID_ARGUMENT, parameter_locked on account.holder_name |
| Requirement supplied | Create a beneficiary with its account type but without the holder's identity, then PATCH it with date_of_birth, nationality, address and id_document | 201 with the five identity fields in verification.requirements_due, then 200 with none due and verification.status PENDING |
| Emptied identity | PATCH /v1/beneficiaries/{id} with {"date_of_birth": ""} | 400 INVALID_ARGUMENT, parameter_value_invalid on date_of_birth |
| Originator made ready | Create an originator with a phone and no email, then PATCH it with an email | 201 with status PENDING and email in verification.requirements_due, then 200 with status ACTIVE |
| Deleted party | DELETE a beneficiary, then PATCH it | 422 BENEFICIARY_NOT_CORRECTABLE |
Conversions#
| Scenario | How to trigger | Expect |
|---|---|---|
| Unsupported currency | Quote with "sell_currency": "XYZ" and a sell_amount in XYZ | 400 CURRENCY_UNSUPPORTED |
| Stablecoin as the sell currency | Quote with "sell_currency": "USDC" and a sell_amount in USDC | 422 QUOTE_UNAVAILABLE |
| Expired quote | Wait until the quote's expires_at has passed, then accept it | 422 QUOTE_EXPIRED |
| Quote used twice | Accept the same quote_id again with a new key | 409 QUOTE_CONSUMED |
| Declined quote | Decline a quote with POST /v1/conversions/quotes/{id}/reject, then accept it | 200 for the decline, then 422 QUOTE_REJECTED |
| Not enough in one wallet | Quote more USD than your largest custody wallet holds, then accept | 422 CUSTODY_BALANCE_INSUFFICIENT. Nothing is created |
| No business verification | Quote USD before your business verification exists: before it is submitted, through the API or the form | 422 CUSTODY_ACCOUNT_REQUIRED |
Documents#
| Scenario | How to trigger | Expect |
|---|---|---|
| Wrong type | Upload a file with type=application/octet-stream | 400 DOCUMENT_CONTENT_TYPE_UNSUPPORTED |
| Content mismatch | Upload a PNG declared as application/pdf | 400 DOCUMENT_CONTENT_MISMATCH |
| Same file twice | Upload the same file, type and owner again | 200 with the stored document |
Asynchronous payout failure#
Your balance is not checked when you create a payout. Create a payout whose amount plus fee is more than your INR available balance. The request returns 201. The payout then fails with failure.code INSUFFICIENT_FUNDS, announced by payout.failed. Nothing was reserved, so your balance is unchanged.
Use an ACTIVE originator. Otherwise the payout fails with ORIGINATOR_NOT_ACTIVE instead.
Retrieve the payout:
curl https://api.withsuperpay.com/v1/payouts/po_01M2FPVYK07Z9B1D3F5H7K9M1P \
-H "Authorization: Bearer $SUPERPAY_TOKEN"{
"object": "payout",
"id": "po_01M2FPVYK07Z9B1D3F5H7K9M1P",
"originator_id": "org_01M2FPKH20W4N5X6M3P9R2T1VA",
"beneficiary_id": "ben_01M2FPNHGG6C8D0F2H4K6M8P0R",
"corridor": "IN-INR-BANK",
"amount": {"amount": 10000000, "currency": "INR"},
"fee": {"amount": 25000, "currency": "INR"},
"status": "FAILED",
"compliance_status": "APPROVED",
"provider_status": "NOT_SUBMITTED",
"ledger_status": "NONE",
"settlement_status": "NOT_SETTLED",
"reconciliation_status": "NOT_RECONCILED",
"purpose_code": "P1301",
"reference": "INV-TEST-0002",
"failure": {"code": "INSUFFICIENT_FUNDS", "reason": "insufficient available balance"},
"livemode": false,
"created_at": "2026-09-30T10:19:40Z",
"updated_at": "2026-09-30T10:19:41Z",
"completed_at": "2026-09-30T10:19:41Z"
}An amount no banking partner can carry fails the same way, one step earlier. Create a payout of less than ₹1.00, for example "amount": {"amount": 50, "currency": "INR"}, to a payable beneficiary of an ACTIVE originator. The request returns 201. The payout then fails with failure.code LIMIT_EXCEEDED, announced by payout.failed. Nothing was reserved: ledger_status is NONE, and compliance_status is still PENDING.
Cancellation#
Cancel requests need an Idempotency-Key and no body.
| Scenario | How to trigger | Expect |
|---|---|---|
| Cancel early | POST /v1/payouts/{id}/cancel straight after creating the payout | 200. Either status is already CANCELLED, or cancel_requested_at is set and the payout becomes CANCELLED |
| Cancel too late | Cancel once the payout is SUBMISSION_PENDING, SUBMITTED, PROVIDER_PENDING or UNKNOWN | 200 with cancel_requested_at set, and a payout.cancel_requested event. The payout continues to its normal outcome |
| Cancel a finished payout | Cancel a COMPLETED, FAILED, CANCELLED or REVERSED payout, such as the one from Asynchronous payout failure | 409 PAYOUT_NOT_CANCELLABLE |
Processing starts in the background as soon as the payout is created, so an early cancel can land in either of the first two rows. Handle all three.
Webhooks#
| Scenario | How to trigger | Expect |
|---|---|---|
| Signature check | Run your verifier against the test delivery | It accepts the signature, and rejects the body changed by one byte |
| A failing endpoint | Answer 500 to deliveries for a while, then 200 | The same Webhook-Id arrives again on the retry schedule. The delivery log shows each attempt |
| Redelivery | POST /v1/webhook-subscriptions/{id}/deliveries with an event_id you received | 202, and the event arrives again with the same Webhook-Id |
| A URL the rules refuse | Create a live subscription with an http URL, or any subscription to https://localhost/ | 400 INVALID_ARGUMENT on url |
What you cannot trigger#
These outcomes depend on Superpay's partners or the beneficiary's bank. Superpay provides no way to force them in test mode. Handle them in code, and cover them with unit tests built from the response shapes on each API page.
| Outcome | Where it shows | See |
|---|---|---|
Business verification REQUIREMENTS_DUE or REJECTED | Business verification status | Business verification |
Originator REJECTED or SUSPENDED | Originator status and verification | Originators |
| Name mismatch, rejection or suspension | Beneficiary verification_status MISMATCH, or status REJECTED or SUSPENDED | Beneficiaries |
| A beneficiary verification that gives no verdict | Beneficiary status PENDING with status_reason_code KYC_EXPIRED | Verification |
| A payout not sent because a party's details were incomplete, or erased, when it was sent, or because the route could no longer pay the account | failure.code ORIGINATOR_NOT_ACTIVE or BENEFICIARY_NOT_PAYABLE with ledger_status RELEASED | Payouts |
| A payout to an account type that cannot be paid in the mode | failure.code BENEFICIARY_NOT_PAYABLE straight after create, with ledger_status NONE | Beneficiaries |
| A party rejected on sanctions screening | verification.payable false, and payouts FAILED with COMPLIANCE_REJECTED | Verification |
| A dealing-desk quote | Quote status PENDING_OTC | Conversions |
| A refused custody pull | Conversion failure_reason CUSTODY_TRANSFER_FAILED | Conversions |
Conversion failed by the banking partner, or UNKNOWN | Conversion status and failure_reason | Conversions |
| Payout refused or failed by the banking partner or the beneficiary's bank, or not submitted within the retry limit | failure.code PROVIDER_REJECTED, PROVIDER_FAILED, ACCOUNT_TYPE_REJECTED_BY_BANK or RETRY_WINDOW_EXPIRED | Payouts |
| Payout waiting for a banking partner | status FUNDS_RESERVED for longer than usual | Payouts |
| Tax withheld at source | tax_withheld on the payout | Payouts |
Payout UNKNOWN | Payout status. Funds stay reserved. Never create a replacement payout. | Payouts |
Payout REVERSED after COMPLETED | failure.code PROVIDER_RETURNED | Payouts |
| Account not active | 403 TENANT_NOT_ACTIVE on every /v1/ call | Errors |
Pre-launch checklist#
Tick every item in test mode. Then follow Go live.
Credentials#
- Client secrets live server-side, in a secret manager, one pair per mode.
- Your service checks
livemodeat startup. - Tokens are cached and renewed from
expires_in, not fetched per request. - A
401INVALID_TOKENfetches one new token and retries once. - Each service requests only the scopes it needs.
Requests#
- Every request that takes an
Idempotency-Keysends one. Retries reuse it. A corrected request gets a new one. - Money is sent as integer minor units. No floats, no strings.
- Error handling branches on
codeandsub_code, never ondetailortitle. INVALID_ARGUMENTresponses surface each entry inerrors.- You log
X-Request-Idfor every call.
Events#
- Your webhook endpoint verifies every signature on the raw body, and answers
2xxquickly. - It deduplicates on
Webhook-Id, and orders one object's events byresource.version. - A job backfills from
GET /v1/eventswith a watermark, so a missed delivery is caught.
Funding and onboarding#
- Your business verification is
ACTIVE, and you watchbusiness.verification_updated. - Your wallet balances cover your conversions, one wallet per conversion.
- You send each originator's email, and each beneficiary's declared account type and holder's identity. You wait for both to be payable, and act on
requirements_dueandcorrectable. - Payouts are gated on
verification.payablefor both parties.
Conversions and payouts#
- You accept a quote straight after creating it, and re-quote on
QUOTE_EXPIRED. - You follow conversions to
EXECUTEDorFAILED, and keep waiting whileUNKNOWN. - You follow payouts until
COMPLETED,FAILED,CANCELLEDorREVERSED. UNKNOWNis treated as in progress. Nothing creates a second payout for the same obligation.- A
COMPLETEDpayout that later showsREVERSEDis handled. bank_referenceis stored and available to your support team.- Your cancel flow handles a payout that completes anyway.
- Every failure path on this page has run at least once in test mode.