Implement Recurly.js to tokenize card data client-side and use the token to create a Recurly subscription without handling raw card data server-side

domain: recurly.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Include Recurly.js on the page: <script src='https://js.recurly.com/v4/recurly.js'></script> and initialize with recurly.configure({ publicKey: 'YOUR_PUBLIC_KEY' })
  2. Mount the card element: recurly.Elements() to create a CardElement and call cardElement.attach('#card-element') to render a hosted card input iframe
  3. On form submit, call recurly.token(form, (err, token) => {}) passing the form element; Recurly returns a single-use token string
  4. Submit the token to your server and create the billing info with PUT /sites/SITE_ID/accounts/ACCOUNT_CODE/billing_info using token_id: TOKEN_VALUE in the request body
  5. Create the subscription server-side with POST /sites/SITE_ID/subscriptions providing account.code and plan_code — Recurly retrieves the stored billing info automatically
  6. Handle tokenization errors in the client-side callback; error.fields array lists which card fields failed validation (number, month, year, cvv)

Known gotchas

Related routes

Create a Recurly subscription plan and enroll a subscriber via the Recurly v3 API
recurly.com · 6 steps · unrated
Implement card account updater in Recurly to reduce involuntary churn from expired cards
recurly.com · 6 steps · unrated
Create a Recurly subscription add-on and charge variable quantities at renewal
recurly.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans