GET and POST /v1/invoices/{id}/x402/solana
Asset: USDC on Solana (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)
Network (CAIP-2): solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
1. Discovery
402 with the PAYMENT-REQUIRED header (base64-encoded JSON):
Key fields
| Field | Description |
|---|---|
amount | USDC minor units (6 decimals). "5000000" = $5.00. |
asset | USDC mint address on Solana. |
payTo | Merchant’s Solana receive address. |
maxTimeoutSeconds | Time remaining before the settlement challenge expires. |
extra.settlementId | Required in the PAYMENT-SIGNATURE. Also used for recovery. |
extra.feePayer | Gwop-provided fee payer address. If present, include as the fee payer in your transaction so the paying agent doesn’t need SOL for gas. |
2. Payment signature
The client constructs a Solana transaction that transfers the specifiedamount of USDC from the payer to payTo. If extra.feePayer is provided, set it as the transaction’s fee payer.
Two proof modes are supported:
Option A: Submit tx_hash (recommended)
Sign and submit the transaction to the Solana network, then pass the transaction signature:
Option B: Submit serialized transaction
Submit the signed but unsubmitted transaction for the facilitator to broadcast:PAYMENT-SIGNATURE header:
Required payload fields
| Field | Type | Description |
|---|---|---|
payload.tx_hash | string | Solana transaction signature (if already submitted). |
payload.transaction | string | Base64-encoded serialized transaction (if not yet submitted). |
accepted.extra.settlementId | string | The settlementId from discovery. |
accepted.extra.feePayer | string | Fee payer address (if using Gwop fee payer). |
tx_hash or transaction, not both.
3. Settlement response
On success, the server returns HTTP200 with the PAYMENT-RESPONSE header (base64-encoded JSON):
paid_at, paid_tx_hash, payer_address, paid_amount, and tx_url (Solscan link).
Fee payer
Whenextra.feePayer is present in the PAYMENT-REQUIRED response, Gwop provides a fee payer for the transaction. This means the paying agent does not need to hold SOL for gas fees.
To use the fee payer:
- Set the
feePayerfield in your transaction to the address fromextra.feePayer - Sign the transaction with the payer’s keypair (partial sign — do not sign as fee payer)
- Submit the serialized transaction in
payload.transaction
extra.feePayer, submit the transaction yourself, and pass the tx_hash in Option A.
Error diagnostics
Settlement errors returnx402_diagnostics with a reason field:
| Reason | Meaning |
|---|---|
solana_transaction_invalid | Serialized transaction is malformed or invalid. |
solana_proof_mode_unsupported | Proof mode not recognized. |
resource_mismatch | resource.url doesn’t match the endpoint. |
chain_mismatch | Network in signature doesn’t match /x402/solana. |
verification_failed | On-chain verification failed (wrong amount, asset, or recipient). |
payment_signature_replayed | This transaction signature was already used. |
settlement_failed | Facilitator could not settle the transaction. |
