What it does
Move the subscription to a new recurring plan and take an off-session charge immediately (e.g. a prorated upgrade difference). Only an active or past_due subscription can be upgraded, and only one upgrade can be in flight at a time.
The charge is attempted on the bound card right away. The new plan is applied atomically only when that charge succeeds — the response returns 202 Accepted with a pending invoice, and you learn the outcome from the subscription.charged + subscription.updated webhooks (success) or subscription.upgrade_failed (failure, plan unchanged).
Path
refRequired
The
provider_subscription_ref (path).intervalRequired
New recurring interval —
day / week / month / year.amountRequired
New recurring amount, charged from the next cycle onward.
charge_now_amountRequired
The amount to take immediately for the upgrade (e.g. the prorated difference). Send
0 to switch plans with no immediate charge.interval_count
Units per cycle for the new plan (default
1).plan_code, plan_name_en, plan_name_ar
Display / reconciliation metadata for the new plan.
Request schema
{
"interval": <string, enum>, // required — new recurring interval
"amount": <number, ≥ 0>, // required — new recurring amount
"charge_now_amount": <number, ≥ 0>, // required — taken immediately (0 = none)
"interval_count": <number, ≥ 1>, // optional — default 1
"plan_code": <string, ≤64>, // optional
"plan_name_en": <string, ≤120>, // optional
"plan_name_ar": <string, ≤120> // optional
}Response
data.upgrade_invoice_uuidstring, UUID
The pending upgrade invoice. Match it against the
invoice_uuid on the subscription.charged webhook to confirm settlement.data.upgrade_statusstring
Always
pending on this response — the plan has not changed yet. Wait for the webhook before treating the user as upgraded.error_code (on 4xx)string
SUBSCRIPTION_NOT_FOUND (404), UPGRADE_ALREADY_PENDING (409), SUBSCRIPTION_NOT_UPGRADABLE (422), INVALID_CHARGE_AMOUNT / INVALID_AMOUNT / INVALID_INTERVAL (422).Response schema
// 202 Accepted — upgrade charge initiated; plan applied on payment success.
// data is the full subscription object (see Get a subscription) with two
// extra keys while the upgrade is in flight:
{
"status": true,
"data": {
/* …all subscription fields… */
"status": "active", // still the OLD plan until the charge settles
"upgrade_invoice_uuid": "0193c7f0-aa11-7de4-9c0a-6b5f1e2d3c99",
"upgrade_status": "pending"
},
"message": "Upgrade charge initiated; applied on payment success"
}
// 404 SUBSCRIPTION_NOT_FOUND
// 409 UPGRADE_ALREADY_PENDING — an upgrade is already in flight
// 422 SUBSCRIPTION_NOT_UPGRADABLE — not active/past_due
// 422 INVALID_CHARGE_AMOUNT / INVALID_AMOUNT / INVALID_INTERVAL
{
"status": false,
"error_code": "UPGRADE_ALREADY_PENDING",
"message": "an upgrade is already pending for this subscription"
}Try it
Base URL
https://microservices.shoppinggate.app/mini-app-core/