Mark a payment failed, cancelled or expired
POST
/payments/fail
const url = 'https://hub.stablezact.com/api/v1/payments/fail';const options = { method: 'POST', headers: {'X-Public-Key': '<X-Public-Key>', 'Content-Type': 'application/json'}, body: '{"paymentId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","status":"failed","reason":"example"}'};
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/payments/fail \ --header 'Content-Type: application/json' \ --header 'X-Public-Key: <X-Public-Key>' \ --data '{ "paymentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "status": "failed", "reason": "example" }'Closes a payment the customer will not complete. This records the outcome; it does not move money.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
paymentId
required
string format: uuid
status
Anything outside these three is silently treated as failed rather than rejected.
string
reason
string
Responses
Section titled “Responses”Recorded.
Media typeapplication/json
object
success
boolean
message
string
status
string
skipped
True when the payment was already in a final state, so nothing changed. Not an error.
boolean
Examplegenerated
{ "success": true, "message": "example", "status": "example", "skipped": true}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."}