- x402 Overview Document: https://docs.cdp.coinbase.com/x402/docs/overview
- x402 Open Source Example: https://github.com/coinbase/x402
- Payment is completed on the Base mainnet, using USDC as the asset;
- The
X-PAYMENTsignature header must be generated using the EVM private key of the wallet holding the assets; - All APIs are located under the domain
https://platform.acedata.cloud, and theAuthorizationheader must carry the Platform Token.
I. Preparation
1. View Orders and Record Payment Information
Log in to the console at https://platform.acedata.cloud, where you can see the orders that need to be paid in the order list or order details page. The order details will display:- Order ID (e.g.,
7744945e-5e77-4dcc-a9c4-528692d17b34); - Payment address
pay_to(also returned in the 402 response, it is recommended to rely on the page information).
pay_to address, as it is necessary to ensure that funds are sent to this address during signing.
2. Prepare Payment Wallet and Funds
- Prepare an EVM wallet that supports the Base mainnet and export the private key to be used;
- Recharge sufficient USDC on the Base mainnet (the payment amount is in the smallest unit with 6 decimal places);
- The x402 Facilitator will cover the network fees, and the payment wallet only needs to retain enough USDC;
- The private key is only used for local signing, please keep it safe and avoid exposing it in browsers or untrusted environments.
3. Create Platform Token
The Platform Token is used to call the platform API, similar to the user Token used in the browser after logging in, but it does not expire. Please follow these steps to create it:- Open the console page https://platform.acedata.cloud/console/platform-tokens;
- Click “Create Token,” fill in the remarks as prompted, and generate it;
- Copy the generated Token (e.g.,
platform-v1-xxxx) and keep it safe asplatform_token.
All subsequent API call headers need to include:
4. Request Basic Information
- API base domain:
https://platform.acedata.cloud - Payment request path:
/api/v1/orders/{order_id}/pay/ - Both requests and responses use JSON, encoded in UTF-8.
II. Overview of the Payment Process
- Initiate Payment Request: The first
POSTrequest without theX-PAYMENTheader triggers the platform to return a 402 Payment Required; - Read Payment Requirements: Parse the
acceptsarray in the 402 response, confirming thatnetworkisbase,assetis USDC, andpayTomatches the order page; - Generate
X-PAYMENT: Use the payment wallet private key, the requirements from the response body, and the EIP-712 domain returned by the Facilitator to generate a signature (usually completed with the official SDK); - Retry with Signature: Add the
X-PAYMENTheader to the same path request, and after successful verification by the platform, it returns 200; - Parse Results: Read the response header
X-PAYMENT-RESPONSE, which provides the on-chain transaction hash, actual deducted amount, and other information for reconciliation.
III. Integration Examples
1. First Request (Trigger 402)
network: Must bebase(Base mainnet);asset: Base USDC contract address (the example is the official mainnet contract);maxAmountRequired: The USDC atomic unit required for this payment (1 USDC = 1,000,000 atomic units);payTo: The platform’s payment address, which should match the order details page;extra: EIP-712 domain information required for signing, etc.
2. Generate X-PAYMENT
A common practice is to use the official SDK (such as x402-js, x402-fetch, x402.clients, etc.):
- Convert the payment wallet private key into an account object;
- Record the
acceptsdata from the 402 response, selecting the payment option wherenetwork == "base"; - Call the signing function provided by the SDK to generate a Base64 encoded
X-PAYMENTstring (no need for the client to directly connect to the facilitator; the platform backend will handle the verify/settle calls); - It is recommended to check whether
maxAmountRequiredis within an acceptable range; if exceeded, remind the user to recharge.
extra.eip712 before signing.
3. Retry with Signature
X-PAYMENT-RESPONSE can be decoded using the SDK’s decoding function to obtain the on-chain transaction hash, payment network, payer address, and other data for business accounting or display.
IV. Multi-language Example Code
The following examples assume injection through environment variables or configuration files:ACE_PLATFORM_TOKEN: Platform Token;ACE_X402_ORDER_ID: Order ID;ACE_X402_PRIVATE_KEY: Payment wallet private key (with0xprefix).
1. Axios (TypeScript)
2. Fetch (JavaScript)
3. Python requests
4. Python httpx (Asynchronous)
The examples only demonstrate key calls; please add exception handling, retry strategies, logging, and security controls in a production environment.
5. Verification after Successful Payment
- Console Verification: Visit the order details page
https://platform.acedata.cloud/console/orders/{order_id}, if the page shows “Payment Successful” or the order status has changed to Paid/Completed, it indicates that the on-chain settlement is complete. - API Verification: Call
GET https://platform.acedata.cloud/api/v1/orders/{order_id}/withAuthorization: Bearer {platform_token}, check thestatefield in the response (PAIDorFINISHEDindicates payment success). - Return Header: Read
X-PAYMENT-RESPONSEfrom the successful payment response, which can be parsed to obtain the on-chain transaction hash as the final proof; it is recommended to save this information in the system logs for reconciliation.
6. Common Issue Troubleshooting
- Still returns 402: Confirm that the payment address has sufficient USDC on the Base mainnet, check if
maxAmountRequiredexceeds the wallet balance or custom limits. - Signature failure: Ensure the private key has the
0xprefix; strictly use theextra(EIP-712 domain) andpayTofrom the response when signing, do not change the field order. - Network mismatch: There may be multiple requirements in
accepts, please select the option wherenetwork === "base". - Missing
X-PAYMENT-RESPONSE: Indicates that the payment was not actually deducted, you can re-initiate based on the error in the response body; if there is congestion on the chain, please try again later. - Invalid platform token: Confirm that the token has not been deleted and starts with the prefix
platform-v1-; if the interface returns 401, you can regenerate it in the console.
7. More Help
- Online documentation and FAQs: “Documentation” in the top navigation of the platform console.
- Submit tickets and customer support: https://platform.acedata.cloud/support
- Community communication: Discord https://discord.gg/f9GRuKCmRc, X (Twitter) https://x.com/acedatacloud
- Other channels: Email
office@acedata.cloud,office@germey.tech; company address 651 N Broad St, Suite 201, Middletown, Delaware, USA; for WeChat customer service, please check the latest QR code on the support page. - Feedback and suggestions: We welcome you to let us know your improvement needs through any of the above channels.

