Skip to content

API Checkout

Overview

API Checkout provides merchants with a streamlined one-step payment flow for building custom checkout UIs. Merchants have full control over the user interface while the platform handles all on-chain payment capabilities.

Core features:

  • Custom checkout UI: Merchants fully control the checkout user experience
  • One-step flow: Create orders directly without a separate quote step
  • On-chain transfer: Supports multiple blockchain networks (TRON, ETH, BSC, and more)
  • Stablecoins only: Supports USDC, USDT, and USD1

PERMISSION REQUIRED

API Checkout is a separate product that requires explicit enablement. Contact technical support to activate API Checkout (API_PERMISSION_DISABLED error code 50010 if not enabled).


Authentication

All API requests use the same HMAC-SHA256 signature scheme as the main API. Include the following headers on every request:

HeaderTypeRequiredDescriptionExample
X-TimestampLongYesRequest timestamp (milliseconds, 13 digits)1640000000000
X-SignatureStringYesRequest signature (Base64-encoded)calculated-signature

Signature algorithm:

signaturePayload = timestamp + "\n" + METHOD + "\n" + path + "\n" + SHA256(body)
X-Signature = Base64(HMAC-SHA256(signaturePayload, apiSecret))
  • SHA256(body) is the Base64-encoded hash of the request body
  • For GET requests without query parameters, omit the fourth component: timestamp + "\n" + METHOD + "\n" + path
  • For GET requests with query parameters, queryString is hashed as the fourth component; path does not include query parameters
  • HTTP method must be uppercase

See Signature Algorithm for full details and code examples.


Environments

EnvironmentBase URL
Productionhttps://api.paystablecoin.global
Sandboxhttps://api.sandbox.paystablecoin.global

1. Get Payment Methods

Retrieve the list of payment methods available to the merchant before creating an order. Use this to display available currency/network options in your checkout UI and to validate combinations before order creation.

Endpoint Information

  • Method: GET
  • Path: /api/v1/merchants/{merchantId}/checkout/payment-methods
  • Authentication: Required

Path Parameters

ParameterTypeRequiredDescriptionExample
merchantIdStringYesMerchant IDMCH_20240101_ABC123

Request Example

bash
curl -X GET "https://api.paystablecoin.global/api/v1/merchants/MCH_20240101_ABC123/checkout/payment-methods" \
  -H "X-Timestamp: 1640000000000" \
  -H "X-Signature: <calculated-signature>"

Response Fields

FieldTypeDescriptionExample
codeStringResponse code. 00000 indicates success00000
messageStringResponse messageSuccess
dataObjectResponse data-
data.merchantIdStringMerchant IDMCH_20240101_ABC123
data.paymentMethodsArrayList of available payment methods-
data.paymentMethods[].paymentMethodTypeStringPayment method typeON_CHAIN_TRANSFER
data.paymentMethods[].cryptoCurrencyStringCryptocurrency (USDC / USDT / USD1)USDC
data.paymentMethods[].networkStringBlockchain network codetron
data.paymentMethods[].networkDisplayNameStringNetwork display nameTRON Network
data.paymentMethods[].minAmountNumberMinimum payment amount0.1
data.paymentMethods[].maxAmountNumberMaximum payment amount999999999
data.paymentMethods[].estimatedConfirmationTimeSecIntegerEstimated confirmation time (seconds)60
data.paymentMethods[].displayOrderIntegerDisplay order (lower number = higher priority)1

Response Example

