Documentation Index
Fetch the complete documentation index at: https://docs.coinvoyage.io/llms.txt
Use this file to discover all available pages before exploring further.
@coin-voyage/paykit-headless is a Preview package that provides server and agent runtime helpers for CoinVoyage x402 payments. Use it when your application needs to fetch a protected resource, handle an x402 PAYMENT-REQUIRED challenge, sign the selected payment requirement, and retry the request without showing the PayKit browser modal.
The headless package is separate from
@coin-voyage/paykit. Install it only for agent, server, or automation flows that need x402 payment signing.Installation
Exports
x402/agent or x402/sui.
Agent payment flow
UseexecuteX402AgentPayment() when an agent should fetch a PAYMENT-REQUIRED challenge, create a PAYMENT-SIGNATURE, and retry the protected resource.
Supported key types
chainType | Expected key |
|---|---|
EVM | EVM private key for eip155:* payment requirements |
SOL | Solana private key for solana:* payment requirements |
SUI | Sui Ed25519 private key for sui:* payment requirements |
accepts[] entries by chainType, then by network, asset, paymentIdentifier, and maxAmount when those fields are provided.
Payment requirement preferences
X402RequirementRequest is optional. If you send preference fields, include both preferred_chain_type and preferred_token_address.
preferred_chain_type. If you do not need a tailored token response, omit all preference fields and choose from the returned accepts[].
Existing PAYMENT-REQUIRED header
If you already fetched the challenge, pass the header directly: The examples below assumepaymentRequiredHeader, coinType, and privateKey are already defined.
Sui payment signatures
Sui x402 support uses a CoinVoyage-specific payload carried in the standard base64PAYMENT-SIGNATURE header. The SDK:
- Selects the returned
sui:mainnetaccepts[]entry without changingscheme,network,asset,amount,payTo, orpaymentIdentifier. - Builds a Sui programmable transaction block when the backend does not provide transaction bytes.
- Transfers the exact raw
amountof the exact Sui coin type topayTo. - Signs the transaction with the configured Sui Ed25519 key.
- Encodes the signed transaction bytes, signature, payer address, selected accept, and CoinVoyage Sui payload fields into
PAYMENT-SIGNATURE.
accept.transactionBytes, accept.txBytes, accept.extra.sui.transactionBytes, or accept.extra.sui.txBytes, the SDK signs those bytes instead of constructing a transfer transaction.
Current limits
- Native ETH and native SOL accepts are not supported by the headless agent. Use token accepts such as USDC.
- Sui accepts require this SDK or another client that implements CoinVoyage’s Sui
PAYMENT-SIGNATUREpayload. maxAmountis compared against the raw token amount, not display units.