Recurring billing with trials, proration, and payment retries

After you create a subscription, Billing charges the customer on each billing date, prorates every change of plan, and retries any payment that fails.

Billing tracks each subscription from its trial to its cancellation

Billing charges each subscriber on the interval of their plan, whether that interval is monthly, yearly, or one that you define. When your code starts a trial or changes a plan, Billing works out the dates and the prorated amounts. Whenever a charge fails, Billing also follows the smart retry settings of your billing entity.

What Billing does over the life of a subscription

Recurring billing

Choose the interval for each plan. Billing charges the customer's payment method on file on every billing date and records the payment against the subscription.

Trial periods

Billing charges nothing during a free trial and moves the subscription onto the paid plan on the day that the trial ends.

Plan changes

Billing prorates an upgrade or a downgrade from the time left in the billing cycle, on whatever day the customer makes the change.

Usage-based billing

Bill for metered usage such as API calls, storage, or compute. Billing counts the usage as you report it and bills the total at the end of the period.

Dunning management

When a renewal payment fails, Billing schedules retries from the smart retry strategy that you choose and emails the customer about each one. Once the last retry fails, Billing starts a grace period, after which it cancels the subscription if the invoice is still unpaid.

Pause and resume

Pause a subscription for as long as the customer needs a break. When you resume it, Billing charges the same plan to the saved payment method, so the customer keeps the same subscription ID, plan, and card.

0
Retry jobs to build

Billing schedules every retry of a failed renewal

Automatic
Proration

Billing prorates each plan change, with an opt-out for any single change

< 1min
Billing cycle start

Target time from the create call to an active billing cycle

Build faster with solutions designed for real-world needs

Start a 14-day trial that converts to a paid plan on day 15

Create the subscription with the customer, the price, and a trial end date in one API call. Billing moves the subscription from trial to active when the first payment succeeds. If that payment and its retries fail, Billing moves the subscription to canceled under the rules that you configure.

Impact

In the sample, Ashglen Networks starts Jia on the Pro plan with a trial that ends 14 days after the call and with auto_renew turned on. The server action returns the trial end date that Billing sets, which the page passes to the account route.

Prompt for a coding agent: Start new customers on a 14-day Pro trial that renews automatically.

Conjoin IDE

Select a file to view its contents

Move a courier fleet to a larger plan in the middle of a cycle

Call updatePlans with the new price and the plan that it replaces. Billing credits the unused time on the old plan, charges for the time left on the new one, and settles the net amount according to the proration_behavior that you set.

Impact

In the sample, when a Strandline Couriers admin picks the Scale or the Fleet plan, the server function swaps that price in for the Starter plan with one call. The page then shows the new monthly total and the status that Billing returns.

Prompt for a coding agent: Let fleet admins move from Starter to Scale or Fleet, and show the new monthly total.

Conjoin IDE

Select a file to view its contents

Meter API calls by reporting each usage event

Send each usage event to Billing through the API as it happens. Billing adds up the events for each billing period, prices them per unit or in tiers, and puts any overage on the next invoice.

Impact

In the sample, the Mossbridge Software usage route rejects a negative quantity with a 400 and records valid usage against the API calls plan. The route then returns the total for the subscription, while the dashboard reads an entitlement check to show how many calls the plan includes in each period.

Prompt for a coding agent: Record each API call as usage, reject negative quantities, and show the calls that the plan includes.

Conjoin IDE

Select a file to view its contents

Retry a failed renewal and restore the subscription when a retry succeeds

Turn on smart retries for your billing entity, then set the strategy, the maximum number of retries, and the maximum number of days for retrying. Billing emails the customer after each failed charge with a request to update their card. As soon as a retry succeeds, Billing restores the subscription to active.

Impact

Billing schedules each retry and reactivates the subscription itself, so your code needs to check only the status of the subscription before it grants access.

Build your next app on Conjoin

Conjoin will open with a free Build tier, while the pricing page already lists the launch prices for Pro and Business. If you tell us what you're building, we'll talk you through early access.