Error Handling
Diagnose Ivorypay x402 request errors, including missing credentials, signatures and invalid payment data.
The API returns JSON error responses for invalid requests.
Missing API Key
Cause: the Authorization header was not provided.
{
"message": "Please provide your api key",
"error": "Bad Request",
"statusCode": 400
}Fix: include your merchant API key.
Authorization: <merchant-api-key>Missing Payment Signature
Cause: POST /api/x402/submit was called without the payment-signature header.
{
"message": "PAYMENT-SIGNATURE header is required",
"error": "Bad Request",
"statusCode": 400
}Fix: base64-encode the signed x402 payload and send it as:
Multiple Payment Signature Headers
Cause: more than one payment-signature value was sent.
Fix: send exactly one payment-signature header.
Validation Errors
Cause: the request body does not match the required field types.
Common validation issues:
amountmust be a positive number.toandfrommust be valid Ethereum addresses for build requests.nonceis required for build requests.validBeforemust be a number greater than or equal to0.resourceUrlis required.resourcesDescriptionis required.tokenmust be enabled for the merchant and chosen network.networkmust be enabled for the merchant; the worked examples useBASE_MAINNET.
Invalid Base64 Payload
Cause: the payment-signature value is not valid base64 JSON.
Fix:
Create the signature payload as JSON.
Convert it to UTF-8.
Encode it as base64.
Send the encoded string as the header value.
Node.js example:
Last updated