Skip to main content

Endpoints


Get Scenario Codes

Retrieves a list of supported scenario codes for direct debit contracts. Use these IDs when creating a contract. Scenarios define the type of service and transaction limits.

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)

Query Parameters

Example Request

Example Response

Error Responses


Create Contract

Creates a pre-authorization contract that users can sign to enable on-demand payments. Supports multiple payment providers (currently: BINANCE_PAY). Returns QR code and deep link for user approval.

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

Example Request (USDT Contract)

Example Request (LKR Contract with Slippage)

Example Response (USDT Contract)

Example Response (LKR Contract)

Note for LKR Contracts:
  • singleUpperLimit shows the USDT amount sent to Binance (after currency conversion + slippage buffer)
  • singleUpperLimitLkr shows the original LKR amount specified
  • slippageBps shows the slippage buffer applied (10000 bps = 100%)
  • In this example: 33000 LKR ÷ 330 (exchange rate) = 100 USDT, with 100% slippage = 200 USDT total limit

Error Responses


List Contracts

Retrieves a paginated list of contracts for the authenticated merchant. Supports filtering by status, branch, currency, payment provider, and search.

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)

Query Parameters

Example Request

Example Response

Error Responses


Get Contract Details

Retrieves contract details by ID. Only returns contracts belonging to the authenticated merchant.

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)

Path Parameters

Example Request

Example Response

Error Responses


Query/Sync Contract Status

Queries the payment provider for the latest contract status and syncs it to the database. Use this to check if a user has signed the contract.

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)

Path Parameters

Request Body

Empty object {}

Example Request

Example Response

Error Responses


Terminate Contract

Terminates a signed Direct Debit contract. Only contracts in SIGNED status can be terminated.

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)

Path Parameters

Request Body

Example Request

Example Response

Error Responses


Execute Payment

Executes an on-demand payment against a signed Direct Debit contract. Amount must not exceed the contract’s single upper limit.

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)

Path Parameters

Request Body

Goods Item Structure

Customer Billing Structure

Example Request (USDT Payment)

Example Request (LKR Payment)

Example Response

Response Notes

  • Direct debit payments do not include qrContent or checkoutLink fields as the payment is charged directly without user interaction
  • Payment starts in INITIATED status and transitions to PAID via webhook notification
  • In sandbox mode, payments are automatically marked as PAID

Error Responses


Currency & Slippage

Currency Support

Direct Debit contracts support two currencies:

Cross-Currency Payments

You can execute payments in either USDT or LKR regardless of the contract’s currency:
  • USDT contract → Can accept both USDT and LKR payments
  • LKR contract → Can accept both LKR and USDT payments
All payments are converted to USDT before being sent to the payment provider.

Slippage Protection for LKR Contracts

When creating an LKR contract, exchange rates may fluctuate between contract creation and payment execution. Slippage protection adds a buffer to handle these fluctuations. Example:
Slippage in Basis Points:
  • 0 bps = 0% (no buffer)
  • 5000 bps = 50%
  • 10000 bps = 100%
  • 20000 bps = 200% (maximum)
Important Notes:
  • Slippage only applies to LKR contracts
  • USDT contracts do not use slippage (rejected if provided)
  • Slippage defaults to 0 if not specified for LKR contracts
  • Maximum allowed slippage is 20000 bps (200%)

Payment Validation

When executing a payment:
  1. Currency conversion: Payment amount is converted to USDT using current exchange rate
  2. Limit validation: Converted USDT amount must not exceed contract’s singleUpperLimit (which includes slippage buffer for LKR contracts)
  3. Error handling: If payment exceeds limit, request is rejected with clear error message showing the conversion
Example Error Response:

Contract Status Reference

Direct Debit contracts have the following lifecycle statuses:

Webhooks

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

Error Responses

See Error Codes for detailed error handling.