Sandbox Mock Service
Overview
The Sandbox mock service is designed to help partners integrate with Paysend Enterprise 3.0 API quickly and with minimal complexity. It allows you to test your integration logic without interacting with the live production environment.
In Sandbox, the service provides predefined, predictable responses, ensuring a consistent testing experience regardless of the request payload content.
How It Works
Default Success Response
For any valid request sent to any supported Paysend Enterprise 3.0 API endpoint in the Sandbox environment, the Mock Service will automatically return a success response containing the following structure within the tasks
array:
"result": {
"status": "string",
"code": 0,
"data": {
"traceId": "8878b45bb948490a8971c7ac130e0461",
"paymentId": "8878b45b-b948-490a-8971-c7ac130e0461"
},
"comment": "string"
}
Where:
- "code": 0 — Indicates a successful response.
- "traceId" and "paymentId" — Static, predefined values in the Sandbox environment for consistency.
- The fields "status" and "comment" contain static placeholder values in the Sandbox environment unless you simulate an error. In the case of a simulated error, these fields will contain values consistent with the predefined error response structure (see below).
Important: The content of your request body does not affect the success response — the Mock Service always returns "code": 0 unless you explicitly simulate an error (explained below).
Simulating Error Responses
To help you test error-handling in your integration, the Sandbox Mock Service allows you to intentionally trigger predefined error responses based on the value of specific fields in your request payload.
If you set a known error code as the value of a designated "simulation trigger" field, the Mock Service will return a corresponding error response with the "code" set to that value. The rest of the response structure remains unchanged.
Simulation Trigger Fields by API Function
API Function | Trigger Field |
---|---|
pay.toAccount | transferAmount |
pay.toCard | amount |
fx.rateGet | amountIn |
fx.rateGet.p2a | payoutAmount |
card.createToken | cardNumber |
card.infoGet | pan |
partner.statementGet | currency |
getBalance | currency |
task.statusGet | identifier or invoiceId |
Note:
The GET /processing/status/{globalId}
endpoint operates differently from the other API functions described above. It does not accept a request body — instead, it uses a globalId as a path parameter. These globalId values are dynamically generated by other API functions in the Sandbox environment and returned in their responses. You can use these values to test the GET /processing/status/ endpoint. The error simulation feature does not apply to this endpoint.
Example for pay.toCard
To simulate an error with code 3002 when calling the pay.toCard API, set the amount field as follows:
"amount": 3002
The Mock Service will respond with:
"result": {
"status": "Error",
"code": 3002,
"comment": "Unable to decrypt tokenised card. Please try again with the corrected card token."
}
Summary of Behavior
Request Content | Response Behavior |
---|---|
Any valid request without a simulation trigger field set to a known error code. | "code": 0 success response with static identifiers (except for globalId, which is dynamically generated). |
Request where a simulation trigger field is set to a valid error code. | Predefined error response with "code" set to the specified error code |
Error Code to API Function Mapping
Enterprise API will provide you with a detailed description of an error using error codes provided here.
Notes
- The Sandbox Mock Service is intended for testing purposes only and does not perform actual payment processing.
- The service provides consistent, static responses to simplify integration testing.
- For production environments, actual business logic and real-time payment processing apply.