Skip to main content

Endpoints

MethodEndpointDescriptionRate Limit
POST/v1/paymentCreate a new payment100 req/min
GET/v1/payment/:idGet payment details300 req/min
GET/v1/payment/listList payments200 req/min

Create Payment

Creates a new payment order. Returns a QR code and checkout link for customer payment.
POST /v1/payment

Authentication

Requires HMAC authentication with headers:
  • x-api-key: Your API key ID only (e.g., ak_live_xxx)
  • x-timestamp: Current Unix timestamp in milliseconds
  • x-signature: HMAC-SHA256 signature (using derived signing key)

Request Body

FieldTypeRequiredDescription
amountnumberYesPayment amount (minimum 0)
currencystringYesCurrency code: USDT or LKR
providerstringYesPayment provider: BYBIT or BINANCE
goodsarrayYesArray of goods/products being purchased
goods[].namestringYesProduct name
goods[].descriptionstringYesProduct description
goods[].mccCodestringNoMerchant Category Code (default: 5818)
branchIdstring (UUID)NoBranch ID for multi-branch merchants
orderExpireTimestringNoExpiration time (Unix timestamp in seconds)
webhookUrlstringNoURL to receive payment status updates
merchantTradeNostringNoYour internal order reference
customerBillingobjectYesCustomer billing details
customerBilling.firstNamestringYesCustomer first name
customerBilling.lastNamestringYesCustomer last name
customerBilling.emailstringYesCustomer email
customerBilling.phonestringYesCustomer phone
customerBilling.addressstringYesStreet address
customerBilling.citystringNoCity
customerBilling.postalCodestringNoPostal/ZIP code
customerBilling.countrystringNoCountry

Currency Handling

  • USDT: Payment is created directly in USDT
  • LKR: Amount is automatically converted to USDT using the current exchange rate

Example Request

curl -X POST "https://api.ceypay.io/v1/payment" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here" \
  -d '{
    "amount": 149.99,
    "currency": "USDT",
    "provider": "BYBIT",
    "goods": [
      {
        "name": "Wireless Headphones",
        "description": "Noise-cancelling Bluetooth headphones",
        "mccCode": "5732"
      }
    ],
    "webhookUrl": "https://mystore.com/api/payment-webhook",
    "customerBilling": {
      "email": "[email protected]",
      "firstName": "John",
      "lastName": "Doe",
      "phone": "+94771234567",
      "address": "123 Main Street"
    }
  }'

Example Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchantId": "merchant_12345",
  "payId": "bybit_pay_abc123",
  "paymentNo": "320045925616",
  "amount": 149.99,
  "currency": "USDT",
  "status": "INITIATED",
  "qrContent": "bybit://pay?id=abc123...",
  "checkoutLink": "https://checkout.bybit.com/pay/abc123",
  "goods": [
    {
      "name": "Wireless Headphones",
      "description": "Noise-cancelling Bluetooth headphones",
      "mccCode": "5732"
    }
  ],
  "customerBilling": {
    "email": "[email protected]",
    "firstName": "John",
    "lastName": "Doe"
  },
  "paymentProvider": "BYBIT",
  "expireTime": "2025-01-15T11:30:00.000Z",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "feeBreakdown": {
    "grossAmountUSDT": 149.99,
    "exchangeFeePercentage": 1.0,
    "exchangeFeeAmountUSDT": 1.5,
    "ceypayFeePercentage": 0.5,
    "ceypayFeeAmountUSDT": 0.75,
    "totalFeesUSDT": 2.25,
    "netAmountUSDT": 147.74
  }
}

Response Fields

FieldTypeDescription
idstringUnique payment ID
merchantIdstringYour merchant ID
payIdstringPayment provider’s payment ID
paymentNostringMerchant trade number
amountnumberPayment amount in USDT
currencystringCurrency code (always USDT for processing)
statusstringPayment status: INITIATED, PAID, EXPIRED, FAILED
qrContentstringQR code content for mobile wallet scanning
checkoutLinkstringWeb checkout URL to redirect customers
goodsarrayProducts/services in this payment
customerBillingobjectCustomer billing details (if provided)
paymentProviderstringPayment provider used
expireTimestringWhen the payment expires (ISO 8601)
createdAtstringWhen the payment was created (ISO 8601)
feeBreakdownobjectFee breakdown details

LKR Payment Response

When creating a payment in LKR, additional fields are returned:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 101.52,
  "currency": "USDT",
  "usdtAmount": 101.52,
  "exchangeRateSnapshot": 295.5,
  "lkrGrossAmount": 30000.0,
  "lkrExchangeFeeAmount": 750.0,
  "lkrCeypayFeeAmount": 300.0,
  "lkrNetAmount": 28950.0,
  "feeBreakdown": {
    "grossAmountUSDT": 101.52,
    "grossAmountLKR": 30000.0,
    "exchangeFeePercentage": 2.5,
    "exchangeFeeAmountUSDT": 2.54,
    "exchangeFeeAmountLKR": 750.0,
    "ceypayFeePercentage": 1.0,
    "ceypayFeeAmountUSDT": 1.02,
    "ceypayFeeAmountLKR": 300.0,
    "totalFeesUSDT": 3.56,
    "totalFeesLKR": 1050.0,
    "netAmountUSDT": 97.96,
    "netAmountLKR": 28950.0
  }
}

Get Payment

Retrieve details for a specific payment.
GET /v1/payment/:id

Path Parameters

ParameterTypeDescription
idstringPayment ID

Example Request

curl "https://api.ceypay.io/v1/payment/550e8400-e29b-41d4-a716-446655440000" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here"

Error Responses

StatusDescription
403Payment does not belong to your merchant account
404Payment not found

List Payments

Retrieve a paginated list of your payments.
GET /v1/payment/list

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
pageSizenumber20Items per page
statusstring-Filter by status: INITIATED, PAID, EXPIRED, FAILED
dateRangestring-Date range preset: last7, last30, last90, custom
searchstring-Search by payment ID or customer info

Example Request

curl "https://api.ceypay.io/v1/payment/list?page=1&pageSize=20&status=PAID" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here"

Example Response

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "amount": 149.99,
      "currency": "USDT",
      "status": "PAID",
      "createdAt": "2025-01-15T10:30:00.000Z",
      "paidAt": "2025-01-15T10:35:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "pageSize": 20,
    "totalItems": 150,
    "totalPages": 8
  }
}

Payment Status

StatusDescription
INITIATEDPayment created, awaiting customer payment
PAIDCustomer completed payment successfully
EXPIREDPayment expired before customer paid
FAILEDPayment failed (network error, insufficient funds, etc.)

Webhooks

Set webhookUrl in your payment request to receive real-time status updates. See Webhooks Guide for payload format, signature verification, and retry policy.

Error Responses

StatusErrorDescription
400Bad RequestInvalid request body or validation error
401UnauthorizedInvalid API key or signature
403ForbiddenPayment belongs to another merchant
404Not FoundPayment not found
429Too Many RequestsRate limit exceeded
See Error Codes for detailed error handling.