- Home
- Developers
Build the payment experience your way.
Simple REST APIs, clear Arabic documentation, and a sandbox you can start with in minutes.
Introduction
This page is illustrative documentation for demo purposes. API URLs, keys and responses are not real.
The RPAD PAY API works over HTTPS and accepts and returns JSON. Amounts are sent in the smallest currency unit (halalas), so for example 29900 means SAR 299.00.
| Environment | Base URL |
|---|---|
| Sandbox | https://sandbox.api.rpadpay.example/v1 |
| Production | https://api.rpadpay.example/v1 |
Authentication
Send your secret key in the Authorization header as a Bearer token. Keep the secret key on your server only, never in front-end or app code.
| Key | Prefix | Usage |
|---|---|---|
| Public key | pk_test_ | Front end and payment forms |
| Secret key | sk_test_ | Server only |
Create a payment
Create a new payment and get a checkout_url to send the customer to the checkout page.
# Illustrative example – sandbox
curl -X POST https://sandbox.api.rpadpay.example/v1/payments \
-H "Authorization: Bearer sk_test_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 29900,
"currency": "SAR",
"description": "Men's thobe",
"callback_url": "https://shop.example/payments/callback",
"metadata": { "order_id": "ORD-1042" }
}' // Illustrative example – sandbox
const res = await fetch("https://sandbox.api.rpadpay.example/v1/payments", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.RPAD_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: 29900, // in halalas = SAR 299.00
currency: "SAR",
description: "Men's thobe",
callback_url: "https://shop.example/payments/callback",
metadata: { order_id: "ORD-1042" },
}),
});
const payment = await res.json();
console.log(payment.checkout_url);# Illustrative example – sandbox
import os, requests
resp = requests.post(
"https://sandbox.api.rpadpay.example/v1/payments",
headers={"Authorization": f"Bearer {os.environ['RPAD_SECRET_KEY']}"},
json={
"amount": 29900,
"currency": "SAR",
"description": "Men's thobe",
"callback_url": "https://shop.example/payments/callback",
"metadata": {"order_id": "ORD-1042"},
},
)
print(resp.json()["checkout_url"])<?php
// Illustrative example – sandbox
$ch = curl_init("https://sandbox.api.rpadpay.example/v1/payments");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RPAD_SECRET_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"amount" => 29900,
"currency" => "SAR",
"description" => "Men's thobe",
]),
]);
$payment = json_decode(curl_exec($ch), true);Response
{
"id": "pay_8f2k19dq0x",
"object": "payment",
"status": "initiated",
"amount": 29900,
"currency": "SAR",
"description": "Men's thobe",
"checkout_url": "https://checkout.rpadpay.example/pay_8f2k19dq0x",
"created_at": "2026-01-24T10:24:00+03:00",
"metadata": { "order_id": "ORD-1042" }
}Fields
| Field | Type | Description |
|---|---|---|
amount | integer | Amount in halalas (required) |
currency | string | Currency code, e.g. SAR (required) |
description | string | Description shown to the customer |
callback_url | string | Redirect URL after payment |
metadata | object | Your own extra data |
Payment Links
Create a shareable payment link with an optional expiry.
curl -X POST https://sandbox.api.rpadpay.example/v1/payment_links \
-H "Authorization: Bearer sk_test_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "amount": 15000, "currency": "SAR", "title": "Table booking", "expires_in_hours": 48 }' const link = await fetch("https://sandbox.api.rpadpay.example/v1/payment_links", {
method: "POST",
headers: { "Authorization": `Bearer ${key}`, "Content-Type": "application/json" },
body: JSON.stringify({ amount: 15000, currency: "SAR", title: "Table booking", expires_in_hours: 48 }),
}).then(r => r.json());
// link.url => "https://rpad.pay/3f9k2"Recurring Payments
Create a subscription with an interval of day or week or month or year.
curl -X POST https://sandbox.api.rpadpay.example/v1/subscriptions \
-H "Authorization: Bearer sk_test_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "customer_id": "cus_51ka", "amount": 9900, "interval": "month", "start_date": "2026-01-24" }' Webhooks
We notify your endpoint when a payment status changes. Always verify the signature in the X-Rpad-Signature.
// Illustrative webhook signature check
import crypto from "node:crypto";
app.post("/webhooks/rpad", express.raw({ type: "application/json" }), (req, res) => {
const signature = req.header("X-Rpad-Signature");
const expected = crypto
.createHmac("sha256", process.env.RPAD_WEBHOOK_SECRET)
.update(req.body)
.digest("hex");
if (signature !== expected) return res.status(400).send("invalid signature");
const event = JSON.parse(req.body);
if (event.type === "payment.paid") {
// Update the order status in your system
}
res.sendStatus(200);
});{
"id": "evt_31ab90",
"type": "payment.paid",
"created_at": "2026-01-24T10:25:12+03:00",
"data": { "id": "pay_8f2k19dq0x", "amount": 29900, "currency": "SAR", "status": "paid" }
}| Event | When it is sent |
|---|---|
payment.paid | When a payment succeeds |
payment.failed | When a payment fails |
refund.created | When a refund is created |
payout.completed | When a payout completes |
Payment statuses
| Status | Meaning | Badge |
|---|---|---|
initiated | Payment created, waiting for the customer | initiated |
paid | Payment succeeded | paid |
failed | Payment failed | failed |
refunded | Amount refunded | refunded |
expired | Payment or link expired | expired |
Test cards
Use any future expiry date and any 3-digit CVV in the sandbox. Illustrative numbers only.
| Network | Card number | Result |
|---|---|---|
| mada | 4464 0400 0000 0007 | Successful payment |
| Visa | 4111 1111 1111 1111 | Successful payment |
| Mastercard | 5555 5555 5555 4444 | Successful payment |
| Visa | 4000 0000 0000 0002 | Declined by bank |
Libraries & plugins
Node.js
npm i @rpadpay/node
Python
pip install rpadpay
Store plugins
Plugins for popular platforms.
Coming soonReady to integrate?
Get your sandbox keys now.