Change plan
Flow
![](https://files.readme.io/8f62603-Billing_Page_Flow24.png)
Replacing an active subscription, an already purchase item, with a new subscription of another purchasable, for the same product.
Steps by step
Select a new plan
The user selects a new purchasable for an already purchased item, be it the main subscription, an app or alike.
Checkout form
The checkout forms present the user with the new purchasable details:
- Purchasable to be purchased
- Amount and price
- Payment terms
- Confirmation Call-to-Action (CTA)
The checkout form receives the following parameters:
- Current plan: The SKU of the purchasable (product and plan) the user wishes to cancel.
- Selected plan - The new plan to replace the current plan.
- Business UID: A unique identifier for the business, serving as an authorization token.
- Cancel URL (cu): A URL to redirect the user to in case of aborting the cancellation flow.
- Success URL (su): A URL to redirect the user to upon successful completion of the cancellation.
- Update payments - Once the user confirms the change, the billing app needs to instruct the billing system to update the charges accordingly.
- Expire old subscription - Expire the current subscription immediately
An example of a subscription expire API call:
curl --location --request PUT 'https://api.vcita.biz/business/subscriptionsmng/v1/subscriptions/{subscription id}' \
--header 'Authorization: Bearer {business API token}' \
--header 'Content-Type: application/json' \
--data '{
"subscription":
{
"purchase_state": "expired"
}
}'
Create new subscription
Call the Create Subscription API to create a new subscription corresponding to the newly selected plan
An example of how to call the Create Subscription API:
curl --location 'https://api.vcita.biz/business/subscriptionsmng/v1/subscriptions' \
--header 'Authorization: Bearer {Business API token}' \
--header 'Content-Type: application/json' \
--data '{
"business_uid":"{business uid}",
"subscription": {
"purchasable_price_uid": "{Selected purchasable id}"
}
}'
Example Response
{
"success": true,
"data": {
"subscription":
{
"is_active": true,
"uid": "123",
"display_name": "Platinum5",
"updated_at": "",
"created_at": "2024-07-31T06:36:30.828Z",
"purchasable_uid": "1234",
"purchase_state": "active",
"cancellation_date": "",
"expiration_date": "",
"buyer_uid": "12345",
"business_uid": "123456",
"purchase_price": 10,
"purchase_currency": "USD",
"payment_type": "monthly",
"bundled_from_subscription_uid": ""
}
}
}
```
Redirect to the Success URL
Following the creation of a new subscription, the user is redirected to the success URL to continue using the product.
Updated about 1 month ago