Accept XRP & RLUSD Payments
A payment on the XRP Ledger is final 3–5 seconds after it is sent, costs the sender about $0.00002 and cannot be charged back. There are two ways to take one: through a gateway, or straight to an address of your own.
Through a gateway
A gateway gives you a checkout and invoices, and can pay you out in your own currency. Two that list XRP, at their published fees:
| Gateway | Fee, as published | XRP | RLUSD |
|---|---|---|---|
| CoinGate | 1% per payment | Yes | Not listed |
| NOWPayments | 1% service fee | Yes | Not listed |
Straight to your own address
Destination tag required, so a payment without one is refused by the ledger before it arrives.
- One address, one tag per order. Show the customer your address and the order’s destination tag (any number up to 4,294,967,295).
- Require a tag. An AccountSet with
asfRequireDestmakes the ledger refuse any payment to you without one, so no money arrives unassigned (xrpl.org). - Watch the address and count only validated, successful payments, by the amount that arrived.
import { Client, dropsToXrp } from 'xrpl'
const MY_ADDRESS = 'r...' // your receiving address
const client = new Client('wss://xrplcluster.com')
await client.connect()
await client.request({ command: 'subscribe', accounts: [MY_ADDRESS] })
client.on('transaction', (ev) => {
const tx = ev.tx_json ?? ev.transaction
if (!ev.validated || tx.TransactionType !== 'Payment' || tx.Destination !== MY_ADDRESS) return
if (ev.meta.TransactionResult !== 'tesSUCCESS') return
const got = ev.meta.delivered_amount // what arrived, never tx.Amount
const paid = typeof got === 'string' ? `${dropsToXrp(got)} XRP` : `${got.value} ${got.currency}`
console.log('order', tx.DestinationTag, 'paid', paid)
})Never trust the Amount field. A sender can mark a payment as partial, and then Amount is only the most it may deliver: a payment showing 1,000 XRP can bring in a fraction of that. delivered_amount is what actually arrived (xrpl.org: partial payments).
Taking RLUSD instead
RLUSD keeps your takings in dollars. Your address needs a trust line to its issuer, rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De, which holds 0.2 XRP of reserve; tokens with the same name from any other issuer are not RLUSD. Its issuer has clawback switched on and has not given up freezing, as regulated stablecoins usually do, so it can freeze or take back RLUSD held on a line (RLUSD guide).
After the payment
- Refunds are a new payment from you: nothing on the ledger can pull money back.
- Converting received tokens to XRP or RLUSD is a swap; the swap API quotes it first.
- Records: every payment to your address, with its hash, from the xrpl.to API.
- Keys: the receiving address needs no key online to receive. Keep its seed offline and send refunds from a separate wallet.
Questions
- How do I accept XRP payments on my website?
- Through a payment gateway that supports XRP, such as CoinGate or NOWPayments (1% each, as published), or directly: give each order its own destination tag on one address and watch that address for validated payments.
- Can an XRP payment be reversed?
- No. Once a payment is in a validated ledger it is final, so there are no chargebacks; a refund is a new payment you send yourself.
- How do I know how much a customer actually paid?
- Read delivered_amount in the transaction’s metadata. The Amount field can be larger than what arrived when the sender used a partial payment.