Skip to content

Subscriptions: create, pause, renew and cancel

Describes Billing 0.28.0. On an older release? The version menu above has this guide as it was then.

A subscription ties a customer to a plan and its billing period. Billing keeps subscriptions in its own database and renews them itself; the payment providers only charge the saved payment method.

Where to find it

Open Billing, then Subscriptions, at /admin/billing/subscriptions. You need the Manage subscriptions permission.

The Subscriptions page with totals by status and no subscriptions yet The Subscriptions page with totals by status and no subscriptions yet

Subscriptions, none yet.

The list

The counters at the top show Total, Active, Trialing, Past Due and Cancelled. The tabs All, Active, Trialing, Past Due and Cancelled filter the table, and Search by email… finds a customer. A subscription set to end shows Cancels at end.

Each row has View, Edit and Cancel. Cancel here asks “Are you sure you want to cancel this subscription?” and ends the subscription at the end of its current period, not at once.

Manage Subscription Types opens the plans.

Creating a subscription by hand

New Subscription opens Create Subscription (“Manually create a subscription for a customer”).

  • Customer: search by email and pick the user. Change picks another.
  • Subscription Type: choose an active plan.
  • Start with trial period and Trial days: only when creating.
  • Payment Method (Optional): one of the customer’s saved payment methods, or No payment method. “Payment method is optional for manually created subscriptions.”

The Summary on the side shows what will be created. Create Subscription saves it as Trialing or Active.

The subscription page

The page shows the plan, the Billing Period (Period Start, Period End and days remaining), the Trial Period, a Grace Period when a payment failed (with the renewal attempts so far), Cancellation, the Customer, the Payment Method and Quick Info.

The buttons depend on the status:

  • Change Subscription Type (active or trialing): “Plan change takes effect immediately. The billing period will be adjusted.”
  • Pause and Resume.
  • Cancel at Period End: the subscription runs to the end of the period.
  • Cancel or Cancel Now: ends it immediately. Note that this differs from Cancel in the list, which waits for the period end.

Editing

Edit opens the form with Status & Period. Besides Pause, Resume and Cancel, it has Extend 30 days, which moves the period end forward by one billing period of the plan (30 days when there is no plan). A past-due subscription says “Payment overdue — renewal will be retried automatically”. Save Changes saves the form.

Renewals and failed payments

Renewals run once a day: Billing creates the period’s invoice and charges the saved payment method. When the charge fails, the subscription becomes Past Due and is retried during a grace period (3 days and 3 attempts by default). If it still fails, it is cancelled.

Subscribers who pay by invoice

A subscription with No payment method can be paid by bank transfer. At renewal Billing creates the period’s invoice and the subscription becomes Past Due until the invoice is paid. Record the payment with Record Payment on the invoice page: once the invoice is paid in full, the subscription moves on to its next period within seconds. A paid period is not cancelled, even at the last retry. While the invoice is unpaid, the daily retry counts no failed attempt, so the subscriber has the whole grace period to pay. A part payment doesn’t move the subscription on.

What it doesn’t do

  • Renewals run only when the host app schedules the daily renewal job.

For developers

Add the renewal worker to your Oban cron, for example {"0 6 * * *", PhoenixKitBilling.Workers.SubscriptionRenewalWorker}. The grace period and retry count are the settings billing_subscription_grace_days and billing_dunning_max_attempts.