Overview
The XRP Payment Gateway API allows you to accept XRP payments directly on the XRP Ledger. Our API provides a simple, secure way to create payment requests, monitor transactions, and receive real-time notifications.
โจ Key Features
- Create payment requests with XRP amounts
- Real-time payment status updates
- Webhook notifications for your backend
- QR code generation for mobile payments
- Transaction monitoring and analytics
Base URL
https://your-domain.com/api
Authentication
All API requests require authentication using your API key. Include your API key in the Authorization header as a Bearer token.
Example
curl -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ https://your-domain.com/api/business/payments
๐ Security Note
Keep your API key secure and never expose it in client-side code. All API calls should be made from your backend server.
Quick Start
1. Create a Payment Request
POST /api/business/payments Content-Type: application/json Authorization: Bearer YOUR_API_KEY { "amountXrp": 10, "amountUsd": 5, "destinationAddress": "rYourXRPAddress...", "destinationTag": 12345, "description": "Product purchase", "expiresIn": 24 }
2. Monitor Payment Status
GET /api/business/payments Authorization: Bearer YOUR_API_KEY Response: { "payments": [ { "id": 1, "amountXrp": 10, "status": "pending", "createdAt": "2024-01-01T12:00:00Z", "expiresAt": "2024-01-02T12:00:00Z" } ] }
3. Handle Webhooks
Configure a webhook URL to receive real-time payment notifications:
POST https://your-website.com/webhooks/xrp Content-Type: application/json { "event": "payment.completed", "paymentId": 1, "transactionHash": "ABC123...", "amountXrp": 10, "timestamp": "2024-01-01T12:30:00Z" }
Payments API
Create Payment Request
POST /api/business/payments
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amountXrp | number | Yes | Amount to request in XRP |
destinationAddress | string | Yes | Your XRP wallet address |
amountUsd | number | No | USD equivalent for display |
destinationTag | number | No | Destination tag for routing |
description | string | No | Payment description |
expiresIn | number | No | Expiration time in hours |
List Payment Requests
GET /api/business/payments
Query Parameters
limit
(optional) - Number of payments to return (default: 20)
JavaScript Example
// Create a payment request async function createPayment() { const response = await fetch('/api/business/payments', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ amountXrp: 10, amountUsd: 5, destinationAddress: 'rYourXRPAddress...', destinationTag: 12345, description: 'Product purchase', expiresIn: 24 }) }); const payment = await response.json(); console.log('Payment created:', payment); // Monitor payment status const checkStatus = setInterval(async () => { const statusResponse = await fetch('/api/business/payments', { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); const { payments } = await statusResponse.json(); const ourPayment = payments.find(p => p.id === payment.id); if (ourPayment.status === 'paid') { console.log('Payment completed!'); clearInterval(checkStatus); } }, 5000); }
๐งช Test Sandbox
Try out the API directly from this page. Enter your API key and test creating a payment request.
Response:
Click "Create Test Payment" to see the API response here...