json
{
  "code": "00000",
  "message": "Success",
  "data": {
    "merchantId": "MCH_20240101_ABC123",
    "paymentMethods": [
      {
        "paymentMethodType": "ON_CHAIN_TRANSFER",
        "cryptoCurrency": "USDC",
        "network": "tron",
        "networkDisplayName": "TRON Network",
        "minAmount": 0.10,
        "maxAmount": 999999999.00,
        "estimatedConfirmationTimeSec": 60,
        "displayOrder": 1
      },
      {
        "paymentMethodType": "ON_CHAIN_TRANSFER",
        "cryptoCurrency": "USDC",
        "network": "eth",
        "networkDisplayName": "Ethereum(ERC20)",
        "minAmount": 10.00,
        "maxAmount": 999999999.00,
        "estimatedConfirmationTimeSec": 900,
        "displayOrder": 2
      },
      {
        "paymentMethodType": "ON_CHAIN_TRANSFER",
        "cryptoCurrency": "USDT",
        "network": "tron",
        "networkDisplayName": "TRON Network",
        "minAmount": 0.10,
        "maxAmount": 999999999.00,
        "estimatedConfirmationTimeSec": 60,
        "displayOrder": 3
      }
    ]
  }
}

2. Create Checkout Order

After the user selects a payment method in your checkout UI, call this endpoint to create the order. The platform returns order details including the deposit address and amount to display to the user.

Endpoint Information

  • Method: POST
  • Path: /api/v1/merchants/{merchantId}/checkout/orders
  • Content-Type: application/json
  • Authentication: Required

Path Parameters

ParameterTypeRequiredDescriptionExample
merchantIdStringYesMerchant IDMCH_20240101_ABC123

Request Body — Required Fields

FieldTypeRequiredDescriptionExample
merchantOrderIdStringYesMerchant order ID (unique per merchant, 16–64 chars, alphanumeric + _ - only, used for idempotency)ORDER_2024010112345678
orderAmountObjectYesOrder amount. Only USDC, USDT, and USD1 are supported{"value": "100.50", "currency": "USDC"}
orderAmount.valueStringYesStablecoin amount100.50
orderAmount.currencyStringYesStablecoin code: USDC / USDT / USD1USDC
paymentMethodTypeStringYesPayment method type. Fixed value: ON_CHAIN_TRANSFERON_CHAIN_TRANSFER
networkStringYesBlockchain network code (e.g. tron, eth, bsc). Must be a valid combination with orderAmount.currencytron
expiresAtStringYesOrder expiration time (UTC, ISO 8601). Maximum 24 hours from creation2024-01-01T13:00:00Z

Request Body — Optional Fields

FieldTypeRequiredDescriptionExample
customerObjectNoBuyer information (for risk control)-
customer.emailStringNoBuyer email addressuser@example.com
customer.nameStringNoBuyer nameJohn Doe
customer.customerIdStringNoBuyer ID from merchant systemUSR_12345
descriptionStringNoOrder description (max 512 chars)Purchase of 2 items
itemsArrayNoLine item details-
items[].nameStringNoItem nameiPhone 15 Pro
items[].quantityIntegerNoItem quantity1
items[].priceStringNoItem unit price999.00
items[].currencyStringNoItem currency codeUSDC
customerIpStringNoClient IP address for risk control (max 64 chars)192.168.1.100
userAgentStringNoClient User-Agent for device identification (max 512 chars)Mozilla/5.0...
callbackUrlStringNoWebhook callback URL for async payment status notifications (max 2048 chars)https://api.merchant.com/webhooks/payment
metadataStringNoMerchant custom metadata, returned as-is (max 4096 chars, JSON format recommended){"orderId":"12345","source":"web"}

IMPORTANT

  1. merchantOrderId must be unique per merchant. It is used for idempotency — submitting the same merchantOrderId twice returns the existing order without creating a duplicate.
  2. The orderAmount.currency and network combination must appear in the results of Get Payment Methods. Use that endpoint first to confirm available combinations.
  3. expiresAt is recommended to be set to 30 minutes from creation time.

Request Examples

Example 1: USDC on TRON

bash
curl -X POST https://api.paystablecoin.global/api/v1/merchants/MCH_20240101_ABC123/checkout/orders \
  -H "X-Timestamp: 1640000000000" \
  -H "X-Signature: <calculated-signature>" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantOrderId": "ORDER_2024010112345678",
    "orderAmount": {
      "value": "100.50",
      "currency": "USDC"
    },
    "paymentMethodType": "ON_CHAIN_TRANSFER",
    "network": "tron",
    "expiresAt": "2024-01-01T13:00:00Z",
    "description": "Purchase of 2 items",
    "callbackUrl": "https://api.merchant.com/webhooks/payment"
  }'

