Drive a test payment to an outcome
const url = 'https://hub.stablezact.com/api/v1/sandbox/payments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/simulate';const options = { method: 'POST', headers: {'X-Public-Key': '<X-Public-Key>', 'Content-Type': 'application/json'}, body: '{"action":"complete"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://hub.stablezact.com/api/v1/sandbox/payments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/simulate \ --header 'Content-Type: application/json' \ --header 'X-Public-Key: <X-Public-Key>' \ --data '{ "action": "complete" }'Moves a test payment to success or failure so you can exercise both paths.
Two things to know. The field is action, not status, and anything
other than complete results in failure, so a wrong field name quietly
fails the payment rather than erroring.
A payment can only be simulated once. A second call answers 400 with
“Payment already failed” or “Payment already completed”, which is why a
fixed payment id cannot be reused across runs.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”The payment’s new state.
object
object
Examplegenerated
{ "success": true, "message": "example", "payment": { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "status": "example", "isTest": true, "transactionHash": "example" }}The payment is not pending, so it cannot be simulated again.
object
Short machine-ish reason.
Longer explanation, when there is one.
Example
{ "success": false}Missing or invalid credentials.
object
Short machine-ish reason.
Longer explanation, when there is one.
Example
{ "error": "API credentials required. Use x-public-key header or x-api-key and x-api-secret headers."}No test payment with that id.
object
Short machine-ish reason.
Longer explanation, when there is one.
Example
{ "success": false}