This guide shows you how to implement self-service upgrades and downgrades using product groups in your application.Documentation Index
Fetch the complete documentation index at: https://docs.fynn.eu/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The upgrade/downgrade flow consists of three main steps:- Check eligibility - Get available change options for a subscription item
- Display options - Show the customer available upgrades/downgrades
- Apply change - Execute the selected package change
Prerequisites
Before implementing upgrades:- Create a Product Group with a tier for each package level
- Assign the product group to the subscription item via
PUT /subscription-items/{id}/product-group
Step 1: Get Change Options
Fetch available upgrade/downgrade options for a subscription item:Response
Response Fields
| Field | Description |
|---|---|
current | Currently active tier and price plan |
options | Available upgrade/downgrade options |
options[].isUpgrade | true if this is an upgrade |
options[].isDowngrade | true if this is a downgrade |
options[].changeTiming | When the change takes effect |
options[].creditType | How unused time is credited |
hasPendingChange | true if a change is already scheduled |
Step 2: Display Options to Customer
Use the response to build a selection UI:Step 3: Apply the Change
When the customer selects an option, apply the change:Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
subscriptionItem | string | Yes | UUID of the subscription item to change |
selectedPricePlan | string | No | UUID of the price plan. Only required if the tier has multiple price plans. In most cases, this can be omitted. |
quantity | integer | No | New quantity. Only applied if the tier allows quantity changes. |
sendInvoiceEmail | boolean | No | Send credit note via email (default: true) |
Response
Change Timing Behavior
Immediately
The change takes effect right away:- Current subscription item is ended
- Credit note is created (based on
creditType) - New subscription item is created and starts immediately
- New invoice is generated
End of Period
The change is scheduled for the next billing cycle:- Current subscription item continues until period end
- At period end, item switches to new product/plan
- No credit note is created
- Next invoice uses new pricing
Credit Types
WhenchangeTiming is immediately, a credit is issued based on creditType:
| Type | Formula | Example |
|---|---|---|
pro_rata | Price × (Days remaining / Days in period) | €29 × (15/30) = €14.50 |
full | Full period price | €29.00 |
last_invoiced | Amount from last invoice | Varies |
none | No credit | €0.00 |
Complete Example
Error Handling
| HTTP Status | Cause | Solution |
|---|---|---|
| 400 | Invalid request | Check required fields |
| 404 | Subscription item not found | Verify item UUID |
| 422 | Pending change exists | Wait for pending change to complete |
| 422 | Not eligible for change | Check tier eligibility settings |
Webhooks
Listen for these events to track changes:| Event | Description |
|---|---|
subscription.updated | Subscription items changed |
invoice.created | New invoice for upgraded subscription |
credit_note.created | Credit note for prorated amount |
Related Documentation
Product Groups
Set up product groups
Subscription Transitions
Manual transitions
Webhooks
Listen for events