Backend Integration
End-to-end guide for integrating Recur into your server-side application.
Backend Integration
This guide walks you through a complete server-side Recur integration — from SDK installation to processing payments and managing subscriber lifecycle.
Overview
Step 1: Install the SDK
Step 2: Initialize the Client
API Key is required for all merchant operations (creating plans, listing subscriptions, querying transactions). Get one from Dashboard → API Keys.
Step 3: Create an App and Plans
This is typically a one-time setup, done during initial deployment or via the dashboard.
Step 4: Serve Subscribe Data to Frontend
Your frontend needs plan details and your merchant wallet to build the subscribe transaction:
The frontend then uses this data to call client.buildSubscribeTransaction() — see Subscribe docs.
Step 5: Register Subscriptions
After the subscriber's on-chain transaction confirms, register the subscription with Recur so the Keeper knows to process payments:
Important: The Keeper will only process payments for registered subscriptions. Always register after on-chain confirmation.
Step 6: Handle Webhook Events
This is where you grant/revoke access based on payment status. See the full Webhooks guide for setup details.
Step 7: Query Subscriptions & Transactions
Use the SDK to check subscription status or list payment history:
Step 8: Handle Cancellations
When a subscriber cancels, you can listen for the cancel_finalized webhook event (recommended), or check proactively:
Complete Example: Express Server
Environment Variables
Next Steps
- Webhooks guide — deep dive on event handling and payload format
- API Keys guide — key management and security
- Cancel flows — all three cancellation methods
- Error handling — handle API and SDK errors gracefully