Regoria API docs

Subscriptions

A subscription bills a buyer on a schedule for a recurring price. Regoria runs the renewals, the retries on a failed card and the buyer emails; your server listens to the events and reads the subscription when it needs the current state.

Recurring prices

A product holds one-off and recurring prices side by side. A price of type: "recurring" carries its terms in a recurring block: interval (week, month or year), interval_count (1 to 52) and an optional trial: trial_interval (day, week, month or year) with trial_interval_count (a span of at most 365 days: 365 days, 52 weeks, 12 months or 1 year), and trial_price_cents. The trial ends on the calendar date it started plus that span, so a 1-month trial started on January 31 ends on February 28 (or 29). The terms have no retry schedule: every subscription follows your one retry schedule (see Renewals and dunning).

curl -X POST https://api.sandbox.staging.regoria.com/v1/prices \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"product_id": "prd_…", "type": "recurring", "amount_cents": 2900, "recurring": {"interval": "month", "interval_count": 1, "trial_interval": "day", "trial_interval_count": 14}}'

A price never changes once created: only its nickname and metadata are edited (PATCH /v1/prices/{price}). To change the amount, interval or trial, create a successor: POST /v1/prices with replaces_price_id archives the old price. With effective_at, the old price's subscribers move to the new price at their first renewal on or after it; a higher amount or a new interval needs your price-increase lead days and sends the buyer a notice. A changed trial applies to new buyers only. Archiving a price (POST /v1/prices/{price}/archive) stops new subscriptions on it; existing ones keep renewing. POST /v1/prices/{price}/unarchive restores a price that has no successor.

Starting one

A hosted checkout session with a recurring price starts the subscription when the buyer pays (order.paid for the first period, then subscription.started). The subscription record has status, current_period_start and current_period_end, next_charge_at, amount_cents, the saved payment_method_id, customer_ref and billing_mode.

Status

Status Meaning
trialing in the trial; the first payment comes at trial_end
active paid for the current period
past_due a renewal failed; retries follow your retry schedule (subscription.past_due)
paused not billing; resumes on request
cancelled ended (ended_at), or ending at the period end (cancel_at_period_end: true)

GET /v1/subscriptions/{subscription}/periods lists each period with its state, order, payment and dunning attempts.

Renewals and dunning

Each renewal creates an order (source: "renewal") and sends subscription.renewed with the new period. A failed renewal sends subscription.past_due, and the card is tried again on your one retry schedule, which every plan follows: 1 to 10 waits in whole hours (at most 21 days in total, 24, 48 and 48 hours by default), each counted from the previous failure, set in the dashboard under Settings → Subscriptions. The buyer is emailed to update the card (a hosted page; you need not build one). When the retries run out the subscription stays past_due with no further retry for a grace period you set from 0 to 7 days (7 by default) after the last retry; updating the card in that time takes the open period's payment and makes it active again, and otherwise it is canceled with cancel_source: "dunning" when the grace ends. A hard decline (a card that must not be retried) is canceled at once.

Changing the plan

A plan change moves the subscription to another recurring price by price_id: any active recurring price of yours in the subscription's currency, on any product (a monthly to yearly switch is the product's yearly price). It takes effect from the next period, without proration, an interval change included, and the buyer confirms it first:

curl -X POST https://api.sandbox.staging.regoria.com/v1/subscriptions/sub_…/change-plan \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"price_id": "prc_…"}'

Regoria emails the buyer a hosted confirmation link (valid 24 hours). When they accept, subscription.plan_change_scheduled is sent and the subscription's pending_price_id is set; at the period end subscription.plan_changed follows and the subscription's price_id and recurring block are the new price's. To show the link yourself instead of relying on the email, POST /v1/subscriptions/{subscription}/plan-change-confirmations returns it.

Currencies

A subscription renews in the currency the buyer signed up in, at the amount they signed up at. A change of the exchange rate never changes a renewal: only a price change you make (a new price version, with its notice) does. currency on the subscription is the buyer's currency; price_currency and price_amount_cents name the price side when it differs.

A plan change moves the buyer to the new price's amount in their own currency: the fixed amount you set in it, or the price converted with the rate of that day.

Pause and resume

POST /v1/subscriptions/{subscription}/pause pauses at the end of the paid period (pause_at; subscription.paused when it takes effect). POST /v1/subscriptions/{subscription}/resume cancels a scheduled pause, or, once paused, takes a payment now and starts a new period from today (it takes an Idempotency-Key).

Changing the card

POST /v1/subscriptions/{subscription}/payment-method with a payment_method_id of the same customer moves the renewals to that card (subscription.payment_method_changed). To let the buyer enter a new card, open a mode: "setup" checkout session with the subscription_id, or send them to the portal.

When the buyer clicks Update card on your site, call POST /v1/subscriptions/{subscription}/update-card-links (scope v1.subscriptions.write) and open the returned url for the buyer at once. The answer is 201 with {url, expires_at}: the link opens that subscription's card form with no sign-in, works once, and expires after 10 minutes; a second or late open shows the buyer an expired-link page. Each call mints a new link, so the route takes no Idempotency-Key. A paused, trialing or past-due subscription is accepted; a canceled one answers 422 validation on subscription. A subscription read, list or webhook carries no link: mint one when the buyer asks.

When the buyer saves a new card on a past_due subscription, the payment for its declined period is taken on that card at once, and the card-saved screen shows Paid with the amount or the decline, with Try another card. When the processor does not answer in time the screen says the payment is being confirmed, and the scheduled retry settles it; the result reaches you by webhook (subscription.renewed, or charge.declined) and the buyer by email. A subscription you bill yourself (billing_mode: merchant_managed) never takes a payment when the buyer saves a card.

Cancelling

curl -X POST https://api.sandbox.staging.regoria.com/v1/subscriptions/sub_…/cancel \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"immediately": false, "reason": "requested_by_customer"}'

immediately: false (the default) stops billing at the period end and the buyer keeps access until then; true ends it now. subscription.cancelled is sent when it ends. A refund of the current period is a separate call (Refunds and disputes).

Merchant-managed billing

A subscription with billing_mode: "merchant_managed" is billed on your schedule: Regoria keeps the card and the agreement, you call POST /v1/subscriptions/{subscription}/charge (with an Idempotency-Key) when a period is due. The answer is 200 with the subscription, or 202 while the payment is in review. Everything else (plan changes, cancellation, the portal) works the same.