Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

  • amount must be a positive number.

  • to and from must be valid Ethereum addresses for build requests.

  • nonce is required for build requests.

  • validBefore must be a number greater than or equal to 0.

  • resourceUrl is required.

  • resourcesDescription is required.

  • token must be enabled for the merchant and chosen network.

  • network must be enabled for the merchant; the worked examples use BASE_MAINNET.

Invalid Base64 Payload

Cause: the payment-signature value is not valid base64 JSON.

Fix:

  1. Create the signature payload as JSON.

  2. Convert it to UTF-8.

  3. Encode it as base64.

  4. Send the encoded string as the header value.

Node.js example:

Last updated