XRP Scheme
The XRP scheme uses native XRP on the XRP Ledger (XRPL) with signed XRPL Payment transactions. Unlike EVM and Credits which use EIP-712 signatures, XRP payments require the user to manually sign an XRPL transaction.
Network Parameters
| Parameter | Value |
|---|---|
| Network | xrpl-mainnet |
| Currency | XRP |
| Asset | XRP |
| Amount unit | drops (1000000 = 1.0 XRP) |
| RPC endpoint | https://s1.ripple.com:51234 |
| Ripple epoch offset | 946684800 seconds (2000-01-01T00:00:00Z) |
WARNING
XRP is only supported for x402 V1 (per-transaction approval). V3 mandate-based payments are not available for XRP. The user must manually sign the XRPL Payment transaction — auto-signing is not supported.
402 Response
{
"x402Version": 1,
"accepts": [
{
"scheme": "exact",
"network": "xrpl-mainnet",
"maxAmountRequired": "1000000",
"resource": "/api/endpoint",
"description": "XRP payment required",
"payTo": "rRecipientAddress",
"maxTimeoutSeconds": 60,
"asset": "XRP",
"extra": {
"name": "XRP",
"version": "1"
}
}
]
}X-Payment Payload
{
"x402Version": 1,
"scheme": "exact",
"network": "xrpl-mainnet",
"payload": {
"txHash": "ABC123...",
"signedTransaction": "1200002200000000...",
"account": "rSourceAddress",
"destination": "rDestinationAddress",
"amount": "1000000",
"currency": "XRP"
}
}Payload Fields
| Field | Type | Description |
|---|---|---|
txHash | string | XRPL transaction hash (computed via xrpl.hashes.hashSignedTx) |
signedTransaction | string | Hex-encoded signed XRPL Payment transaction blob |
account | string | Sender's XRP classic address |
destination | string | Recipient's XRP classic address (must match payTo) |
amount | string | Amount in drops (positive integer string) |
currency | string | Always XRP |
Payment Flow
1. Construct XRPL Payment Transaction
The payer constructs a standard XRPL Payment transaction with:
TransactionType:PaymentAccount: payer's XRP classic addressDestination: recipient's XRP classic address (frompayToin the 402 response)Amount: payment amount in drops (frommaxAmountRequired)
2. Sign Transaction
The payer signs the transaction using their XRPL wallet, producing a hex-encoded signed transaction blob (signedTransaction).
3. Compute Transaction Hash
The transaction hash is derived from the signed blob:
const txHash = xrpl.hashes.hashSignedTx(signedTransaction);4. Build X-Payment
The signed transaction and metadata are assembled into the X-Payment payload and base64-encoded as the X-Payment header.
5. Verification
The XRP Facilitator verifies the payment:
- Decodes the signed blob via
xrpl.decode()and extracts transaction fields - Validates the cryptographic signature via
xrpl.verifySignature() - Confirms
DestinationmatchespayTo,Amountmatches required drops, currency isXRP - Cross-checks against the stored payment record
6. Settlement
The facilitator submits the signed transaction to XRPL via RPC:
callRippleRpc('submit', { tx_blob: signedTransaction, fail_hard: false });tesSUCCESS/ter*→ transaction acceptedtefMAX_LEDGER→ transaction expired- Finality is confirmed asynchronously on-chain
Key Differences from EVM/Credits
| Aspect | EVM / Credits | XRP |
|---|---|---|
| Signing | EIP-712 typed data, auto-signed by wallet API | Native XRPL signing, manual by user |
| Settlement | Immediate (Credits) or deferred (EVM) | Async — submit then chain parser confirms |
| Status flow | signed → used | signed → pending → used |
| Mandate support | V1 and V3 | V1 only |
| Expired tx handling | Validity window | tefMAX_LEDGER expires record |
| Facilitator | Credits: internal / EVM: external | Internal (multi-asset facilitator) |
Related
- XRP Facilitator — full verify/settle endpoint details and error codes
- EVM Scheme — USDC on Base alternative
- Credits Scheme — off-chain credits alternative
- Payment Flow — end-to-end flow diagram
