Error Handling

This guide covers common errors and how to handle them.

HTTP Status Codes

Code
Meaning

200

Success

201

Created

400

Bad Request - Invalid parameters

401

Unauthorized - Invalid API key

403

Forbidden - Not allowed to access resource

404

Not Found - Resource doesn't exist

429

Rate Limited - Too many requests

500

Server Error - Something went wrong

Error Response Format

{
  "statusCode": 400,
  "message": "Order ID \"order-123\" already exists for this merchant",
  "error": "Bad Request"
}

Common Errors

Authentication Errors

Invalid API Key

Solutions:

  • Verify your API key is correct

  • Check if IP whitelisting is enabled

  • Ensure your IP is in the whitelist

Charge Errors

Duplicate Order ID

Solution: Use unique order IDs for each charge.

Invalid Amount

Solution: Amount must be a positive number string (e.g., "25.00").

Charge Not Found

Solution: Verify the charge ID exists.

Cannot Cancel Charge

Solution: Only charges with PENDING status can be cancelled.

Chain Errors

Unsupported Chain

Solution: Use a chain ID from the supported chains list.

Clone Already Deployed

Solution: Chain can only be selected once per charge.

Handling Errors in Code

JavaScript/TypeScript

Python

Rate Limiting

Bedrock implements rate limiting to ensure service stability.

Endpoint
Limit

Create Charge

100/minute

Get Charge

300/minute

List Charges

60/minute

When rate limited, you'll receive:

Handling rate limits:

  1. Implement exponential backoff

  2. Cache responses when possible

  3. Batch operations where supported

Webhook Errors

Failed Delivery

If webhook delivery fails, Bedrock retries with exponential backoff.

Common causes:

  • Endpoint returned non-2xx status

  • Connection timeout

  • SSL/TLS errors

Solutions:

  • Return 200 status quickly

  • Process webhooks asynchronously

  • Use valid SSL certificates

Invalid Signature

If signature verification fails:

  1. Ensure you're using the raw request body

  2. Verify you're using the correct webhook secret

  3. Check for any middleware modifying the body

Last updated