Error Handling
Every refusal from the Pymstr API carries a status and a code.
Error Format
status repeats the HTTP status, and code is one of the values below.
{
"status": 400,
"code": "bad_request"
}One refusal carries a third field. A 409 with conflict on POST /v1/payments or POST /v1/payouts means the
externalId is already in use, and id is the payment or payout that holds it (see
Lost Response).
{
"status": 409,
"code": "conflict",
"id": "01234567-89ab-cdef-0123-456789abcdef"
}Error Codes
Each status has one generic code, which the API answers unless a more specific code below applies.
| Status | Code |
|---|---|
400 | bad_request |
401 | unauthorized |
403 | forbidden |
404 | not_found |
408 | request_timeout |
409 | conflict |
411 | length_required |
413 | payload_too_large |
415 | unsupported_media_type |
429 | too_many_requests |
431 | headers_too_large |
500 | server_error |
502 | bad_gateway |
503 | unavailable |
504 | gateway_timeout |
The specific codes an API key can receive:
| Status | Code | Endpoint | Meaning |
|---|---|---|---|
400 | recipient_refused | POST /v1/payments, POST /v1/payouts | A seller or payee address cannot receive funds: Pymstr's fee wallet or a paymaster address, or an account that is suspended |
400 | record_not_active | DELETE /v1/payments/:id, DELETE /v1/payouts/:id | The payment or payout is no longer ACTIVE |
Failure Details
A payment or payout with status FAILED carries an error object: { code, message, details? }. Use code in your
logic; message is free text.
| Code | Meaning |
|---|---|
TX_REVERTED | The transaction reached the blockchain and reverted. Nothing was paid. |
BUNDLER_DROPPED | The transaction was submitted but never confirmed, and it has expired. |
FOREIGN_IMPLEMENTATION | The paying wallet was running code Pymstr does not support, and its transaction did not make the required transfers. |
details is optional. On FOREIGN_IMPLEMENTATION it holds implementation, the contract the wallet ran.
Common Mistakes
Invalid amount format
The amount field is a string with 0, 1, or 2 decimal places. A JSON number such as 100.00 is rejected, and so is a
third decimal place. Zero-decimal currencies (JPY, IDR, VND) reject fractional amounts.
| Rejected | Accepted |
|---|---|
100.00 "100.123" | "100" "100.5" "100.00" |
Sellers take too much
The sellers' cuts must leave you a cut. After the fee, your cut and each seller's cut must still meet the currency's Min
split (see Currencies & Chains). Otherwise the API returns 400 with bad_request.