Example 2: USDC on ETH with buyer info

bash
curl -X POST https://api.paystablecoin.global/api/v1/merchants/MCH_20240101_ABC123/checkout/orders \
  -H "X-Timestamp: 1640000000000" \
  -H "X-Signature: <calculated-signature>" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantOrderId": "ORDER_2024010112345679",
    "orderAmount": {
      "value": "200.00",
      "currency": "USDC"
    },
    "paymentMethodType": "ON_CHAIN_TRANSFER",
    "network": "eth",
    "expiresAt": "2024-01-01T13:00:00Z",
    "customer": {
      "email": "user@example.com",
      "name": "John Doe",
      "customerId": "USR_12345"
    },
    "items": [
      {
        "name": "iPhone 15 Pro",
        "quantity": 1,
        "price": "999.00",
        "currency": "USDC"
      }
    ],
    "customerIp": "192.168.1.100",
    "callbackUrl": "https://api.merchant.com/webhooks/payment"
  }'

Response Fields

FieldTypeDescriptionExample
codeStringResponse code. 00000 indicates success00000
messageStringResponse messageSuccess
data.orderIdStringPlatform order IDORD_20240101_1234567890ABCDEF
data.merchantIdStringMerchant IDMCH_20240101_ABC123
data.merchantOrderIdStringMerchant order IDORDER_2024010112345678
data.statusStringOrder status: INIT / PROCESSING / SUCCEEDED / FAILED / CLOSEDINIT
data.orderAmountObjectOrder amount{"value": "100.50", "currency": "USDC"}
data.cryptoPaymentAmountObjectAmount the user must pay (may include fees){"value": "101.00", "currency": "USDC"}
data.depositAddressStringAddress the user must transfer funds toTYdRLmP9kN4oY3hZ8xT6wQ2vS5uW7aV1b
data.networkStringBlockchain network codetron
data.networkDisplayNameStringNetwork display nameTRON Network
data.createdAtString (ISO 8601)Order creation time (UTC)2024-01-01T12:00:00Z
data.expiresAtString (ISO 8601)Order expiration time (UTC)2024-01-01T13:00:00Z

DISPLAYING PAYMENT INFO

After order creation, immediately display the following to the user in your checkout UI:

  • depositAddress — the wallet address to send funds to
  • cryptoPaymentAmount — the exact amount the user must send (not orderAmount)
  • networkDisplayName — the network on which the transfer must be made
  • A countdown timer based on expiresAt

The user must send at least cryptoPaymentAmount.value. Sending more is accepted; sending less causes the order to fail.

Response Examples

Success:

json
{
  "code": "00000",
  "message": "Success",
  "data": {
    "orderId": "ORD_20240101_1234567890ABCDEF",
    "merchantId": "MCH_20240101_ABC123",
    "merchantOrderId": "ORDER_2024010112345678",
    "status": "INIT",
    "orderAmount": {
      "value": "100.50",
      "currency": "USDC"
    },
    "cryptoPaymentAmount": {
      "value": "101.00",
      "currency": "USDC"
    },
    "depositAddress": "TYdRLmP9kN4oY3hZ8xT6wQ2vS5uW7aV1b",
    "network": "tron",
    "networkDisplayName": "TRON Network",
    "createdAt": "2024-01-01T12:00:00Z",
    "expiresAt": "2024-01-01T13:00:00Z"
  }
}

Error — invalid parameter:

json
{
  "code": "10001",
  "message": "Invalid parameter: orderAmount.currency must be one of: USDC, USDT, USD1",
  "data": null
}

3. Query Checkout Order

Query the latest status and details of a checkout order.

Endpoint Information

  • Method: GET
  • Path: /api/v1/merchants/{merchantId}/checkout/orders/{merchantOrderId}
  • Authentication: Required
  • Signature Note: GET requests have no body or query parameters. Algorithm: Base64(HMAC-SHA256(timestamp\nMETHOD\npath, apiSecret))

