Skip to content

API Reference

garotm edited this page Nov 29, 2024 · 1 revision

API Reference

Overview

The fleXRP API provides a RESTful interface for integrating XRP payment processing into your applications. This reference documents all available endpoints, authentication methods, and example usage.

Authentication

All API requests require authentication using Bearer tokens:

Authorization: Bearer your-api-token

Base URL

https://api.flexrp.com/v1

Endpoints

Payment Operations

Create Payment Request

POST /payments/create

Request Body:

{
  "amount": "100.00",
  "currency": "XRP",
  "description": "Payment for Order #1234",
  "callback_url": "https://your-callback-url.com/webhook"
}

Response:

{
  "payment_id": "pay_123456789",
  "xrp_address": "rN9...",
  "amount": "100.00",
  "status": "pending",
  "expires_at": "2024-03-19T15:00:00Z"
}

Get Payment Status

GET /payments/{payment_id}

Response:

{
  "payment_id": "pay_123456789",
  "status": "completed",
  "transaction_hash": "ABC123...",
  "completed_at": "2024-03-19T14:30:00Z"
}

Wallet Management

Get Wallet Balance

GET /wallet/balance

Response:

{
  "balance": "1000.00",
  "currency": "XRP",
  "last_updated": "2024-03-19T14:00:00Z"
}

Transaction History

List Transactions

GET /transactions

Query Parameters:

  • limit (optional): Number of transactions to return (default: 20)
  • offset (optional): Pagination offset (default: 0)
  • status (optional): Filter by status (completed, pending, failed)

Response:

{
  "transactions": [
    {
      "id": "tx_123",
      "amount": "100.00",
      "status": "completed",
      "created_at": "2024-03-19T12:00:00Z"
    }
  ],
  "total": 50,
  "has_more": true
}

Rate Limits

  • 1000 requests per hour per API key
  • Rate limit headers included in responses:
    • X-RateLimit-Limit
    • X-RateLimit-Remaining
    • X-RateLimit-Reset

Error Handling

Error Codes

  • 400: Bad Request
  • 401: Unauthorized
  • 403: Forbidden
  • 404: Not Found
  • 429: Too Many Requests
  • 500: Internal Server Error

Error Response Format

{
  "error": {
    "code": "invalid_request",
    "message": "Detailed error message",
    "request_id": "req_123456"
  }
}

Webhooks

Webhook Events

  • payment.created
  • payment.completed
  • payment.failed
  • wallet.low_balance

Webhook Payload Example

{
  "event": "payment.completed",
  "data": {
    "payment_id": "pay_123456789",
    "amount": "100.00",
    "status": "completed",
    "transaction_hash": "ABC123..."
  }
}

SDK Support

Testing

  • Sandbox environment: https://sandbox-api.flexrp.com/v1
  • Test API keys available in dashboard
  • Test XRP addresses and transactions provided

Support


This documentation is maintained by the fleXRP team.