accepts, and how PAYMENT-SIGNATURE turns the same API request into a paid request.
Preparation
You need to prepare:
When calling the Ace Data Cloud API with X402, an API Token is not required. The SDK’s first request does not include
Authorization, and the Gateway will return 402 Payment Required along with payment requirements; the SDK will automatically retry after signing.
Install SDK
Source code and package addresses:- SDK Repository: https://github.com/AceDataCloud/SDK
- X402 Client Repository: https://github.com/AceDataCloud/X402Client
- npm:
@acedatacloud/sdk,@acedatacloud/x402-client - PyPI:
acedatacloud,acedatacloud-x402
acedatacloud-x402.
Installation and import check output for a clean temporary environment:
- The npm packages and PyPI packages are real published packages, not placeholder names in the documentation.
acedatacloud-x402[cli]will install the CLI, and theapprove-permit2subcommand can be used for Permit2 authorization in theuptoscenario.
The First Request Will Return 402
You can first usecurl to see what an unpaid request returns. The following example will not incur a charge because it does not carry PAYMENT-SIGNATURE:
accepts array, with a common structure as follows:
PAYMENT-REQUIRED response header, allowing the client to read the payment requirements without parsing the body.
The output summary of the program for unpaid requests to the production API is as follows:
- The first request did not carry
AuthorizationorPAYMENT-SIGNATURE, so it returned HTTP 402 and did not incur a charge. acceptsis the only trusted signature basis for this request, containing optional networks, schemes, maximum amounts, payment addresses, and asset addresses.networkis the CAIP-2 identifier, and the client must match the network according to the CAIP-2 string.- The maximum amount for this minimal chat request of
gpt-4o-miniis95215atomic USDC, which is0.095215USDC. - Each request should read the 402 response of the current request and not hard-code the example amount into the business code.
Complete Payment Retry with SDK
Below is the minimal TypeScript example. It specifiesnetwork: 'skale', and the handler will select the SKALE payment requirement from this 402 response; the actual amount and payment address will still be based on accepts:
content ADC_TS_SDK_X402_OKis a fixed string returned by the model according to the prompt, indicating that the payment retry successfully entered the model API.payeris the local signed wallet address, and the private key was not sent to Ace Data Cloud.- The SDK completed the 402 parsing,
PAYMENT-SIGNATUREsigning, and original request retry; the business code is still written in the usual SDK call manner.
- The SDK sends a normal API request without
Authorization. - The Gateway returns
402 Payment Requiredandaccepts. createX402PaymentHandlerselects the payment requirement fornetwork = 'skale'and signs outPAYMENT-SIGNATURE.- The SDK retries with the same request body, and the Gateway calls the Facilitator for verification and settlement before allowing access to the target API.
View Facilitator Support Capabilities
The X402 API does not rely on a resource directory. The client directly calls known APIs and uses the402 Payment Required and accepts returned in real-time as the only basis for price and signature.
The capability declaration of the Facilitator is located at:
/supported, /verify, /settle, and the currently enabled payment networks, without listing API resources.
The production Facilitator address for Ace Data Cloud is:
kinds will list the networks and schemes supported by the Facilitator. Actual calls should still be based on the accepts returned by the API.
Facilitator /supported output:
/supportedindicates that the Facilitator has the verification and settlement capabilities for these networks and schemes.- Base, SKALE, and Solana all support
exact;uptois currently only available on Base. - Whether a specific API allows a certain network is still subject to the 402
acceptsof that API.

