Failure lab: what goes wrong, and how to recover
Trigger the errors integrations hit most - the tenancy boundary, duplicates, missing scopes, idempotency, limits, screening and a failed payout - and see how each one tells you what to do.
Each stage expects an error, and the stage passes when you get it. Read the console's explanation each time: the code is what your code should branch on.
Call a customer with your platform credential
Why
The most common platform bug: calling a customer's routes with the platform's own credential. Payezy answers not_found, the same as for an organization you have never heard of, so ids cannot be probed.
What happened
Use a customer key for customer routes, and your platform credential for /v1/platforms/... routes.
Create the same customer twice
Why
Imports get retried. Because Acme already has external_ref: acme-001, a second create is refused and tells you the existing customer's id.
What happened
details.customer_id is the customer you already have. Treat this as success in an import and carry on with that id.
Use a key without the scope
Why
Keys get only the scopes you grant, and they cannot change later. Mint a read-only key (no scopes means the read-only set), then try to add a recipient with it.
What happened
scope_not_held names the missing scope. Mint a new key with it; do not widen reporting keys.
Reuse an Idempotency-Key with a different payment
Why
An Idempotency-Key belongs to one intended payment. The first call succeeds; the second sends the same key with a different amount and is refused.
What happened
Generate one key per intended payment and store it with your own record. Retry with the same key and identical body; a changed payment gets a new key.
Go over the single-transfer limit
Why
Every organization has single-transfer and daily limits set by Payezy. getPaymentLimits shows them; going over returns a specific code.
What happened
Show the limit to the person before they submit. Only Payezy staff can change limits.
Pay a blocked recipient
Why
Recipients are screened. In the sandbox a name containing "Blocked" is blocked. Adding it works; paying it does not.
What happened
Check screening_status when you add a recipient and keep blocked recipients out of your pay flow.
Watch a payout fail
Why
Some failures happen after the money leaves - the receiving bank says the account is closed. In the sandbox an account number ending in 0002 fails.
Do it
- POSTAdd a recipient
- POSTSend a payment
- POSTAdvance a sandbox paymentProposed
Done when the payment failed
What happened
payment.updated arrived with status: failed; the reserved 40.40 USD went back to the available balance. getPayment shows failure with the reason to show your customer.
Finished
You have seen the errors that cause most integration support tickets, and how each one tells you what to do. The error reference lists every code.