Upgrading or Downgrading Plans with API
Introduction
This guide explains how to implement subscription upgrade and downgrade functionality in your SaaS application using Fungies as your Merchant of Record payment solution. We'll cover both dashboard-based management and API-based implementation, with a focus on integrating this functionality into your existing SaaS application.
Prerequisites
Before implementing subscription upgrades and downgrades, ensure you have:
Created a subscription product in Fungies
Configured multiple plans with the same interval periods (days/weeks/months)
Generated API keys for programmatic access
Dashboard-Based Subscription Management
Upgrading or Downgrading Subscriptions Manually
We provide a straightforward way to manage subscriptions through the Dashboard:
Log in to your Fungies Dashboard
Navigate to the Subscriptions section
Find the customer's subscription you want to modify
Click on "Manage subscription"
Select a different plan from the dropdown menu
Confirm the change
When a subscription is upgraded or downgraded:
Customers receive an email with updated terms
If upgraded, they are charged a prorated amount for the difference
If downgraded, the amount is deducted from their next invoice
Important Considerations
Only plans with the same interval periods can be switched between (e.g., monthly to monthly)
Proration is handled automatically by Fungies
Changes take effect immediately or at the next billing cycle, depending on your configuration
API-Based Subscription Management
For a seamless experience within your SaaS application, you can implement subscription upgrades and downgrades programmatically using the Fungies API.
Update Subscription Endpoint
The key endpoint for managing subscription upgrades and downgrades is:
Required Headers
Request Body Parameters
Key parameters:
prorationBehavior: Controls how proration is handled
"none"
: No proration is calculated"create_prorations"
: Creates prorated credits or charges"always_invoice"
: Always generates an invoice for the proration
items: Array containing the new subscription plan details
name
: Display name of the planunitPrice
: Price in smallest currency unit (e.g., cents)currency
: Three-letter currency codequantity
: Number of unitsofferId
: Unique identifier of the plan/offer to upgrade/downgrade to
Retrieving Subscription Information
Before updating a subscription, you may need to retrieve the current subscription details:
This endpoint returns detailed information about the subscription, including its current plan, billing cycle, and status.
Handling Responses
A successful update will return a 200 status code with the updated subscription details. Error responses (400) will include information about what went wrong, such as invalid parameters or authentication issues.
Last updated