Preview the impact of changing a subscription’s plan, including proration calculations
curl --request POST \
--url https://api.cloud.flexprice.io/v1/subscriptions/{id}/change/preview \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"billing_cadence": "RECURRING",
"billing_cycle": "anniversary",
"billing_period": "MONTHLY",
"proration_behavior": "create_prorations",
"target_plan_id": "<string>",
"billing_period_count": 123,
"metadata": {}
}
'{
"change_type": "upgrade",
"current_plan": {
"description": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"name": "<string>"
},
"effective_date": "<string>",
"metadata": {},
"new_billing_cycle": {
"billing_anchor": "<string>",
"billing_cadence": "RECURRING",
"billing_period": "MONTHLY",
"billing_period_count": 123,
"period_end": "<string>",
"period_start": "<string>"
},
"next_invoice_preview": {
"currency": "<string>",
"due_date": "<string>",
"line_items": [
{
"amount": "<string>",
"description": "<string>",
"is_proration": true,
"period_end": "<string>",
"period_start": "<string>",
"quantity": "<string>",
"unit_price": "<string>"
}
],
"subtotal": "<string>",
"tax_amount": "<string>",
"total": "<string>"
},
"proration_details": {
"charge_amount": "<string>",
"charge_description": "<string>",
"credit_amount": "<string>",
"credit_description": "<string>",
"currency": "<string>",
"current_period_end": "<string>",
"current_period_start": "<string>",
"days_remaining": 123,
"days_used": 123,
"net_amount": "<string>",
"proration_date": "<string>"
},
"subscription_id": "<string>",
"target_plan": {
"description": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"name": "<string>"
},
"warnings": [
"<string>"
]
}Enter your API key in the format x-api-key <api-key>*
Subscription ID
Subscription change preview request
Request object for changing a subscription plan (upgrade/downgrade)
RECURRING, ONETIME anniversary, calendar MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY create_prorations, none target_plan_id is the ID of the new plan to change to (required)
billing_period_count is the billing period count for the new subscription
OK
Response showing the financial impact of a subscription plan change
upgrade, downgrade, lateral effective_date is when the change would take effect
Show child attributes
billing_anchor is the new billing anchor
RECURRING, ONETIME MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY billing_period_count is the billing period count
period_end is the end of the new billing period
period_start is the start of the new billing period
Show child attributes
currency is the currency for all amounts
due_date is when the invoice would be due
line_items contains preview of line items
Show child attributes
amount for this line item
description of the line item
is_proration indicates if this line item is a proration
period_end for this line item (if applicable)
period_start for this line item (if applicable)
quantity for this line item
unit_price for this line item
subtotal is the subtotal amount before taxes
tax_amount is the total tax amount
total is the total amount including taxes
Show child attributes
charge_amount is the charge amount for the new subscription
charge_description describes what the charge is for
credit_amount is the credit amount from the old subscription
credit_description describes what the credit is for
currency is the currency for all amounts
current_period_end is the end of the current billing period
current_period_start is the start of the current billing period
days_remaining is the number of days remaining in the current period
days_used is the number of days used in the current period
net_amount is the net amount (charge - credit)
proration_date is the date used for proration calculations
subscription_id is the ID of the subscription being changed
warnings contains any warnings about the change
curl --request POST \
--url https://api.cloud.flexprice.io/v1/subscriptions/{id}/change/preview \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"billing_cadence": "RECURRING",
"billing_cycle": "anniversary",
"billing_period": "MONTHLY",
"proration_behavior": "create_prorations",
"target_plan_id": "<string>",
"billing_period_count": 123,
"metadata": {}
}
'{
"change_type": "upgrade",
"current_plan": {
"description": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"name": "<string>"
},
"effective_date": "<string>",
"metadata": {},
"new_billing_cycle": {
"billing_anchor": "<string>",
"billing_cadence": "RECURRING",
"billing_period": "MONTHLY",
"billing_period_count": 123,
"period_end": "<string>",
"period_start": "<string>"
},
"next_invoice_preview": {
"currency": "<string>",
"due_date": "<string>",
"line_items": [
{
"amount": "<string>",
"description": "<string>",
"is_proration": true,
"period_end": "<string>",
"period_start": "<string>",
"quantity": "<string>",
"unit_price": "<string>"
}
],
"subtotal": "<string>",
"tax_amount": "<string>",
"total": "<string>"
},
"proration_details": {
"charge_amount": "<string>",
"charge_description": "<string>",
"credit_amount": "<string>",
"credit_description": "<string>",
"currency": "<string>",
"current_period_end": "<string>",
"current_period_start": "<string>",
"days_remaining": 123,
"days_used": 123,
"net_amount": "<string>",
"proration_date": "<string>"
},
"subscription_id": "<string>",
"target_plan": {
"description": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"name": "<string>"
},
"warnings": [
"<string>"
]
}