Testing in the Sandbox
Test your Global Payout integration with simulated funds. Choose a payout outcome with a prefix, and force statuses.
Introduction
The sandbox runs the full Global Payout flow with simulated funds. Every Global Payout API endpoint works in the sandbox, from the beneficiary to the payout. Some extra endpoints exist only in the sandbox. You use them to force statuses.
Authentication works as in production. The Global Payout API feature must be enabled for your merchant account. A status change in the sandbox sends the same event types as in production.
Before you test:
- Get your sandbox SNAP credentials and register your sandbox webhook URLs. See Step 1 and Step 2 of Preparation. Send your requests to
https://api-sandbox.durianpay.id. - Read the balance checks of a payout in Step 3 of Preparation.
Sandbox and production have separate dashboards, credentials, webhook URLs and public keys.
Simulating a Payout
Step 1: Choose the outcome with a prefix
Create the payout as in Step 6: Create the payout. To choose its outcome, start its partnerReferenceNo with a prefix from this table. For example, FAILED-001 starts with the prefix FAILED-.
Use a new partnerReferenceNo for each payout, for example FAILED-002 for the next one. If you send the same partnerReferenceNo with another request body, the API returns PARTNER_REFERENCE_NO_CONFLICT (4090001).
| Prefix | Simulated outcome |
|---|---|
None or COMPLETE- | completed within 30 seconds, with the actual values in settlement. |
SLOW- | processing for about ten minutes, then completed. |
FAILED- | failed with INVALID_BENEFICIARY_DETAILS. Durianpay returns the debit to your sandbox balance. |
FAILED-PROCESSING- | failed with PROCESSING_ERROR. Durianpay returns the debit to your sandbox balance. |
RETURNED- | completed. About two minutes later, the funds come back, and the payout is refunded. |
DECLINE-<code>- | failed without a debit. The failure code is the <code>: INSUFFICIENT_BALANCE, BALANCE_CUT_OFF or CORRIDOR_SUSPENDED. Example: DECLINE-BALANCE_CUT_OFF-. |
STUCK- | processing, with the debit applied, until you force a status in Step 2. |
Rules for the prefixes:
- Only the
partnerReferenceNoof a payout starts a scenario. A prefix on another resource, such as a customer, starts no scenario. - The prefixes are fixed test inputs. Copy them exactly.
- If more than one prefix matches, the longest prefix applies. For example,
FAILED-PROCESSING-001matchesFAILED-andFAILED-PROCESSING-. SoFAILED-PROCESSING-applies. - The timings are approximate. Use the status changes and the events to see the outcome.
Production is differentIn production, a payout can stay in
processinglonger than in the sandbox. Follow its returned status. Do not expect the timing or the outcome of a sandbox scenario.
Step 2: Force a payout status
Do this step only when you want to choose the status yourself, for example for a STUCK- payout.
First, call the Fetch Payout Transitions API. It returns the statuses that you can force for the payout now. The call changes nothing.
GET /v1.0/global/sandbox/payouts/{referenceNo}/status
{
"responseCode": "2000000",
"responseMessage": "Successful",
"status": "processing",
"allowed": ["completed", "failed"]
}The allowed list depends on the payout. You can force only completed and failed. For other statuses, use a prefix. Use RETURNED- for refunded.
Then send a status from allowed to the Force Payout Status API.
POST /v1.0/global/sandbox/payouts/{referenceNo}/status
{
"status": "failed",
"failureCode": "INVALID_BENEFICIARY_DETAILS"
}- Send
failureCodeonly with the statusfailed. If you omit it, thefailurecode isPROCESSING_ERROR. - To test a specific failure, send one of these
failureCodevalues:INVALID_BENEFICIARY_DETAILS,ACCOUNT_CLOSED,ACCOUNT_BLOCKED,ACCOUNT_NOT_ELIGIBLE,NAME_MISMATCH,LIMIT_EXCEEDED,BANK_REJECTED_OTHER,COMPLIANCE_REJECTED,PURPOSE_NOT_ACCEPTED,REJECTED,PROCESSING_ERROR. - A forced
failedpayout is final. If the payout has a debit, Durianpay returns it to your sandbox balance immediately. - If you send the same successful request again, the API returns the result. The balance does not change again. Durianpay does not send the events again.
Step 3: Handle the result
Each status change sends global.payout.updated, as in production. Check that your server handles the event. If your server needs the details, call the Fetch Payout by ID API. See Webhooks and Status Definition.
Simulating Beneficiary and Customer Screening
Force a status to test how you handle each status. Do not use it to predict the status changes in production. A forced status can skip steps that production takes.
Force a beneficiary status
Use the Force Beneficiary Status API.
POST /v1.0/global/sandbox/beneficiaries/{referenceNo}/status
Target status | From |
|---|---|
active | processing |
rejected | processing or active |
{
"status": "rejected"
}- The change sends
global.beneficiary.updated, as in production. - If you send the same successful request again, the API returns the beneficiary and sends no second event.
- A forced change from
activetorejectedskips a new screening.
Force a customer status
Use the Force Customer Status API. It works only in a setup with customers.
POST /v1.0/global/sandbox/customers/{referenceNo}/status
Target status | From |
|---|---|
processing | active |
active | processing |
rejected | processing or active |
{
"status": "processing"
}- Each change sends
global.customer.updated, as in production. - You can force
activetorejectedor toprocessingwithout a call to the Update Customer API.
Sandbox Errors
The sandbox endpoints on this page can return these errors:
| Error | Meaning |
|---|---|
RESOURCE_NOT_FOUND (4040001) | No payout, beneficiary or customer has this referenceNo for your merchant account. |
ACTION_NOT_ALLOWED (4050001) | The change is not allowed from the current status. A payout cannot change from completed, failed or refunded. |
FIELD_INVALID (4000001) | Only for payouts. You sent a failureCode that is not in the list above, or a failureCode with a target other than failed. |
CUSTOMER_NOT_ALLOWED (4030025) | Only for customers. Your sandbox merchant account has a setup without customers. See Step 4: Register the customer. |
Simulating Account Validation
The Validate Account API has three results: valid, invalid and service_unavailable. All three return HTTP 200 with the same details keys. No sandbox input is documented that gives invalid or service_unavailable. To test these two results, use a mocked response.
What the Sandbox Does Not Simulate
The prefixes and the forced statuses control the outcomes of payouts, beneficiaries and customers. They do not cover these cases:
- You cannot test an event for a change of the corridor requirements. The Global Payout API has only three events.
- You cannot test a corridor that leaves the corridor list. With the
DECLINE-CORRIDOR_SUSPENDED-prefix, one payout fails, but the corridor stays in the list.
To get CORRIDOR_UNAVAILABLE (4030024), use a corridor that the sandbox corridor list does not show.
Updated about 14 hours ago
