Payments API

Process payments, handle refunds, and manage payment methods with enterprise-grade security.

Quick Start

Create a Payment

curl -X POST https://api.etaildepot.com/v2/payments \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10000,
    "currency": "USD",
    "payment_method": {
      "type": "card",
      "card": {
        "number": "4242424242424242",
        "exp_month": 12,
        "exp_year": 2025,
        "cvc": "123"
      }
    }
  }'

Endpoints

POST /payments

Create a new payment

Parameters:

  • amount - Payment amount in cents
  • currency - Three-letter currency code (USD, EUR, etc.)
  • payment_method - Payment method object
GET /payments/{id}

Retrieve a payment by ID

Authentication

Include your API key in the Authorization header:

Authorization: Bearer your_api_key_here

Keep your API keys secure and never expose them in client-side code.

Response Format

Successful Payment Response

{
  "id": "pay_1234567890",
  "object": "payment",
  "amount": 10000,
  "currency": "USD",
  "status": "succeeded",
  "payment_method": {
    "type": "card",
    "card": {
      "brand": "visa",
      "last4": "4242"
    }
  },
  "created": 1640995200
}

Error Handling

HTTP Status Codes

200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
402 Payment Required - Card declined

Error Response Example

{
  "error": {
    "type": "card_error",
    "code": "card_declined",
    "message": "Your card was declined.",
    "param": "payment_method"
  }
}

Need Help?

Developer Support

Get help with integration and technical questions.

Contact Support

API Console

Test API calls interactively in your browser.

Launch Console