Test mode

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 modeLive mode
Client secret prefixsk_test_sk_live_
Hosthttps://api.withsuperpay.comhttps://api.withsuperpay.com
livemode on tokens and objectsfalsetrue
Business verification and custody accountTest onlyLive only
Custody walletsOn test networks: ethereum is Sepolia, polygon is Amoy, tron a Tron test networkOn the real networks
Originators, beneficiaries, quotes, conversions, payoutsTest onlyLive only
Balances, events, webhook subscriptionsTest onlyLive only
Money movementNone. 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.

POST/oauth2/token
Shell
curl 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"

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#

AreaIn test mode
DataSeparate from live. Nothing you create carries over.
Business verificationDecided by the custody partner's test environment. It can still ask for documents or reject.
Custody walletsOn test networks. Ask Superpay how to get test USDC or USDT. Never send real coins to a test-mode address.
BalancesSeparate from live, and start empty. GET /v1/balances returns "data": [] until your first conversion.
VerificationA 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.
ConversionsRates and execution come from the test environment. Do not treat test rates as live prices.
PayoutsOutcomes and bank_reference values come from the test environment. No beneficiary is credited.
Account typesA 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 IDsA 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.
WebhooksA test subscription's URL may use http, for example for a tunnel to your machine. Live URLs must use https.
TimingSuperpay'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.

#CallContinue when
1POST /oauth2/token without scopelivemode is false
2POST /v1/webhook-subscriptions with enabled_events: ["*"]Response is 201. Store its secret
3POST /v1/business-verification. If your business is verified with the form, have your people submit the test form insteadResponse is 201
4GET /v1/business-verificationstatus is ACTIVE, or business.verification_updated says so
5GET /v1/custody, then deposit test stablecoins to a walletThe wallet's balance is above zero
6POST /v1/originators, with an emailResponse is 201, status is ACTIVE
7GET /v1/originators/{id}verification.payable is true
8POST /v1/originators/{id}/beneficiaries, with the account type and the holder's identityResponse is 201, payouts_enabled is false, verification.requirements_due is empty
9GET /v1/beneficiaries/{id}payouts_enabled is true
10POST /v1/conversions/quotesResponse is 201, status is ACTIVE
11POST /v1/conversionsResponse is 201, status is CREATED
12GET /v1/conversions/{id}status is EXECUTED, or fx.executed arrived
13POST /v1/payoutsResponse is 201, status is CREATED
14GET /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#

ScenarioHow to triggerExpect
Missing tokenCall any /v1/ endpoint without Authorization401 UNAUTHENTICATED
Expired tokenReuse a token more than 30 seconds after expires_in has run out401 INVALID_TOKEN. Fetch one new token and retry once.
Scope not grantedRequest a scope your client ID was not issued, for example scope=example:none, at /oauth2/token400 with "error": "invalid_scope"
Missing scopeGet a token with scope=balances:read, then call POST /v1/payouts403 INSUFFICIENT_SCOPE
Wrong credentialsSend a wrong client secret401 with "error": "invalid_client"

Requests and idempotency#

ScenarioHow to triggerExpect
No idempotency keyPOST /v1/payouts without Idempotency-Key400 IDEMPOTENCY_KEY_REQUIRED
Invalid idempotency keySend Idempotency-Key: abc. Keys are 16 to 64 printable ASCII characters, no spaces.400 IDEMPOTENCY_KEY_INVALID
Safe retrySend the same POST twice with the same key and bodySame status and body. The second response has the header Idempotent-Replayed: true.
Key reusedReuse a key with a different body409 IDEMPOTENCY_KEY_REUSED
Invalid fieldsSend {"originator_id": "x", "amount": {"amount": 5, "currency": "INR"}} to POST /v1/payouts400 INVALID_ARGUMENT, with errors entries for originator_id, beneficiary_id and purpose_code
Malformed moneySend "amount": {"amount": "5000000", "currency": "INR"}, or 10.50 as the amount400 REQUEST_BODY_INVALID
Duplicate referenceCreate a payout with a reference you already used, under a new key409 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.

ScenarioHow to triggerExpect
Unknown originatorCreate a beneficiary under a well-formed org_ id that does not exist422 ORIGINATOR_NOT_FOUND
Beneficiary not verifiedCreate a payout straight after creating the beneficiary422 BENEFICIARY_NOT_PAYABLE, sub_code KYC_PENDING
Beneficiary with something dueCreate a beneficiary without the holder's identity. Its verification.status is REQUIREMENTS_DUE. Then create a payout to it422 BENEFICIARY_NOT_PAYABLE, sub_code KYC_REQUIREMENTS_DUE
Deleted beneficiaryDELETE /v1/beneficiaries/{id}, then create a payout to it422 BENEFICIARY_NOT_PAYABLE
Wrong originatorCreate two originators. Pay the first one's beneficiary with the second one's originator_id.422 BENEFICIARY_ORIGINATOR_MISMATCH
Wrong currencyPay a payable beneficiary with "currency": "USD"422 CURRENCY_MISMATCH