Path Parameters

ParameterTypeRequiredDescriptionExample
merchantIdStringYesMerchant IDMCH_20240101_ABC123
merchantOrderIdStringYesMerchant order IDORDER_2024010112345678

Request Example

bash
curl -X GET "https://api.paystablecoin.global/api/v1/merchants/MCH_20240101_ABC123/checkout/orders/ORDER_2024010112345678" \
  -H "X-Timestamp: 1640000000000" \
  -H "X-Signature: <calculated-signature>"

Signature string: 1640000000000\nGET\n/api/v1/merchants/MCH_20240101_ABC123/checkout/orders/ORDER_2024010112345678

Response Fields

FieldTypeDescriptionExample
codeStringResponse code. 00000 indicates success00000
messageStringResponse messageSuccess
data.orderIdStringPlatform order IDORD_20240101_1234567890ABCDEF
data.merchantIdStringMerchant IDMCH_20240101_ABC123
data.merchantOrderIdStringMerchant order IDORDER_2024010112345678
data.statusStringOrder status (see status table below)SUCCEEDED
data.orderAmountObjectOrder amount{"value": "100.50", "currency": "USDC"}
data.cryptoPaymentAmountObjectAmount the user was required to pay (including fees){"value": "101.00", "currency": "USDC"}
data.cryptoPaidAmountObjectActual amount paid by user (only present after payment succeeds){"value": "101.00", "currency": "USDC"}
data.depositAddressStringDeposit addressTYdRLmP9kN4oY3hZ8xT6wQ2vS5uW7aV1b
data.networkStringBlockchain network codetron
data.networkDisplayNameStringNetwork display nameTRON Network
data.cryptoPaymentDetailObjectOn-chain payment details (only present after payment succeeds)See below
data.cryptoPaymentDetail.networkStringBlockchain networktron
data.cryptoPaymentDetail.cryptoCurrencyStringCryptocurrencyUSDC
data.cryptoPaymentDetail.transactionHashStringTransaction hash0x1234567890abcdef...
data.cryptoPaymentDetail.fromAddressStringSender addressTXdQKjYz8f9vN3kYh2xL6mP8sR5wT7uV2a
data.cryptoPaymentDetail.toAddressStringRecipient addressTYdRLmP9kN4oY3hZ8xT6wQ2vS5uW7aV1b
data.cryptoPaymentDetail.amountStringTransaction amount101.00
data.cryptoPaymentDetail.confirmationsIntegerCurrent block confirmations21
data.cryptoPaymentDetail.requiredConfirmationsIntegerRequired confirmations for finality21
data.createdAtString (ISO 8601)Order creation time (UTC)2024-01-01T12:00:00Z
data.expiresAtString (ISO 8601)Order expiration time (UTC)2024-01-01T13:00:00Z
data.paidAtString (ISO 8601)Payment time (UTC, only present after payment succeeds)2024-01-01T12:15:30Z

Order Status Descriptions

StatusDescriptionIs Final?
INITOrder created, awaiting paymentNo
PROCESSINGPayment detected on-chain, confirmingNo
SUCCEEDEDPayment confirmed and completedYes
FAILEDPayment failed (insufficient amount, timeout, or error)Yes
CLOSEDOrder closed (expired or cancelled)Yes

Response Examples

Succeeded order:

json
{
  "code": "00000",
  "message": "Success",
  "data": {
    "orderId": "ORD_20240101_1234567890ABCDEF",
    "merchantId": "MCH_20240101_ABC123",
    "merchantOrderId": "ORDER_2024010112345678",
    "status": "SUCCEEDED",
    "orderAmount": {
      "value": "100.50",
      "currency": "USDC"
    },
    "cryptoPaymentAmount": {
      "value": "101.00",
      "currency": "USDC"
    },
    "cryptoPaidAmount": {
      "value": "101.00",
      "currency": "USDC"
    },
    "depositAddress": "TYdRLmP9kN4oY3hZ8xT6wQ2vS5uW7aV1b",
    "network": "tron",
    "networkDisplayName": "TRON Network",
    "cryptoPaymentDetail": {
      "network": "tron",
      "cryptoCurrency": "USDC",
      "transactionHash": "0x1234567890abcdef1234567890abcdef",
      "fromAddress": "TXdQKjYz8f9vN3kYh2xL6mP8sR5wT7uV2a",
      "toAddress": "TYdRLmP9kN4oY3hZ8xT6wQ2vS5uW7aV1b",
      "amount": "101.00",
      "confirmations": 21,
      "requiredConfirmations": 21
    },
    "createdAt": "2024-01-01T12:00:00Z",
    "expiresAt": "2024-01-01T13:00:00Z",
    "paidAt": "2024-01-01T12:15:30Z"
  }
}

