💎 ReyPub API Documentation

Complete guide for integrating ReyPub payment system into your application

Overview Auth Wallet Payment Card Payment Status Refunds Webhooks Errors Client Portal Business Portal

Overview

ReyPub is a modern wallet and internal debit card payment system. Businesses can accept payments from ReyPub users through two methods:

Wallet Payment

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.

Card Payment

Process an instant card payment using the user's card details (number, CVV, expiry). No email or account ID needed. Balance verified automatically.

Base URL

https://reypub.pages.dev/api

All API endpoints are relative to this base URL.

Authentication

All payment API calls require your business API keys sent as request headers:

HeaderDescription
X-ReyPub-KeyYour public API key (starts with rpub_pk_)
X-ReyPub-SecretYour secret API key (starts with rpub_sk_)
Content-Typeapplication/json
Security: Never expose your secret key in client-side code. Always make API calls from your server.

Getting API Keys

1
Register at /business
2
Complete KYC verification (submit business documents)
3
Wait for admin approval
4
Go to API Keys section and click Generate Key
5
Save your secret key immediately - it's shown only once!

Quick Start

Example: Card Payment (cURL)

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"
  }'

Example: Wallet Payment (JavaScript)

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"

Wallet Payment

Request payment from a user's wallet. The user receives a notification and has 5 minutes to approve or reject.

POST /api/payment/wallet
Create a wallet payment request

Request Body

ParameterTypeRequiredDescription
user_account_idstringRequiredUser's account number (10 digits)
amountnumberRequiredPayment amount (0.01 - 1,000,000)
order_idstringRequiredYour order/invoice reference ID
descriptionstringOptionalPayment description shown to user
currencystringOptionalCurrency code (default: "USD")
callback_urlstringOptionalWebhook URL for payment updates

Success Response

{
  "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"
}

Payment Flow

1
Create Request: You send POST to /api/payment/wallet
2
User Notified: User sees the request in their Client Portal
3
User Approves/Rejects: Within 5-minute window
4
Check Status: Poll GET /api/payment/status/{transaction_id}
If the user doesn't respond within 5 minutes, the payment request automatically expires.

Card Payment

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.

POST /api/payment/card
Process a card payment (instant deduction)

Request Body

ParameterTypeRequiredDescription
card_numberstringRequired16-digit card number
cvvstringRequired3-digit CVV code
expiry_monthnumberRequiredExpiry month (1-12)
expiry_yearnumberRequiredExpiry year (e.g., 2028)
amountnumberRequiredPayment amount
order_idstringRequiredYour order reference ID
descriptionstringOptionalPayment description
currencystringOptionalCurrency code (default: "USD")

Success Response

{
  "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"
}
Important: Card payments are instant. The balance is verified and deducted in a single operation. No user approval needed.

Verification Steps (automatic)

1
Card Validation: Card number, CVV, and expiry are verified against the database
2
Status Check: Card must be active, owner account active, wallet active
3
Balance Check: Wallet must have sufficient funds
4
Limit Check: Daily spending limit is verified
5
Deduction: Amount deducted, transaction recorded, notifications sent

Payment Status

GET /api/payment/status/{transaction_id}
Check the status of a payment

Possible Statuses

StatusDescription
pendingWallet payment awaiting user approval
completedPayment successfully processed
rejectedUser rejected the wallet payment
expiredWallet payment request expired (5 min timeout)
failedPayment processing failed

Refunds

POST /api/payment/refund
Initiate a refund for a completed payment

Request Body

ParameterTypeRequiredDescription
transaction_idstringRequiredOriginal transaction ID
amountnumberOptionalPartial refund amount (defaults to full)
reasonstringOptionalReason 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"
  }'

Account Numbers

Every ReyPub user has a unique 10-digit account number assigned at registration. This is used for:

  • Wallet Payments: Identify the payer in /api/payment/wallet
  • P2P Transfers: Users send money to each other using account numbers
  • Account Identification: Displayed in the client dashboard for easy sharing
Account numbers are not needed for card payments. Card payments only require the card details (number, CVV, expiry).

Card PIN System

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.

How it works:

1
User issues a free debit card (KYC verified)
2
Card number and CVV shown only once at issuance
3
User sets a 6-digit PIN to protect their card view
4
To view card details (limits, balance, actions) user must enter PIN
The card PIN is separate from the transaction PIN (4 digits). Card PIN protects card viewing, transaction PIN protects wallet payments.

Webhooks

Set your webhook URL in the Business Portal settings. ReyPub will send POST requests for payment events.

Events

EventDescription
payment.successPayment completed successfully
payment.failedPayment failed or was rejected
payment.expiredWallet payment request expired
refund.processedRefund was processed

Webhook Payload

{
  "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.

Error Codes

HTTP CodeMeaning
200Success
201Created (new resource)
400Bad request (invalid params, insufficient funds)
401Unauthorized (invalid API keys or card details)
403Forbidden (account/card not active)
404Not found (user/transaction not found)
409Conflict (duplicate refund, etc.)
429Rate limited
500Server error

Error Response Format

{
  "success": false,
  "error": "Insufficient funds. Available balance: $150.00"
}

Rate Limits

API requests are limited to 120 requests per minute per IP address. If exceeded, you'll receive a 429 Too Many Requests response.

Integration Examples

Python

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())

PHP

$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);

Node.js

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();