A payout to a beneficiary that is still being verified:

Shell
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"
  }'

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.

ScenarioHow to triggerExpect
A payable UPI IDCreate a beneficiary with account.type IN_UPI, a vpa and bank_account_type SAVINGS201, status ACTIVE, payouts_enabled true, account.vpa_handle and no vpa. beneficiary.created and beneficiary.verified both arrive
A UPI payoutPay that beneficiary ₹500.00 (50000)201, corridor IN-INR-UPI. Follow it as any payout: once paid it shows rail UPI
No declared account typeCreate a UPI beneficiary without bank_account_type, then pay itThe 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 laterPATCH that beneficiary with {"account": {"bank_account_type": "SAVINGS"}}200, status ACTIVE, payouts_enabled true
An account type UPI does not payCreate a UPI beneficiary with bank_account_type NRE, then pay itThe 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 capPay a payable UPI beneficiary ₹1,00,000.01 (10000001)201, then FAILED with LIMIT_EXCEEDED. Nothing is held
Two accounts in one requestSend account_number or ifsc with IN_UPI, or vpa with IN_BANK400 INVALID_ARGUMENT, with a field error on each field that does not belong
Not a UPI IDSend "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#

ScenarioHow to triggerExpect
Fixed fieldPATCH /v1/originators/{id} with a new reference400 INVALID_ARGUMENT, parameter_not_patchable on reference
nullPATCH /v1/beneficiaries/{id} with {"account": {"relationship": null}}400 REQUEST_BODY_INVALID
Locked fieldPATCH /v1/beneficiaries/{id} with a new account.holder_name once its verification has started: verification.status is PENDING or ACTIVE400 INVALID_ARGUMENT, parameter_locked on account.holder_name
Requirement suppliedCreate a beneficiary with its account type but without the holder's identity, then PATCH it with date_of_birth, nationality, address and id_document201 with the five identity fields in verification.requirements_due, then 200 with none due and verification.status PENDING
Emptied identityPATCH /v1/beneficiaries/{id} with {"date_of_birth": ""}400 INVALID_ARGUMENT, parameter_value_invalid on date_of_birth
Originator made readyCreate an originator with a phone and no email, then PATCH it with an email201 with status PENDING and email in verification.requirements_due, then 200 with status ACTIVE
Deleted partyDELETE a beneficiary, then PATCH it422 BENEFICIARY_NOT_CORRECTABLE

Conversions#

ScenarioHow to triggerExpect
Unsupported currencyQuote with "sell_currency": "XYZ" and a sell_amount in XYZ400 CURRENCY_UNSUPPORTED
Stablecoin as the sell currencyQuote with "sell_currency": "USDC" and a sell_amount in USDC422 QUOTE_UNAVAILABLE
Expired quoteWait until the quote's expires_at has passed, then accept it422 QUOTE_EXPIRED
Quote used twiceAccept the same quote_id again with a new key409 QUOTE_CONSUMED
Declined quoteDecline a quote with POST /v1/conversions/quotes/{id}/reject, then accept it200 for the decline, then 422 QUOTE_REJECTED
Not enough in one walletQuote more USD than your largest custody wallet holds, then accept422 CUSTODY_BALANCE_INSUFFICIENT. Nothing is created
No business verificationQuote USD before your business verification exists: before it is submitted, through the API or the form422 CUSTODY_ACCOUNT_REQUIRED

Documents#

ScenarioHow to triggerExpect
Wrong typeUpload a file with type=application/octet-stream400 DOCUMENT_CONTENT_TYPE_UNSUPPORTED
Content mismatchUpload a PNG declared as application/pdf400 DOCUMENT_CONTENT_MISMATCH
Same file twiceUpload the same file, type and owner again200 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:

Shell
curl https://api.withsuperpay.com/v1/payouts/po_01M2FPVYK07Z9B1D3F5H7K9M1P \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"

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.

