🎫Create Invoice(API)
Basic Flow
Merchant creates an invoice
Pass the pay_url from the invoice response to the customer, who opens the payment page to complete payment.
After Xcash detects the transfer, it sends payment information to the merchant via Webhook callback.
POST https://api.xca.sh/v1/invoice
Function: Generate a pending invoice for the customer, returning the gateway unified invoice number
sys_no, payment page, and other information.Signature Required: Yes.
Request Body Fields
out_no
string
Yes
≤32 characters, unique within project
Merchant order number
title
string
Yes
≤32 characters
Customer-visible title
currency
string
Yes
Token or Fiat code, such as ETH/ USD / USDT
Invoice pricing currency
amount
decimal string
Yes
Greater than 0, max 32 digits including 8 decimal places
Amount in invoice pricing currency
duration
int
No
5~30 (minutes) default 10
Customer payment validity period
methods
object
No
{"USDT": ["ethereum-mainnet","tron-mainnet"]} structure
Limit customer payment method options; uses all available project methods when empty
redirect_url
string
No
Redirect URL after successful payment
Business Rules
If
currencyis fiat, the payable cryptocurrency amount is automatically calculated based on the exchange rate between cryptocurrency and fiat.If
currencyis cryptocurrency, only that currency is allowed for payment by default.Personal edition projects will return
TOO_MANY_WAITINGwhen pending invoices ≥ 100; please merge or close old orders.If any receiving address for
methodschains is missing, returnsNO_RECIPIENT_ADDRESS.
methodsFormat DescriptionRepresents the payment method combinations available to customers for the current invoice, using JSON object structure.
Key: Cryptocurrency code (such as
USDT,USDC), must be a system-supported currency.Value: List of chain codes corresponding to that currency (such as
tron-mainnet,ethereum-mainnet), chains must match actual available combinations with the currency. For details, refer to Parameter Codes.
示例:
Examples
Response Field Description
appid
sys_no
System invoice number
out_no
Merchant order number
title
Product title
currency
Pricing currency
amount
Pricing currency amount
methods
Supported payment methods
chain
Blockchain
crypto
Token
crypto_address
Token address
pay_address
Payment address
pay_amount
Payment amount
pay_url
Payment link
expires_at
Payment expiration time
redirect_url
Redirect URL
payment
Network transfer information
status
waiting: pending payment; confirming: awaiting network confirmation; completed: payment complete; expired: expired
Last updated