Proration charge setup for mid cycle membership upgrades
This guide will walk you through how to charge subscribers only for the portion of a billing cycle they use when a change happens mid-cycle, using either Loop's built-in membership upgrades or the Subscription Checkout API for a custom proration experience.
Overview
Proration lets you charge subscribers only for the portion of a billing cycle they actually use when a change happens mid-cycle. Loop supports two ways to implement this, depending on how much control you need over the experience.
Option 1: Membership upgrades (out of the box):
Membership upgrades is a built-in Loop feature that handles mid-cycle proration automatically when a subscriber upgrades to a higher-priced membership tier. No custom API logic is required on your end.
Loop calculates the prorated amount for the remaining billing period and charges it immediately at the time of upgrade. For full setup details, refer to the Membership upgrades guide.
Option 2: Custom proration using APIs and webhooks
Use this approach when you need full control over the proration logic, for example, when a subscriber adds a new product to an existing subscription mid-cycle and you want to charge only for the remaining days in that billing period.
Use case:
A subscription bills monthly on the 30th. A subscriber adds a new course on the 20th. You want to charge them only for the remaining 10 days for that course, then bill all items together from the 30th onward.
How it works
Loop supports this via the Subscription Checkout API. You trigger a mid-cycle charge for the newly added product and apply a discount that brings the charge down to the prorated amount. Loop handles the rest on the backend.
Implementation steps
Step 1: Listen to the subscription/updated webhook
subscription/updated webhookSet up a webhook listener for subscription/updated. This fires whenever a subscription is changed, including when a new product is added.
Step 2: Calculate the proration amount
From the webhook payload, identify the newly added product and calculate:
- The number of days remaining in the current billing cycle.
- The prorated charge for the new product based on those remaining days.
Step 3: Call the Subscription Checkout API
Use the Subscription Checkout API to charge the subscriber for the prorated amount.
Path param:
subscriptionId: The unique identifier for the subscription being charged.
Body params:
| Param | Description |
|---|---|
lines | The line item(s) added mid-cycle that need to be charged for the remaining billing period. |
manualDiscounts | A discount applied to the added line(s) to reduce the charge to the correct prorated amount. |
What Loop does on the backend
When the Checkout API is called, Loop processes the charge as follows:
- The newly added line is considered for billing.
- Existing subscription lines are temporarily excluded from this charge.
- The subscriber is charged only for the prorated amount of the new item.
The API returns a response indicating that the checkout is in progress.
After the charge is processed
Once the prorated charge goes through:
- The original subscription items are restored.
- The newly added item remains on the subscription.
- All items align to the same billing date going forward.
Outcome
| Result | Detail |
|---|---|
| Charge accuracy | Subscriber is charged only for the remaining cycle duration, not the full period. |
| No overcharging | Existing items are excluded from the mid-cycle charge. |
| Billing alignment | All items consolidate to the same next billing date. |
Choosing the right approach
| Membership upgrades | Custom API + webhooks | |
|---|---|---|
| Setup | Loop admin configuration only | Webhook listener + API integration required |
| Use case | Tiered membership plan upgrades | Adding products mid-cycle or custom proration logic |
| Proration calculation | Handled by Loop | Calculated on your end, applied via discount |
| Flexibility | Fixed to upgrade profiles | Fully customizable |
Use membership upgrades when you run tiered plans and want a no-code solution. Use the API approach when you need full control over what gets charged and how the proration is calculated.
Need help?
No worries - we're here for you! If you have any questions or need assistance, feel free to email us at [email protected] or chat with us using the support beacon at the bottom right of your screen. Regards, Loop subscriptions team 🙂
Updated 1 day ago