failure field instead. Failures and refunds covers those.
Error response
Flow payments endpoints return a JSON body witherror, a human-readable message, and code, a stable identifier, on most errors:
code, not on error, because messages can change. These errors have no code:
- Validation errors on create and payment-link requests.
404responses from the fee claim endpoints.400responses for missing or invalid request fields.- A quote with no route, which returns
quoteFailuresinstead, as described in Quote failures.
401 comes from authentication rather than from the flow, and its body can include other fields.
Retrying
The safe default is to read the flow, then decide the next request from its current state, as described in Resume and retry by state. Retry the same request only where the tables below say so.409responses. See the 409 codes below.5xxresponses. The request may or may not have taken effect, so read the flow before you retry.- The session token. A
401on the quote, prepare, broadcast, or cancel endpoints means the session token is missing, revoked, or expired, or that the flow ID is unknown. If the payment has not been sent, attach the source again to get a new token. These endpoints return401, not404, for a flow ID that does not exist.
409 codes
Every409 from a Flow payments endpoint carries one of these codes:
flow_tx_hash_already_recorded does not mean that this flow recorded the hash. Read the flow: if it is broadcasted or later, the payment is on its way.
Server endpoints
Create a flow or payment link
POST /server/{environmentId}/flow/{mode} and POST /server/{environmentId}/payment-links
Read a flow
GET /server/{environmentId}/flow/{flowId}
Cancel a flow
POST /server/{environmentId}/flow/{flowId}/cancel
Fees
The fee balance and claim endpoints return400 when recipientAddress is not a valid EVM address, and 404 without a code when there is nothing to claim or the claim request is unknown. See Fees API.
Payer endpoints
Read a flow and list exchanges
GET /sdk/{environmentId}/flow/{flowId} and GET /sdk/{environmentId}/flow/{flowId}/exchanges
Attach a source
POST /sdk/{environmentId}/flow/{flowId}/source
Get a quote
POST /sdk/{environmentId}/flow/{flowId}/quote
Prepare signing
POST /sdk/{environmentId}/flow/{flowId}/prepare
Report the transaction
POST /sdk/{environmentId}/flow/{flowId}/broadcast
Cancel as the payer
POST /sdk/{environmentId}/flow/{flowId}/cancel
Quote failures
When no route can settle the payment, the quote returns422 with a quoteFailures list. Each entry names a settlement token you configured and the reason it could not be quoted:
Treat a reason you do not recognize as
unknown.
Related
- API guide shows each request in context.
- Failures and refunds lists the
failure.codevalues of a failed flow. - Screening explains blocked results and how the payer recovers.