API Documentation
Comprehensive guide to integrating RexPayments into your application
Overview
Secure Payment Processing Made Simple
RexPayments provides three powerful APIs to handle all your payment needs. Choose the right endpoint for your use case and start accepting payments in minutes.
Generate Payments API
Create one-time payment links for individual transactions with automatic customer redirects.
Customers are redirected to complete payment and then back to your Success/Failure URL.
Payment Links API
Create shareable, reusable payment links with complete control over product details and payment limits.
Set expiration dates, payment limits, and manage link status programmatically.
Transaction Details API
Retrieve complete payment information using a payment ID for verification and reconciliation.
Access full transaction details including payment method, amount, currency, and status.
Step 1: Registration & API Key
To get started with RexPayments:
- Register at https://portal.rexpayments.com/
- Provide your Callback URL for post-payment redirects
- Log in to your Profile Page to obtain your API Key
- Include the API key in every request as a Bearer token
Authentication
All API requests require authentication using your API token. The token can be found in your merchant profile page.
Authentication Header (Recommended)
Authorization: Bearer rx_your_api_token_here
Query Parameter Alternative
?api_token=rx_your_api_token_here
Example Request
curl -X GET "https://portal.rexpayments.com/api/payment-links" \
-H "Authorization: Bearer rx_your_api_token_here" \
-H "Content-Type: application/json"
Generate Payment API
Instantly create a unique payment link for a specific transaction. Use this when you need to generate payment links programmatically during checkout. Customers are redirected to complete payment and then returned to your specified Success or Failure URL.
Endpoint
Headers
| Key | Value |
|---|---|
| Authorization | Bearer YOUR_API_KEY |
| Content-Type | application/json |
| Origin | https://yourdomain.com |
Request Parameters
| Field | Type | Status | Description |
|---|---|---|---|
| order_id | String | Required | Unique identifier for the order |
| amount | Decimal | Required | Payment amount to be charged (in currency units) |
Example Request
curl --location 'https://portal.rexpayments.com/api/generate-payment-link' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"order_id": "123456",
"amount": "500.00"
}'
Response
{
"paymentLink": "https://portal.rexpayments.com/pay-now?o=hbvt&a=g73u&us=hA%3D%3D"
}
Payment Links API
Create and manage reusable payment links with full control over product details, expiration dates, and payment limits. Perfect for shareable invoices, limited-time offers, and inventory-controlled sales. These links remain active until explicitly deactivated or expire.
List Payment Links
Retrieves all payment links you've createdReturns paginated results of all active and inactive payment links in your account
Create Payment Link
Create a new shareable payment linkOnce created, share the URL with customers. You can set expiration dates and payment limits to control when and how many times it can be used
| Field | Type | Status | Description |
|---|---|---|---|
| product_name | String | Required | Name of the product (max 255 chars) |
| amount | Decimal | Required | Payment amount (min 0.01) |
| description | String | Optional | Product description (max 1000 chars) |
| expires_days | Integer | Optional | Expiration period in days (1-365) |
| payment_limit | Integer | Optional | Max successful payments allowed (1-1000) |
curl -X POST "https://portal.rexpayments.com/api/payment-links" \
-H "Authorization: Bearer rx_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"product_name": "Premium Plan",
"amount": 99.99,
"description": "Monthly subscription",
"expires_days": 30,
"payment_limit": 10
}'
View Payment Link Details
Get information about a specific payment linkUse this to check the status, payment count, expiration date, and other details of a payment link
Update Payment Link
Modify a payment link's detailsYou can update the product name, description, and active status. Note: Amount, expires_days, and payment_limit cannot be changed after creation
curl -X PUT "https://portal.rexpayments.com/api/payment-links/1" \
-H "Authorization: Bearer rx_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"product_name": "Updated Product Name",
"description": "Updated description",
"active": false
}'
Delete Payment Link
Remove a payment link permanentlyOnce deleted, customers will not be able to access the link
Toggle Payment Link Status
Activate or deactivate a payment linkDeactivate a link to temporarily disable it without deleting it. Reactivate it anytime
Public Checkout
Customer-facing payment pageNo authentication required. Share this link with customers directly or embed in your application
Public checkout page. No authentication required.
Process Payment
Complete the payment transactionCalled by the checkout page after customer confirms payment. No authentication required
Payment Transaction Details
Retrieve complete details about a specific payment transaction using its Payment ID. Use this after customers complete payments to verify transaction status, amount, currency, payment method, and other details for reconciliation and order fulfillment.
Endpoint
Response Fields
| Field | Type | Description |
|---|---|---|
| id | String | Unique payment identifier |
| amount | Integer | Amount charged (in minor units) |
| currency | String | Currency code (e.g., usd) |
| status | String | Payment status (succeeded, failed, pending) |
| created | Integer | Timestamp in UNIX format |
| payment_method | String | ID of payment method used |
| livemode | Boolean | Indicates live or test mode |
Complete Workflow
Register at RexPayments portal and obtain your API key from the profile page.
Select the appropriate endpoint for your use case. Use Generate Payment API for one-time transactions or Payment Links API for shareable, reusable links.
Redirect your customer to the generated payment link to complete the transaction.
Customer is redirected to your callback URL with Order ID, Transaction ID, and Status.
Use the Transaction Details API to retrieve full details and update your order status accordingly.
Code Examples
JavaScript/Node.js
const axios = require("axios");
const apiToken = "rx_your_api_token_here";
const baseUrl = "https://portal.rexpayments.com/api";
// Create payment link
const createPaymentLink = async () => {
try {
const response = await axios.post(
`${baseUrl}/payment-links`,
{
product_name: "Premium Plan",
amount: 99.99,
description: "Monthly subscription",
expires_days: 30,
payment_limit: 10
},
{
headers: {
Authorization: `Bearer ${apiToken}`,
"Content-Type": "application/json"
}
}
);
console.log("Payment Link URL:", response.data.data.url);
return response.data;
} catch (error) {
console.error("Error:", error.response.data);
}
};
createPaymentLink();
Python
import requests
api_token = "rx_your_api_token_here"
base_url = "https://portal.rexpayments.com/api"
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
payload = {
"product_name": "Premium Plan",
"amount": 99.99,
"description": "Monthly subscription",
"expires_days": 30,
"payment_limit": 10
}
response = requests.post(
f"{base_url}/payment-links",
json=payload,
headers=headers
)
if response.status_code == 201:
payment_link = response.json()
print(f"Payment Link: {payment_link['data']['url']}")
else:
print(f"Error: {response.text}")