Skip to content

Recurly

With Recurly as your billing provider, EdgeKit keeps a read-only copy of your Recurly site’s records in your organization’s own database, and the Billing provider screens show it. See Read your billing provider’s records. Checkout charges through Recurly. See Sell an offer with checkout.

Every Recurly subscription gives access, whoever sold it, including every one from before your organization used EdgeKit. A Recurly plan gives access once it is attached to an offer and deployed. You attach your own Recurly plans in the console. EdgeKit maps one for you when user subscriptions are on it and no offer carries it yet. See How access follows your billing provider.

EdgeKit connects Recurly for your organization. You give EdgeKit two things from your Recurly site:

  1. A private API key. EdgeKit reads your records with it. Checkout creates the Recurly account and the subscription with it, and the account page makes a user’s changes with it.
  2. A webhook endpoint’s signing secret. Add an endpoint in Recurly:
    • URL: https://<tenant>.edgekit.ai/v1/webhooks/recurly.
    • Format: JSON.

EdgeKit’s own pages need more from your Recurly site. Give EdgeKit the ones for the pages you use:

  • Your Recurly.js public key. The account page and checkout pages mount Recurly’s card fields with it. It is made for the browser and is not a secret. Without it, the account page shows no card form for a user subscription billed through Recurly, and a checkout page that sells through Recurly refuses.
  • Your Recurly site’s subdomain, the <subdomain> in <subdomain>.recurly.com. The account page builds each invoice’s receipt link from it. Without it, invoices are listed with no link. See Invoices.
  • Your merchant country, a two-letter country code in capitals such as US. Apple Pay and Google Pay on a checkout page need it. Without it, a Recurly checkout page shows neither.
  • Your Google merchant id. Google Pay on a checkout page needs it too. Without it, a Recurly checkout page shows no Google Pay. The rest of each wallet’s setup is in Payment methods.

Your Recurly site must be in Recurly’s US region. EdgeKit does not call Recurly’s EU region.

EdgeKit then reads your whole site once. From then on, each notification brings the one record that changed.

A notification tells EdgeKit which record changed. EdgeKit then reads that record’s current state from Recurly and copies it, so notifications that arrive twice or out of order change nothing extra.

EdgeKit checks the recurly-signature header against your endpoint’s signing secret, and refuses a signature more than 5 minutes old. While you roll the secret, a notification signed with either secret is accepted.

Notification EdgeKit answers
Signed, about a record EdgeKit reads 200
Signed, about any other record 200, ignored
Missing, invalid or stale signature 401
Body over 1 MiB 413
Not valid JSON 400
JSON without an id or object_type 422
EdgeKit holds no signing secret yet 503
EdgeKit could not take it in 500, so Recurly sends it again

EdgeKit acts on notifications about accounts, plans, subscriptions, invoices (charge and credit invoices included), dunning events, payments, transactions, coupons, gift cards and credit payments. A dunning event re-reads its invoice, and a payment its transaction.

In Recurly Billing provider screen and tab
Accounts, with their parent account Accounts
Plans (Base) and add-ons (Add-on) Pricing: Products, and each one’s prices in Prices
Coupons Pricing: Coupons
Subscriptions, with their add-ons Subscriptions: Subscriptions
A subscription’s pending change Subscriptions: Schedule
Invoices Invoicing: Invoices
Invoice line items Invoicing: Line items
Transactions Invoicing: Transactions
Tax on each invoice Invoicing: Tax, one row per invoice

An account Recurly marks active shows as Active, and any other as Closed. An account billed to its parent shows Bills to Parent account.

A pending change, such as a move to another Recurly plan at renewal, is one Schedule row of kind pending_change. Its Current phase window runs from the start of the current billing period to the day the change applies. Once the change applies or is removed, EdgeKit deletes the row the next time it reads the subscription.

The sync does not read billing info, so Payment methods lists only the cards users replaced on the account page, each as it was when replaced. The Usage tab is not filled from Recurly. EdgeKit does not read usage records, bulk unique coupon codes or per-jurisdiction tax details.

Recurly state Console status
future Pending
active Trialing while the trial runs, then Active
canceled Trialing or Active until it expires, Renewal Will not renew
failed Past due
paused Paused
expired Ended

A subscription Recurly is retrying a payment for stays active in Recurly. EdgeKit reads the unpaid invoice instead: see Access during dunning in How access follows your billing provider.

A checkout page is the alternative to building your own Recurly.js form. EdgeKit serves it on your site’s domain with Recurly’s card fields, and it buys through the same checkout, so it writes the same records in Recurly. Besides your public key, it needs the Recurly setup in Payment methods and Tax. The next two parts are for your own form only; What checkout writes in Recurly holds for both.

Load Recurly.js on your page with your Recurly public key, render its card fields, and tokenize them when the buyer selects Buy. Send the token id to checkout as recurlyTokenId. A token lives about 20 minutes and can be reused inside that time. Once it expires, checkout answers 409 card_token_expired: tokenize the card again.

Your Content Security Policy must allow script-src https://js.recurly.com, plus connect-src and frame-src for https://api.recurly.com.

When checkout answers 409 three_d_secure_required, run Recurly.js’s 3-D Secure challenge (recurly.Risk().ThreeDSecure) with details.threeDSecureActionTokenId. Then call checkout again with the same offerToken and recurlyTokenId, plus the challenge’s result token as threeDSecureActionResultTokenId.

  • An account whose account code is the buyer’s EdgeKit user id, with the email address the buyer typed. A returning buyer reuses the same account.
  • A subscription on the Recurly plan attached to the offer, in the currency the checkout names or else the site’s currency. The offer’s Prices section shows the plan code as Billing provider price.
  • The coupon code, when the offer has an introductory discount. Pick the coupon on the offer from the coupons the catalog sync brought in; EdgeKit refuses one that does not apply to the offer’s plan or can no longer be redeemed. An offer with a discount and no coupon code answers 409 offer_discount_unsupported.

The trial is the Recurly plan’s own trial. EdgeKit does not send the offer’s Trial days.

A declined card answers 422. The error’s code is Recurly’s own transaction error code, or declined, and its message is Recurly’s.

On the account page, a signed-in user changes their own user subscription, and EdgeKit makes the change in Recurly with your private API key:

EdgeKit updates its copy straight away. A cancel, an undone cancel or a new card is copied from Recurly’s answer. After a coupon or a move to another Recurly plan, EdgeKit reads the subscription again.

edgekit.ai