Complete guide for integrating ReyPub payment system into your application
ReyPub is a modern wallet and internal debit card payment system. Businesses can accept payments from ReyPub users through two methods:
Send a payment request to a user by their account number. The user approves or rejects within a 5-minute window. Ideal for online checkouts.
Process an instant card payment using the user's card details (number, CVV, expiry). No email or account ID needed. Balance verified automatically.
https://reypub.pages.dev/api
All API endpoints are relative to this base URL.
All payment API calls require your business API keys sent as request headers:
| Header | Description |
|---|---|
| X-ReyPub-Key | Your public API key (starts with rpub_pk_) |
| X-ReyPub-Secret | Your secret API key (starts with rpub_sk_) |
| Content-Type | application/json |
curl -X POST https://reypub.pages.dev/api/payment/card \
-H "Content-Type: application/json" \
-H "X-ReyPub-Key: rpub_pk_your_public_key" \
-H "X-ReyPub-Secret: rpub_sk_your_secret_key" \
-d '{
"card_number": "4532XXXXXXXXXXXX",
"cvv": "123",
"expiry_month": 12,
"expiry_year": 2028,
"amount": 29.99,
"order_id": "ORD-001",
"description": "Premium Plan"
}'
const response = await fetch('https://reypub.pages.dev/api/payment/wallet', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-ReyPub-Key': 'rpub_pk_your_public_key',
'X-ReyPub-Secret': 'rpub_sk_your_secret_key'
},
body: JSON.stringify({
user_account_id: '2045678901', // User's account number
amount: 49.99,
order_id: 'ORD-002',
description: 'Monthly subscription'
})
});
const data = await response.json();
console.log(data.data.transaction_id); // "pay_xxxx_xxxx"
Request payment from a user's wallet. The user receives a notification and has 5 minutes to approve or reject.
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_account_id | string | Required | User's account number (10 digits) |
| amount | number | Required | Payment amount (0.01 - 1,000,000) |
| order_id | string | Required | Your order/invoice reference ID |
| description | string | Optional | Payment description shown to user |
| currency | string | Optional | Currency code (default: "USD") |
| callback_url | string | Optional | Webhook URL for payment updates |
{
"success": true,
"data": {
"transaction_id": "pay_m4x3k_a1b2c3d4",
"status": "pending",
"expires_at": "2026-03-19T12:05:00.000Z",
"message": "Payment request sent to user. Awaiting approval (5 minute window)."
},
"message": "Payment request created"
}
Process an instant payment using the user's ReyPub debit card. No email or account ID needed - just the card details. Balance is verified first, then deducted.
| Parameter | Type | Required | Description |
|---|---|---|---|
| card_number | string | Required | 16-digit card number |
| cvv | string | Required | 3-digit CVV code |
| expiry_month | number | Required | Expiry month (1-12) |
| expiry_year | number | Required | Expiry year (e.g., 2028) |
| amount | number | Required | Payment amount |
| order_id | string | Required | Your order reference ID |
| description | string | Optional | Payment description |
| currency | string | Optional | Currency code (default: "USD") |
{
"success": true,
"data": {
"transaction_id": "cpay_m4x3k_a1b2c3d4",
"status": "completed",
"amount": 29.99,
"fee": 0.75,
"net_amount": 29.24,
"currency": "USD",
"order_id": "ORD-001",
"card_last_four": "4521"
},
"message": "Card payment processed successfully"
}
| Status | Description |
|---|---|
| pending | Wallet payment awaiting user approval |
| completed | Payment successfully processed |
| rejected | User rejected the wallet payment |
| expired | Wallet payment request expired (5 min timeout) |
| failed | Payment processing failed |
| Parameter | Type | Required | Description |
|---|---|---|---|
| transaction_id | string | Required | Original transaction ID |
| amount | number | Optional | Partial refund amount (defaults to full) |
| reason | string | Optional | Reason for refund |
curl -X POST https://reypub.pages.dev/api/payment/refund \
-H "Content-Type: application/json" \
-H "X-ReyPub-Key: rpub_pk_your_key" \
-H "X-ReyPub-Secret: rpub_sk_your_secret" \
-d '{
"transaction_id": "cpay_m4x3k_a1b2c3d4",
"amount": 10.00,
"reason": "Customer request"
}'
Every ReyPub user has a unique 10-digit account number assigned at registration. This is used for:
Every ReyPub debit card is protected by a 6-digit PIN. Users must set a PIN after card issuance and enter it to view their card details in the dashboard.
Set your webhook URL in the Business Portal settings. ReyPub will send POST requests for payment events.
| Event | Description |
|---|---|
| payment.success | Payment completed successfully |
| payment.failed | Payment failed or was rejected |
| payment.expired | Wallet payment request expired |
| refund.processed | Refund was processed |
{
"event": "payment.success",
"transaction_id": "cpay_m4x3k_a1b2c3d4",
"order_id": "ORD-001",
"amount": 29.99,
"currency": "USD",
"status": "completed",
"timestamp": "2026-03-19T12:00:00.000Z",
"signature": "hmac_sha256_signature"
}
Verify the X-ReyPub-Signature header using HMAC-SHA256 of the request body with your secret key.
| HTTP Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created (new resource) |
| 400 | Bad request (invalid params, insufficient funds) |
| 401 | Unauthorized (invalid API keys or card details) |
| 403 | Forbidden (account/card not active) |
| 404 | Not found (user/transaction not found) |
| 409 | Conflict (duplicate refund, etc.) |
| 429 | Rate limited |
| 500 | Server error |
{
"success": false,
"error": "Insufficient funds. Available balance: $150.00"
}
API requests are limited to 120 requests per minute per IP address. If exceeded, you'll receive a 429 Too Many Requests response.
import requests
headers = {
"Content-Type": "application/json",
"X-ReyPub-Key": "rpub_pk_your_key",
"X-ReyPub-Secret": "rpub_sk_your_secret"
}
# Card Payment
resp = requests.post("https://reypub.pages.dev/api/payment/card", json={
"card_number": "4532XXXXXXXXXXXX",
"cvv": "123",
"expiry_month": 12,
"expiry_year": 2028,
"amount": 29.99,
"order_id": "ORD-001"
}, headers=headers)
print(resp.json())
$ch = curl_init('https://reypub.pages.dev/api/payment/card');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-ReyPub-Key: rpub_pk_your_key',
'X-ReyPub-Secret: rpub_sk_your_secret',
],
CURLOPT_POSTFIELDS => json_encode([
'card_number' => '4532XXXXXXXXXXXX',
'cvv' => '123',
'expiry_month' => 12,
'expiry_year' => 2028,
'amount' => 29.99,
'order_id' => 'ORD-001',
])
]);
$response = json_decode(curl_exec($ch), true);
const response = await fetch('https://reypub.pages.dev/api/payment/card', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-ReyPub-Key': 'rpub_pk_your_key',
'X-ReyPub-Secret': 'rpub_sk_your_secret'
},
body: JSON.stringify({
card_number: '4532XXXXXXXXXXXX',
cvv: '123',
expiry_month: 12,
expiry_year: 2028,
amount: 29.99,
order_id: 'ORD-001'
})
});
const data = await response.json();