How to Integrate Recurly with Your Headless CMS
Connect Recurly subscription plans with structured content so pricing pages, checkout flows, renewal emails, and product pages stay in sync without manual copy-and-paste work.
What is Recurly?
Recurly is a subscription billing platform for companies that sell recurring products, memberships, digital subscriptions, SaaS plans, and usage-based services. It handles subscription plans, billing accounts, invoicing, renewals, dunning, coupons, taxes, and payment gateway connections. Teams use Recurly when subscription logic needs to live in a dedicated billing system while product, pricing, and merchandising content live in a separate publishing workflow.
Why integrate Recurly with a headless CMS?
Subscription commerce gets messy when billing data and customer-facing content drift apart. A pricing page might say a plan costs $19 per month, while Recurly charges $24 because finance updated the plan in billing first. Or editorial teams may update plan descriptions, trial messaging, FAQs, and localization in a publishing workflow, but developers still need to manually copy plan codes and prices into the checkout app.
Architecture overview
A typical Recurly and Sanity integration starts with subscription plan content modeled in Sanity Studio. Editors publish a plan document that includes fields such as plan name, Recurly plan code, billing interval, price display text, currency, feature list, trial messaging, legal footnotes, and channel-specific copy. When the document is published, a Sanity webhook or Function receives the mutation event. The handler uses GROQ to fetch only the fields needed for billing sync, including referenced feature groups or localized copy if needed. The server-side code then calls Recurly's Node SDK with the Recurly API key, checks whether a plan with the same code already exists, and creates or updates the plan through Recurly's Plans API. Your frontend reads display content from Sanity and uses the Recurly plan code when sending the shopper into checkout or creating a subscription. The end user sees the latest approved content, while Recurly continues to handle subscription creation, renewals, invoicing, payment collection, and account state.
Common use cases
Subscription pricing pages
Publish plan names, feature tables, trial copy, and Recurly plan codes from Sanity so checkout always references the right billing plan.
Localized plan catalogs
Keep Recurly plan codes stable while Sanity delivers localized pricing labels, legal footnotes, and plan descriptions by market.
Campaign-specific offers
Pair Recurly coupons with Sanity campaign pages, banners, and eligibility messaging for seasonal trials or win-back offers.
Subscription support agents
Use Agent Context to let production agents answer plan, renewal, and policy questions from approved Sanity content while Recurly handles account status.
Step-by-step integration
- 1
Set up Recurly access
Create or use an existing Recurly site, then generate a private API key from Integrations > API Credentials in Recurly. Install the Node SDK with npm install recurly, and keep the key in server-side environment variables only.
- 2
Model subscription plans in Sanity Studio
Create a plan schema with fields such as title, recurlyPlanCode, billingInterval, currency, unitAmount, trialLength, featureList, checkoutDisclaimer, and market. Keep Recurly identifiers in explicit fields so editors don't paste plan codes into rich text.
- 3
Decide field ownership
Use Sanity for customer-facing content and planned changes. Use Recurly for subscription lifecycle data, payment state, invoices, accounts, and active customer subscriptions. Avoid syncing live subscriber state back into editable content documents.
- 4
Create the sync trigger
Use a Sanity webhook filtered to published plan documents, or a Sanity Function triggered by content mutations. Include the document ID in the payload, then fetch the current published document with GROQ before calling Recurly.
- 5
Call Recurly's Plans API
In the handler, use the Recurly SDK to look up the plan by code. If it exists, update editable plan fields such as name and description. If it doesn't exist, create it with the plan code, billing interval, currency, and unit amount.
- 6
Test the customer journey
Publish a draft plan in a non-production Sanity dataset, sync it to a Recurly sandbox site, and run checkout with Recurly.js or your commerce backend. Test create, update, archive, currency, and coupon cases before connecting production.
How Sanity + Recurly works
Build your Recurly integration on Sanity
Sanity gives you the structured content foundation, real-time event system, and flexible APIs you need to connect subscription content with Recurly billing workflows.
Start building free →CMS approaches to Recurly
| Capability | Traditional CMS | Sanity |
|---|---|---|
| Subscription plan modeling | Plan details often live inside pages or plugins, which makes it hard to reuse the same data in checkout, email, and mobile apps. | Schema-as-code lets you model plans, currencies, trials, feature groups, legal text, and Recurly plan codes as typed fields with version control. |
| Sync timing | Pricing updates often depend on manual exports, plugin behavior, or scheduled jobs. | Webhooks or Functions can trigger on published plan changes and run server-side sync logic without polling. |
| Field-level control for Recurly | Handlers may need to parse rendered page content or custom fields mixed with presentation data. | GROQ can fetch the exact fields Recurly needs, including referenced content, in one query. |
| Multi-channel subscription content | Web pages are usually the primary output, so mobile, checkout, and support channels need extra mapping work. | One structured back end can feed web, mobile, Recurly sync jobs, support content, and production AI agents. |
| Editorial control and trade-offs | Nontechnical teams can edit pages, but billing-safe fields may be hidden in plugin settings or developer-owned code. | Sanity Studio can expose only the fields editors should change. You still need clear rules so Recurly owns billing state and Sanity owns publishable content. |
Keep building
Explore related integrations to complete your content stack.
Sanity + Shopify
Connect product storytelling in Sanity with Shopify product catalogs, collections, and checkout flows.
Sanity + Stripe
Pair structured pricing and product content with Stripe payments, checkout sessions, and customer billing flows.
Sanity + Commercetools
Use Sanity for rich commerce content while Commercetools handles catalog, cart, pricing, and order services.