Webhook Notifications

API Checkout webhook notifications are documented on the Webhook Notifications page.


Error Codes

Error CodeCode ValueDescriptionResolution
INVALID_PARAMETER10001Invalid request parameterCheck all request parameters against the spec
INVALID_AMOUNT10004Order amount must be greater than 0Provide a positive amount
INVALID_EXPIRES_AT10005Expiration time is in the pastSet expiresAt to a future time
INVALID_MERCHANT10007Merchant ID is invalidVerify your merchant ID
UNCONFIGURED_PAYMENT_METHOD10011Unsupported currency/network combination, or the merchant does not have this method configuredCall Get Payment Methods to confirm available combinations
ORDER_ALREADY_EXISTS20001merchantOrderId already existsUse a different order ID or check for duplicate submission
ORDER_NOT_FOUND40001Order not foundVerify the order ID
API_PERMISSION_DISABLED50010API Checkout is not enabled for this merchantContact technical support to activate API Checkout
SYSTEM_ERROR99999Internal system errorRetry after a short delay or contact support

Appendix: Supported Networks and Currencies

The following combinations are supported by the platform. The merchant's actual available methods depend on platform configuration — always call Get Payment Methods to confirm.

Currency / Network Combinations

CurrencyNetwork CodeNetwork Display Name
USD1ethEthereum(ERC20)
USD1bscBNB Smart Chain(BEP20)
USDCethEthereum(ERC20)
USDCpolygonPolygon
USDCoptimismOptimism
USDCarbitrumArbitrum One
USDCbscBNB Smart Chain(BEP20)
USDCbaseBase
USDCsolanaSolana
USDTbscBNB Smart Chain(BEP20)
USDTethEthereum(ERC20)
USDTpolygonPolygon
USDTarbitrumArbitrum One
USDToptimismOptimism
USDTsolanaSolana
USDTtronTron(TRC20)

Network Reference

Network CodeFull NameNotes
tronTronTRC20 standard. Fast and low-cost — recommended for USDT
ethEthereumERC20 standard. Higher fees, ~15 min confirmation
bscBNB Smart ChainBEP20 standard. Low fees
polygonPolygonEthereum sidechain (formerly Matic)
arbitrumArbitrum OneEthereum Layer 2
optimismOptimismEthereum Layer 2
baseBaseCoinbase Layer 2
solanaSolanaHigh-performance chain

Best Practices

  1. Call Get Payment Methods first: Before creating an order, always fetch available payment methods to avoid UNCONFIGURED_PAYMENT_METHOD errors and to populate your UI accurately.
  2. Idempotency: Use a stable, unique merchantOrderId per checkout attempt. If the user retries, reuse the same ID to avoid duplicate orders.
  3. Set a 30-minute expiry: Set expiresAt to 30 minutes from creation. Avoid very short or very long windows.
  4. Display cryptoPaymentAmount, not orderAmount: Users must send the cryptoPaymentAmount value. It may differ from orderAmount due to fees.
  5. Configure callbackUrl: Strongly recommended. Without it, you must poll to detect payment completion.
  6. Poll as a fallback: If no webhook is received, poll every 5–10 seconds using Query Checkout Order.
  7. Idempotent webhook handling: Use acquiringOrderId or merchantOrderId to deduplicate webhook notifications, as the same event may be delivered more than once.

Released under the MIT License.