Orders API
Manage orders, process refunds, generate invoices, and create checkout sessions. Orders are created when a customer completes a payment through ClapPay checkout.
Endpoints
GET
/api/v1/payment/payment-intents/List all orders (payment intents)
GET
/api/v1/payment/payment-intents/{id}/Retrieve a specific order
POST
/api/v1/payment/payment-intents/{id}/refund/Refund an order (full or partial)
GET
/api/v1/payment/invoices/List all invoices
GET
/api/v1/payment/invoices/{id}/Retrieve an invoice
GET
/api/v1/payment/invoices/{id}/download/Download invoice as PDF
POST
/api/v1/payment/storefront/checkout/Create a checkout session
GET
/api/v1/payment/portal/{token}/orders/Customer portal: order history
GET
/api/v1/payment/portal/{token}/invoices/Customer portal: invoices
Order Object
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | Unique order identifier |
| status | string | Order status: pending, succeeded, failed, refunded |
| amount | integer | Total amount in smallest currency unit |
| currency | string | ISO 4217 currency code |
| customer_email | string | Customer email address |
| customer_name | string | Customer name |
| items | array | Line items in the order |
| refunded_amount | integer | Amount refunded |
| metadata | object | Arbitrary key-value metadata |
| created_at | datetime | Order creation timestamp |
Example: Create Checkout Session
curl -X POST https://api.clappay.com/api/v1/payment/storefront/checkout/ \
-H "Content-Type: application/json" \
-d '{
"product_id": "prod_abc123",
"price_id": "price_xyz789",
"customer_email": "customer@example.com",
"success_url": "https://yoursite.com/success",
"cancel_url": "https://yoursite.com/cancel"
}'
# Response:
{
"checkout_url": "https://checkout.clappay.com/cs_abc123",
"session_id": "cs_abc123"
}Example: Issue Refund
curl -X POST https://api.clappay.com/api/v1/payment/payment-intents/{id}/refund/ \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"amount": 500,
"reason": "customer_request"
}'