Payments API

Create a payment, redirect to hosted checkout, and finalize status via webhook callback.

Create Payment

POST /api/payments/create

POST /api/payments/create
Idempotency-Key: order-1001
Authorization: Bearer pk_xxx
x-api-secret: sk_xxx
x-timestamp: 1710000000
x-signature: <hmac>
Content-Type: application/json

Request Body

{
  "amount": 1499.00,
  "currency": "INR",
  "redirectUrl": "https://merchant.example.com/checkout/callback",
  "customer": {
    "name": "Amit",
    "email": "amit@example.com",
    "phone": "9999999999"
  }
}

Hosted Redirect

Use `hostedUrl` from create response and redirect the customer to `/pay/<publicPaymentId>`.

Response (Create)

{
  "success": true,
  "data": {
    "orderId": "ord_123",
    "publicPaymentId": "pay_abcd...",
    "hostedUrl": "https://your-gateway.com/pay/pay_abcd..."
  }
}