ScenarioHow to triggerExpect
Cancel earlyPOST /v1/payouts/{id}/cancel straight after creating the payout200. Either status is already CANCELLED, or cancel_requested_at is set and the payout becomes CANCELLED
Cancel too lateCancel once the payout is SUBMISSION_PENDING, SUBMITTED, PROVIDER_PENDING or UNKNOWN200 with cancel_requested_at set, and a payout.cancel_requested event. The payout continues to its normal outcome
Cancel a finished payoutCancel a COMPLETED, FAILED, CANCELLED or REVERSED payout, such as the one from Asynchronous payout failure409 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#

ScenarioHow to triggerExpect
Signature checkRun your verifier against the test deliveryIt accepts the signature, and rejects the body changed by one byte
A failing endpointAnswer 500 to deliveries for a while, then 200The same Webhook-Id arrives again on the retry schedule. The delivery log shows each attempt
RedeliveryPOST /v1/webhook-subscriptions/{id}/deliveries with an event_id you received202, and the event arrives again with the same Webhook-Id
A URL the rules refuseCreate 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.

OutcomeWhere it showsSee
Business verification REQUIREMENTS_DUE or REJECTEDBusiness verification statusBusiness verification
Originator REJECTED or SUSPENDEDOriginator status and verificationOriginators
Name mismatch, rejection or suspensionBeneficiary verification_status MISMATCH, or status REJECTED or SUSPENDEDBeneficiaries
A beneficiary verification that gives no verdictBeneficiary status PENDING with status_reason_code KYC_EXPIREDVerification
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 accountfailure.code ORIGINATOR_NOT_ACTIVE or BENEFICIARY_NOT_PAYABLE with ledger_status RELEASEDPayouts
A payout to an account type that cannot be paid in the modefailure.code BENEFICIARY_NOT_PAYABLE straight after create, with ledger_status NONEBeneficiaries
A party rejected on sanctions screeningverification.payable false, and payouts FAILED with COMPLIANCE_REJECTEDVerification
A dealing-desk quoteQuote status PENDING_OTCConversions
A refused custody pullConversion failure_reason CUSTODY_TRANSFER_FAILEDConversions
Conversion failed by the banking partner, or UNKNOWNConversion status and failure_reasonConversions
Payout refused or failed by the banking partner or the beneficiary's bank, or not submitted within the retry limitfailure.code PROVIDER_REJECTED, PROVIDER_FAILED, ACCOUNT_TYPE_REJECTED_BY_BANK or RETRY_WINDOW_EXPIREDPayouts
Payout waiting for a banking partnerstatus FUNDS_RESERVED for longer than usualPayouts
Tax withheld at sourcetax_withheld on the payoutPayouts
Payout UNKNOWNPayout status. Funds stay reserved. Never create a replacement payout.Payouts
Payout REVERSED after COMPLETEDfailure.code PROVIDER_RETURNEDPayouts
Account not active403 TENANT_NOT_ACTIVE on every /v1/ callErrors

Pre-launch checklist#

Tick every item in test mode. Then follow Go live.

Credentials#

  1. Client secrets live server-side, in a secret manager, one pair per mode.
  2. Your service checks livemode at startup.
  3. Tokens are cached and renewed from expires_in, not fetched per request.
  4. A 401 INVALID_TOKEN fetches one new token and retries once.
  5. Each service requests only the scopes it needs.

Requests#

  1. Every request that takes an Idempotency-Key sends one. Retries reuse it. A corrected request gets a new one.
  2. Money is sent as integer minor units. No floats, no strings.
  3. Error handling branches on code and sub_code, never on detail or title.
  4. INVALID_ARGUMENT responses surface each entry in errors.
  5. You log X-Request-Id for every call.

Events#

  1. Your webhook endpoint verifies every signature on the raw body, and answers 2xx quickly.
  2. It deduplicates on Webhook-Id, and orders one object's events by resource.version.
  3. A job backfills from GET /v1/events with a watermark, so a missed delivery is caught.

Funding and onboarding#

  1. Your business verification is ACTIVE, and you watch business.verification_updated.
  2. Your wallet balances cover your conversions, one wallet per conversion.
  3. 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_due and correctable.
  4. Payouts are gated on verification.payable for both parties.

Conversions and payouts#

  1. You accept a quote straight after creating it, and re-quote on QUOTE_EXPIRED.
  2. You follow conversions to EXECUTED or FAILED, and keep waiting while UNKNOWN.
  3. You follow payouts until COMPLETED, FAILED, CANCELLED or REVERSED.
  4. UNKNOWN is treated as in progress. Nothing creates a second payout for the same obligation.
  5. A COMPLETED payout that later shows REVERSED is handled.
  6. bank_reference is stored and available to your support team.
  7. Your cancel flow handles a payout that completes anyway.
  8. Every failure path on this page has run at least once in test mode.