The ReCurr API lets a merchant integration manage their own plans, customers and subscriptions, take a card through a hosted page, and read the invoices ReCurr raises against them. Everything your dashboard does to a subscription, an integration can do here — and a WooCommerce store does all of it through the connector plugin, which is a client of this same API.
Start with the quick start below: four calls, ending in a subscription that bills. If you would rather not write HTTP by hand, there is a JavaScript and a PHP library.
A plan is what your dashboard calls a Product — the thing a customer subscribes to, together with its per-cycle prices. (Not to be confused with your own ReCurr subscription, which is billed separately.)
Amounts are in South African rand. ReCurr does not bill in any other currency, so a price sent in one is refused rather than converted.
Every request must include an API key in the Authorization header:
Authorization: Bearer recurr_rk_<48 hex chars>
Mint a key from your dashboard: Settings → API Keys → + New API key.
The plain key is shown ONCE at creation. Store it in your integration's secrets vault immediately; the dashboard only shows the prefix afterwards.
A key carries scopes, and every endpoint requires exactly one. A scope is <resource>:<action>:
| Scope | What it opens |
|---|---|
customers:read |
GET /customers, GET /customers/{id} |
customers:write |
POST /customers, PATCH /customers/{id} |
plans:read |
GET /plans, GET /plans/{id} |
plans:write |
POST /plans, PATCH /plans/{id}, and the two /variants endpoints |
subscriptions:read |
GET /subscriptions, GET /subscriptions/{id} |
subscriptions:write |
POST /subscriptions, and pause / resume / cancel / card-update-link |
invoices:read |
GET /invoices |
tickets:read |
GET /tickets, GET /tickets/{id} |
woocommerce:read |
GET /woocommerce/stores, GET /woocommerce/stores/{id}, GET …/{id}/imports, GET …/{id}/order-writebacks, and the shopper reads under …/{id}/subscribers/{wpUserId} |
woocommerce:write |
POST /woocommerce/stores, and disconnect / catalogue-sync / imports / cut-over / order-writebacks/ack / order-writebacks/retry, plus the shopper actions under …/{id}/subscribers/{wpUserId} (cancel / pause / resume / card-update-link / trial-conversion-link / change-plan) |
Each endpoint below states its required scope in its description.
Two rules apply on top of the table:
<resource>:write includes <resource>:read. A write answers with the record it wrote, so there is nothing to protect by withholding the read.read and write on their own are coarse grants covering every resource — including resources this API has not published yet. Keys minted before scopes were selectable hold both, and keep working unchanged. They are the right thing for your own backend and the wrong thing to hand to anyone else.GET /me and GET /ping need no scope: any valid key can check that it is valid.
Choosing scopes. In your dashboard, Settings → API Keys → + New API key now asks what the key may do before it mints one, and lets you set an expiry date. Grant the narrowest set that does the job — a nightly reconciliation script wants subscriptions:read and invoices:read and nothing else. If a call comes back 403 INSUFFICIENT_SCOPE, the message names the missing scope; mint a new key with it (scopes cannot be edited after minting — that is deliberate, so a key's powers cannot grow under an integration you have already handed it to).
GET /me returns both scopes (what was granted) and effectiveScopes (what that grant actually opens after the two rules above) — the fastest way to settle what a key can do.
Two are maintained alongside this API and versioned with it. Both are dependency-free, so you can vendor either one into a project without adding to your lockfile.
| package | requires | |
|---|---|---|
| JavaScript / TypeScript | @recurr/recurr-node (sdks/recurr-node) |
Node 18+ |
| PHP | recurr/recurr-php (sdks/recurr-php) |
PHP 7.4+ with cURL |
Each one does three things this document otherwise asks you to do by hand, and the third is the one that bites:
code;Idempotency-Key per operation and reuses it across every retry of that operation — including its own automatic retries of a 5xx or a 409 IDEMPOTENCY_CONFLICT. Reaching for a fresh key on retry is the single easiest way to bill somebody twice, and it is what hand-written clients do by default.Neither is required. Everything below works with curl, and the API is the contract — the libraries are a convenience over it, never a different set of rules.
On WooCommerce, use neither. The ReCurr Connector for WooCommerce already speaks this API, including the store, catalogue, migration and My Account endpoints, and it renders your storefront pages. The PHP library is for PHP that is not WordPress.
Where to get it: your ReCurr dashboard, under Settings → API Keys — the same page where you mint the key the connector authenticates with. It is a WordPress plugin zip; install it under Plugins → Add New → Upload Plugin. It comes with a merchant account and is not published anywhere else.
If your store already sells subscriptions through the older self-hosted ReCurr plugin, read the WooCommerce cut-over runbook before you install this one. The two must never bill the same customer at the same time — they cannot see each other, so a subscriber in the middle of a migration would be charged twice on the same day, once by each. The runbook is in the dashboard beside the download, under Settings → API Keys; the migration endpoints below refuse a cut-over that does not declare the engine plugin's state, for the same reason.
Everything below is one copy-pasteable session: a customer, a plan, a subscription, and the invoice it produced. Set your key once —
export RECURR_KEY="recurr_rk_…" # Settings → API Keys
export RECURR_API="https://app.recurr.co.za/api/v1"
Scopes for this walkthrough: customers:write, plans:write, subscriptions:write, invoices:read. (The three :write scopes include their :read, so no separate read scopes are needed.)
curl -s "$RECURR_API/ping" -H "Authorization: Bearer $RECURR_KEY"
# { "success": true, "data": { "pong": true, "timestamp": "2026-07-28T09:14:02.881Z" } }
Unsure what a key may do? curl -s "$RECURR_API/me" -H "Authorization: Bearer $RECURR_KEY" lists its scopes.
Every write needs an Idempotency-Key — generate one per operation and reuse it if you have to retry (see Idempotency below).
curl -s -X POST "$RECURR_API/customers" \
-H "Authorization: Bearer $RECURR_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"firstName": "Thandi",
"lastName": "Mokoena",
"company": "Mokoena Design",
"vatNumber": "4123456789"
}'
{ "success": true, "data": { "id": "3f1c…", "email": "[email protected]", "status": "active", … } }
Keep that id — call it CUSTOMER_ID. You never send a password: your customer sets their own through the normal reset flow.
A plan is what your dashboard calls a Product, plus its prices. simple carries its own price list.
curl -s -X POST "$RECURR_API/plans" \
-H "Authorization: Bearer $RECURR_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "Studio Retainer",
"type": "simple",
"pricing": [
{ "billingCycle": "monthly", "price": 199.00 },
{ "billingCycle": "annual", "price": 1990.00 }
]
}'
Keep the returned id as PLAN_ID. Re-pricing later is the same shape sent to PATCH /plans/{id} — prices upsert by cycle, so sending only monthly leaves annual alone.
curl -s -X POST "$RECURR_API/subscriptions" \
-H "Authorization: Bearer $RECURR_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"customerId": "CUSTOMER_ID",
"planId": "PLAN_ID",
"billingCycle": "monthly",
"paymentMethod": "invoice",
"metadata": { "yourOrderRef": "SO-10482" }
}'
{ "success": true, "data": {
"id": "9b02…", "status": "active", "billingCycle": "monthly",
"amount": 199.00, "nextChargeAmount": 25.68, "nextChargeDate": "2026-07-28",
"metadata": { "yourOrderRef": "SO-10482" } } }
Note the price came from the plan — there is no amount field to send. In the example above the merchant bills monthly with calendar pro-rata on and there were four days left in July, so the first invoice is the part-month (R25.68) and the next is the full R199 on 1 September; with pro-rata off it would be R199 today and R199 on the 28th of each month. Either way nothing is charged by this call — ReCurr raises and emails the invoice, and you mark it paid when the money arrives.
Send "paymentMethod": "card" instead and the same call answers with a link to send your customer:
curl -s -X POST "$RECURR_API/subscriptions" \
-H "Authorization: Bearer $RECURR_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"customerId": "CUSTOMER_ID",
"planId": "PLAN_ID",
"billingCycle": "monthly",
"paymentMethod": "card"
}'
{ "success": true, "data": {
"subscription": { "id": "9b02…", "status": "pending", "paymentMethod": "card", "nextChargeAmount": 25.68 },
"checkout": { "url": "https://app.recurr.co.za/pay/HkQ2f8Zt1mNc4rVbXpLq9A", "expiresAt": "2026-08-27T09:14:00.000Z" } } }
ReCurr never touches card details, so the card is entered on that page and nowhere else — you can redirect to the URL, email it, or send it over WhatsApp. Your customer sees who is billing them and what for, pays the first period, and the card they pay with becomes the card the subscription renews on: one payment, because asking the gateway for money is what captures the card.
Until they pay, status is pending — the subscription exists and bills nothing. When they do, it turns active, the schedule starts, and you get a subscription.activated webhook. Lost the URL? GET /subscriptions/{id} returns the live one.
Three things are refused up front rather than producing a link that cannot be paid: a first charge under R5.00, no payment gateway on your account, and an overdue KYC verification. See SubscriptionCreate for the codes.
Subscribe them exactly as above, on either payment method. No card is asked for, no link is returned, and the subscription is created at status: "trial" — a trial charges R0.00, and R0.00 is under the gateway's R5.00 floor, so there is nothing a card page could do today.
ReCurr converts it for you: reminders at 72, 48 and 24 hours before the end, each carrying a link that saves a card and takes the first paid charge; then seven days of grace in which that link still works; then the subscription closes itself, with a final email confirming that nothing was charged. Watch for subscription.trial_ended — its converted field tells you which ending it got.
curl -s "$RECURR_API/invoices" -H "Authorization: Bearer $RECURR_KEY"
Rather than poll this, subscribe to the invoice.created and invoice.paid webhooks (see Webhooks below) — they arrive the moment it happens.
# Freeze it — nothing bills while paused, and the time is given back on resume
curl -s -X POST "$RECURR_API/subscriptions/SUBSCRIPTION_ID/pause" \
-H "Authorization: Bearer $RECURR_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" -d '{ "reason": "Customer travelling until March" }'
# Resume — every date moves forward by exactly the frozen duration
curl -s -X POST "$RECURR_API/subscriptions/SUBSCRIPTION_ID/resume" \
-H "Authorization: Bearer $RECURR_KEY" -H "Idempotency-Key: $(uuidgen)"
All three verbs are safe to repeat: pausing a paused subscription answers 200 with its current state rather than an error your integration has to special-case.
Node
import { ReCurr } from "@recurr/recurr-node";
const recurr = new ReCurr({ apiKey: process.env.RECURR_KEY });
const customer = await recurr.customers.create({ email: "[email protected]", firstName: "Thandi", lastName: "Mokoena" });
const plan = await recurr.plans.create({ name: "Studio Retainer", type: "simple", pricing: [{ billingCycle: "monthly", price: 199 }] });
const sub = await recurr.subscriptions.create({ customerId: customer.id, planId: plan.id, billingCycle: "monthly" });
console.log(`${sub.subscription.id} — next charge R${sub.subscription.nextChargeAmount} on ${sub.subscription.nextChargeDate}`);
PHP
$recurr = new \ReCurr\Client(getenv("RECURR_KEY"));
$customer = $recurr->customers->create(["email" => "[email protected]", "firstName" => "Thandi", "lastName" => "Mokoena"]);
$plan = $recurr->plans->create(["name" => "Studio Retainer", "type" => "simple", "pricing" => [["billingCycle" => "monthly", "price" => 199]]]);
$sub = $recurr->subscriptions->create(["customerId" => $customer["id"], "planId" => $plan["id"], "billingCycle" => "monthly"]);
Neither example passes an Idempotency-Key: the library mints one per call and reuses it across its own retries, which is the behaviour you want and the behaviour the hand-written version below gets wrong.
const { randomUUID } = require("crypto");
const call = (path, body) => fetch(`${process.env.RECURR_API}${path}`, {
method: body ? "POST" : "GET",
headers: {
"Authorization": `Bearer ${process.env.RECURR_KEY}`,
"Content-Type": "application/json",
...(body ? { "Idempotency-Key": randomUUID() } : {}),
},
...(body ? { body: JSON.stringify(body) } : {}),
}).then(async (r) => {
const json = await r.json();
if (!json.success) throw new Error(`${r.status} ${json.error.code}: ${json.error.message}`);
return json.data;
});
const customer = await call("/customers", { email: "[email protected]", firstName: "Thandi", lastName: "Mokoena" });
const plan = await call("/plans", { name: "Studio Retainer", type: "simple", pricing: [{ billingCycle: "monthly", price: 199 }] });
const sub = await call("/subscriptions", { customerId: customer.id, planId: plan.id, billingCycle: "monthly" });
console.log(`${sub.id} — next charge R${sub.nextChargeAmount} on ${sub.nextChargeDate}`);
Retrying that
call()as written generates a newIdempotency-Keyeach time, which is exactly what you do not want on a retry. In production, generate the key once per logical operation, store it with the job, and reuse it until the operation succeeds.
Read this first: there is no livemode flag. ReCurr has one data plane. A customer you create while developing is a real customer, a subscription is a real subscription, and both count towards your plan's limits until you cancel them. What is switchable is the gateway: your PayFast credentials carry a sandbox flag, and with it on, every card payment ReCurr initiates goes to PayFast's sandbox and no money moves.
That is the honest shape of it, and it is worth knowing before you design around a separation that does not exist. Develop on a separate ReCurr merchant account — a free one is enough — rather than on the account your real customers are billed from.
Settings → Payment Gateways → PayFast, enter your PayFast sandbox merchant id and key, and leave Sandbox mode on. Every hosted checkout and payment link on that account now settles against sandbox.payfast.co.za, and every renewal or other charge to a saved card goes to PayFast's API in its test mode (api.payfast.co.za, ?testing=true). The R5.00 gateway minimum still applies — the sandbox enforces the same floor, which is exactly what you want to develop against.
GET /me does not report this; it is a property of your account, not of the key.
An empty account is a poor place to write a dashboard. tools/sandbox/seed.mjs in the ReCurr repository creates a realistic book through this API — a catalogue across all four plan types, customers, and subscriptions in every state your integration has to render, including one in a trial, one mid-dunning and one paused:
RECURR_KEY=recurr_rk_… node tools/sandbox/seed.mjs
RECURR_KEY=recurr_rk_… node tools/sandbox/seed.mjs --undo # cancels everything it made
It only calls the endpoints documented here, so nothing it does is something you could not do yourself — and --dry-run prints the plan first.
tools/sandbox/webhook-listener.mjs is a local endpoint that verifies each signature and prints the event, so you can see what a delivery really looks like before you write a handler:
RECURR_WEBHOOK_SECRET=whsec_… node tools/sandbox/webhook-listener.mjs --port 4000
Expose it with any tunnel (ngrok http 4000, cloudflared tunnel), register the public URL under Settings → Webhooks, and use Send test to fire one. It prints a rejected signature as loudly as an accepted one, which is the failure worth catching early.
Under Settings → Webhooks → your endpoint → Deliveries, every attempt is listed with its response, and Replay re-sends that exact event — same eventId, so your consumer-side idempotency is exercised too. Use it to re-run a handler against a real payload instead of a fabricated one.
PayFast publishes its own test card numbers and they change from time to time; take them from PayFast's sandbox documentation rather than from here, because a card number copied into our docs is one that goes stale silently.
Every write endpoint requires an Idempotency-Key header:
Idempotency-Key: 6f9619ff-8b86-d011-b42d-00cf4fc964ff
Generate a unique value per logical operation (a UUID is ideal) and reuse the same value when retrying — that is what makes a retry safe. A request with no key is refused with 400 IDEMPOTENCY_KEY_REQUIRED rather than processed unprotected.
Behaviour of a repeated key, scoped to your merchant account and to the exact endpoint:
422 IDEMPOTENCY_KEY_REUSED. The second request is not performed — silently answering from the cache would swallow a write you believe you made.409 IDEMPOTENCY_CONFLICT. Retry shortly.A stored response is kept for 24 hours.
A 4xx is a stored result. If a request fails validation, or is refused by a plan limit, that response is replayed for the same key for the full 24 hours. Once you have fixed the cause — corrected the field, upgraded the plan — send the corrected request under a new
Idempotency-Key.
Limits are per merchant account, not per key: minting a second key does not buy a second allowance, and every integration you run shares one budget.
| Budget | Limit | What it counts |
|---|---|---|
| Requests | 600 per minute | every call to /api/v1 |
| Writes | 120 per minute | POST and PATCH — a write also uses one of the 600 |
Every response says where you stand, so you never have to count your own calls:
RateLimit-Limit: 600
RateLimit-Remaining: 587
RateLimit-Reset: 41 # seconds until the window frees a slot
Over the limit you get 429 with the code RATE_LIMIT_EXCEEDED and a Retry-After header in seconds.
A 429 means nothing happened. The request was refused before it reached the endpoint: no customer was created, no subscription changed, and — the part that matters for a retry — the Idempotency-Key was not consumed. Wait the number of seconds you were given and send the identical request, same key and all.
Both client libraries already do exactly that: a 429 is retried with backoff, honouring Retry-After, under the key the operation started with.
Staying under it. Read RateLimit-Remaining rather than counting locally — it accounts for every process you are running, which is the number you cannot work out on your own. For bulk work prefer one list call with a larger limit over a call per record. If your integration genuinely needs more headroom, talk to us before you launch rather than after your first 429.
There is a separate, quieter guard on rejected keys per originating address, so a deployment that ships a revoked key gets its 401s rather than hammering the front door. It counts nothing but 401s, so a working integration never meets it — including one sharing an address with somebody else's broken script.
All endpoints return the same envelope:
{ "success": true, "data": { ... } }
{ "success": false, "error": { "code": "STRING_CODE", "message": "Human-readable" } }
Branch on code, never on message. A code is part of this contract and will not change under you; the message is written for a human reading a log and is improved whenever we find a clearer way to say it.
Any endpoint — MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED, NOT_FOUND, VALIDATION_ERROR, INTERNAL_SERVER_ERROR.
Any write — IDEMPOTENCY_KEY_REQUIRED, IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_CONFLICT.
Customers — CUSTOMER_NOT_FOUND, CUSTOMER_ALREADY_EXISTS, CUSTOMER_DECLINED, EMAIL_NOT_AVAILABLE, CUSTOMER_CAP_REACHED, FREEMIUM_QUOTA_REACHED, FREEMIUM_PERIOD_ENDED.
Plans — PLAN_NOT_FOUND, PLAN_ALREADY_EXISTS, PRICING_REQUIRED, PRICING_NOT_APPLICABLE, TRIAL_NOT_APPLICABLE, VARIANTS_NOT_APPLICABLE, VARIANT_NOT_FOUND, VARIANT_SKU_TAKEN, CURRENCY_NOT_SUPPORTED.
Subscriptions — SUBSCRIPTION_NOT_FOUND, SUBSCRIPTION_ALREADY_EXISTS, SUBSCRIPTION_NOT_PAUSABLE, SUBSCRIPTION_NOT_PAUSED, CYCLE_NOT_PRICED, SETUP_FEE_NOT_SUPPORTED, VARIANT_REQUIRED, INVALID_VARIANT, VARIANT_NOT_APPLICABLE, GROUPED_PRODUCT_NOT_PURCHASABLE, EXTERNAL_PRODUCT_NOT_BILLABLE.
Collecting a card — on create with "card", and on a card-update link: BELOW_GATEWAY_MINIMUM, GATEWAY_NOT_CONNECTED, KYC_RESTRICTED, PAYMENT_LINK_EXISTS, SUBSCRIPTION_NOT_CARD_BILLED, SUBSCRIPTION_NOT_LIVE, TRIAL_CONVERTS_INSTEAD, NOTHING_OWED.
WooCommerce — STORE_DISCONNECTED, IMPORT_EXCEEDS_CUSTOMER_CAP, ENGINE_STILL_ACTIVE, ENGINE_STATE_UNDECLARED, ALREADY_LIVE, GROUP_INCOMPLETE, GROUP_SPANS_CUSTOMERS, SUBSCRIPTION_NOT_CHANGEABLE, PLAN_NOT_SOLD_HERE, PLAN_HAS_OPTIONS, CARD_UPDATE_NOT_AVAILABLE, NOTHING_TO_CONVERT.
The catalogue sync, the import and the cut-over answer
200with a report, not an error. They are bulk operations over a whole store, and one product ReCurr cannot represent must not fail the other four hundred. Each refused row carries its own reason code —UNSUPPORTED_BILLING_TERM,GROUPED_CHILD_UNMAPPED,SCHEDULE_TOO_FAR_BEHINDand the rest — inside the report, documented on those endpoints. The codes listed above are the ones that come back as anerrorenvelope and stop the whole call.
403 INSUFFICIENT_SCOPE is the one to read carefully: it means the key authenticated fine but was not granted this endpoint's scope. The message names the scope. Nothing was changed.
When the account itself is closed to the API — any endpoint, reads and writes alike: 423 MERCHANT_SUSPENDED while the ReCurr account is suspended, and 401 MERCHANT_ACCOUNT_CLOSED once it is archived. The key itself is still valid — a suspended account that is brought up to date works again with the same key, with nothing to re-mint. The message is deliberately written so it can be shown to a shopper as it is (it never states the account's billing standing); branch on the code, and tell the account owner to sign in to the dashboard.
Configure outbound webhook endpoints from Settings → Webhooks in your dashboard. Each subscribed event POSTs a signed JSON payload to your URL.
Your endpoint receives your own book only: an invoice event goes to the merchant who issued the invoice, and payment.received to the merchant whose customer's credit it is. A customer who also buys from another merchant is in that merchant's book separately — nothing they bill reaches you — and an invoice ReCurr bills you is not part of your book, so it sends nothing to your endpoint.
Every webhook body has the same wrapper:
{
"eventType": "invoice.paid",
"eventId": "d8e1d000-121c-4e76-84d5-f67421bbfd63",
"timestamp": "2026-06-06T14:08:41.154Z",
"data": { /* event-specific fields */ }
}
Every delivery includes:
X-ReCurr-Signature: t=<unix_timestamp>,v1=<hex_hmac>
where v1 is HMAC-SHA256(secret, "<timestamp>.<raw_request_body>"). Verify it before trusting any payload:
Node.js
const crypto = require("crypto");
function verifyReCurrSignature(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map(p => p.split("=")));
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1))) {
throw new Error("Bad signature");
}
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) {
throw new Error("Stale timestamp");
}
}
PHP
function verifyReCurrSignature(string $rawBody, string $header, string $secret): bool {
parse_str(str_replace(",", "&", $header), $parts);
$expected = hash_hmac("sha256", $parts["t"] . "." . $rawBody, $secret);
if (!hash_equals($expected, $parts["v1"])) return false;
if (abs(time() - (int) $parts["t"]) > 300) return false;
return true;
}
A non-2xx response (or a network error) triggers retries with this schedule:
1m → 5m → 30m → 2h → 12h → 24h (6 attempts total over ~40 hours).
After 20 consecutive deliveries that exhaust all retries, the endpoint is automatically paused. Re-enable it from your dashboard.
Use the X-ReCurr-Event-Id header (also present as eventId in the JSON body) as your idempotency key — it stays constant across retries of the same business event. The X-ReCurr-Delivery-Id and X-ReCurr-Delivery-Attempt headers identify each individual POST attempt.
See the Webhooks section below for the JSON schema of every event your endpoint may receive.