On this pageEndpointRequest BodyExample RequestExample ResponseResponse FieldsError Codes

Create Order ​

Create a new payment order. This endpoint uses header-based HMAC signing.

Endpoint ​

POST /v4.0.0/pay/orders/api

Request Body ​

FieldTypeRequiredDescription
accessKeyIdstringYesYour merchant Access Key ID
merchantOrderIdstringYesYour unique order identifier (max 64 chars)
chainCodestringYesToken standard code (e.g., erc20, trc20, bep20, polygon-erc20)
coinCodestringYesToken code (e.g., usdt, usdc)
amountstringYesPayment amount as a decimal string (e.g., "10.50")
splitterAddressstringYesYour split wallet contract address
subjectstringNoOrder subject / description (max 256 chars)
expireDurationintegerNoExpiration time in seconds (default: 3600)
callbackURLstringNoFrontend redirect URL after payment (see Notifications)
notifyURLstringNoBackend webhook URL for order state updates
metadatastringNoArbitrary metadata string (max 1024 chars, returned in notifications)

WARNING

callbackURL is the frontend redirect URL shown to the customer after payment. For backend notifications, use notifyURL. See Notify URL vs Callback URL for details.

Example Request ​

json
{
  "accessKeyId": "ak_test_abc123",
  "merchantOrderId": "ORDER-20260621-001",
  "chainCode": "erc20",
  "coinCode": "usdt",
  "amount": "10.50",
  "splitterAddress": "0x1234567890abcdef1234567890abcdef12345678",
  "subject": "Premium Subscription - 1 Month",
  "expireDuration": 3600,
  "callbackURL": "https://yoursite.com/payment-result",
  "notifyURL": "https://yoursite.com/api/notify"
}

Example Response ​

json
{
  "code": 0,
  "msg": "success",
  "data": {
    "payOrderId": "PO202606210001",
    "merchantOrderId": "ORDER-20260621-001",
    "receiptAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
    "chainCode": "erc20",
    "coinCode": "usdt",
    "amount": "10.50",
    "state": 0,
    "expireTime": "2026-06-21T11:00:00Z"
  }
}

Response Fields ​

FieldTypeDescription
codeinteger0 for success, non-zero for error
msgstringHuman-readable message
data.payOrderIdstringHashNut-generated order ID
data.merchantOrderIdstringYour original order ID
data.receiptAddressstringBlockchain address for the customer to pay to
data.chainCodestringToken standard code
data.coinCodestringToken code
data.amountstringPayment amount
data.stateintegerOrder state (0 = INIT). See Order States
data.expireTimestringISO 8601 expiration timestamp

TIP

Store both payOrderId and merchantOrderId on your side. Use merchantOrderId to correlate HashNut orders with your internal records.

Error Codes ​

CodeDescription
0Success
1001Invalid parameters
1002Authentication failed
1003Duplicate merchantOrderId
1004No available receipt address
1005Unsupported chain or coin