PAYMENT-SIGNATURE, then retries with the same request.
The difference is that order payment is a platform API and requires an account token; while directly calling the AI API at x402.acedata.cloud can use only X402 and does not require an API Token.
Prepare an Order
Go to the Ace Data Cloud Console, select the order that needs to be paid, and record the order ID. If you do not have an order yet, you can create a pending-payment order on the package page. The order price is subject to what is displayed on the page, and theamount in the X402 402 response is the final basis for signing.
Create an Account Token
Order payment requests require an account token. Open the Platform Token page and create a token in theplatform-v1-... format.
Use the following for subsequent requests:
Trigger 402
First send a request withoutPAYMENT-SIGNATURE:
accepts:
x402Version is 2, network uses the CAIP-2 identifier, and the amount field is amount.
Program output from creating a 10 Credits order and triggering 402:
The following transaction records are historical tested samples under the old policy. The amounts and transaction hashes are retained as-is. New X402 orders no longer have payment-method discounts; please use the amount in this 402 response as the basis for signing and payment.
- The status after the order is created successfully is
Pending; there is no on-chain payment yet at this time. - The first
pay/request does not carryPAYMENT-SIGNATURE, so it returns HTTP 402. acceptsprovides both Baseexactand Solanaexact; this tutorial selects Base for the following steps.- The price when the order was created was
1.26. When payment was made during the old X402 payment discount policy, the actual signed and settled amount was1.2USDC, corresponding to1200000atomic USDC.
resource here is a field returned by the server and participates in signing. The client must not rewrite the protocol, path, or order ID in it by itself.
Sign and Retry
Order payment can reuse the low-level signing functions of@acedatacloud/x402-client or acedatacloud-x402. The following is a TypeScript example:
exact:
status 200indicates that the platform order payment API accepted thisPAYMENT-SIGNATURE.has_x_payment_response Trueindicates that the response header contains a Base64-encodedPAYMENT-RESPONSEreceipt.settle_header.success=Trueandnetwork=baseindicate that the Facilitator has completed Base settlement.- The final order status is
Finished,pay_wayisX402, andpay_idis written with the on-chain transaction hash. - The
Transferevent on BaseScan shows that the payment address transferred1200000atomic USDC to the platform receiving address, which is1.2USDC.
Successful Response and Receipt
After the order payment succeeds, the response body contains order information. The platform will also include a Base64-encoded settlement response in the response headerPAYMENT-RESPONSE. After decoding, common fields include:
If reconciliation is required, it is recommended to save the order ID, payer wallet address,
transaction, and final order status at the same time.
Notes
- Order payment requires a platform account token and cannot be completed using only an X402 wallet signature.
amountuses USDC atomic units;1200000represents1.2USDC.- Do not construct the receiving address or asset address yourself; use the
acceptsin the 402 response as the source of truth. - If the same
PAYMENT-SIGNATUREis submitted repeatedly, the Facilitator performs replay protection based on the nonce.
Payment Failure Response
The first HTTP 402 withoutPAYMENT-SIGNATURE is a normal payment challenge and does not indicate payment failure. Verification or settlement failure after signing still retains the standard string error as a compatibility fallback, and returns a stable error structure in extensions.acedatacloud.paymentError:
code; unknown codes should fall back to a general payment failure. charged is a tri-state field: false is returned only when the payment is explicitly rejected before settlement; if the field is missing, the charge status is unknown and cannot be interpreted as “not charged.” After the current order enters Failed, it cannot be retried using the original order; please create a new order after resolving the wallet issue.
Do not record or submit the complete PAYMENT-SIGNATURE, wallet signature, authorization payload, Facilitator raw diagnostics, or RPC response. Customer support troubleshooting only requires the order ID and the public error code.

