Skip to content

Drive a test payment to an outcome

POST
/sandbox/payments/{paymentId}/simulate
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.

paymentId
required
string format: uuid
Media typeapplication/json
object
action
required
string
Allowed values: complete fail

The payment’s new state.

Media typeapplication/json
object
success
boolean
message
string
payment
object
id
string format: uuid
status
string
isTest
boolean
transactionHash
string | null
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.

Media typeapplication/json
object
success
boolean
error
required

Short machine-ish reason.

string
message

Longer explanation, when there is one.

string
Example
{
"success": false
}

Missing or invalid credentials.

Media typeapplication/json
object
success
boolean
error
required

Short machine-ish reason.

string
message

Longer explanation, when there is one.

string
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.

Media typeapplication/json
object
success
boolean
error
required

Short machine-ish reason.

string
message

Longer explanation, when there is one.

string
Example
{
"success": false
}