https://api.unibee.dev/merchant/subscription/update_submit
Update Subscription
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <your_api_key> |
Content-Type | Yes | application/json (for request body) |
| Name | Type | Required | Description |
|---|---|---|---|
addonParams | array | No | Optional. Target addon configuration after the update. |
applyPromoCredit | boolean | No | Optional. Whether to apply available promo credit when creating the update invoice. |
applyPromoCreditAmount | integer | No | Optional. Maximum promo credit amount to apply. If omitted and applyPromoCredit is true, the system auto-computes the usable amount. |
cancelUrl | string | No | Optional. URL to redirect the customer to when the customer cancels or the update payment fails. |
confirmCurrency | string | No | Optional. When provided, represents the expected currency code for the update invoice and must match the value returned from update_preview, otherwise the request is rejected. |
confirmTotalAmount | integer | No | Optional. When provided, represents the expected total amount (in minor units) for the update invoice and must match the value returned from update_preview, otherwise the request is rejected. |
currency | string | No | Optional. Target currency for the updated subscription. If not provided, use current subscription currency. Currency change is not allowed when a proration invoice is required. |
discount | string | No | |
discountCode | string | No | Optional. Discount or coupon code applied to this update. Overrides the subscription’s recurring discount for this invoice. |
effectImmediate | integer | No | Optional. Override for when to apply the plan change: 1 = immediate (current period, proration will be computed if needed), 2 = at next period (no proration in current period). If 0 or omitted, the system uses default rules (immediate for upgrades, merchant configuration for downgrades, and immediate for non-active subscriptions). |
gatewayId | integer | No | Optional. Gateway ID to be used for the invoice generated by this update. If omitted, the subscription’s current gateway is used. |
gatewayPaymentType | string | No | Optional. Payment type for the selected gateway, such as card, wallet, etc. |
manualPayment | boolean | No | Optional. If true, do not create an automatic payment for the update invoice; the invoice will be created in open status for manual collection. |
metadata | object | No | Optional. Custom metadata map that will be stored on the update invoice and subscription pending update record. |
newPlanId | integer | Yes | Required. Target plan ID to switch the subscription to. |
paymentUIMode | string | No | Optional. Checkout UI mode: hosted | embedded | custom. Default is hosted. |
productData | string | No | |
prorationDate | integer | No | Optional. UTC timestamp at which proration should start when effectImmediate = 1. Defaults to current time if not provided. |
quantity | integer | Yes | Required. Target quantity for the subscription after update. |
returnUrl | string | No | Optional. URL to redirect the customer to after the update is completed or payment succeeds. |
subscriptionId | string | No | Optional. SubscriptionId to be upgraded or downgraded. Either subscriptionId or userId must be provided. When userId is used instead of subscriptionId, the only active subscription of that user will be updated. |
taxPercentage | integer | No | Optional. External tax percentage override for the update invoice, in basis points (e.g. 1000 = 10%%). Overrides the subscription taxPercentage when provided. |
userId | integer | No | Optional. UserId associated with the subscription to update. Either subscriptionId or userId must be provided. When subscriptionId is omitted, the system uses this userId to locate the active subscription. |
code, data, message, redirect, and requestId. code 0 indicates success.
| Field | Type | Description |
|---|---|---|
code | integer | Response code. 0 = success |
data | object | Response payload |
data.action | object | |
data.invoiceId | string | ID of the invoice generated by this update (proration or next-period invoice, depending on effectImmediate). |
data.link | string | Hosted payment or invoice link. When paid=false and an invoice exists, redirect the customer to this link to complete payment. |
data.note | string | Additional message describing the update result, used for internal or merchant-facing explanations. |
data.paid | boolean | Whether the update invoice has been successfully paid at the time of response. |
data.paymentId | string | ID of the payment created for the update invoice, if any. |
data.subscriptionPendingUpdate | object | |
message | string | Human-readable message |
requestId | string | Request ID for support |
| HTTP status | Meaning |
|---|---|
| 400 | Bad request — invalid or missing parameters. Check message in the body. |
| 401 | Unauthorized — missing or invalid API key. |
| 404 | Not found — invalid path or resource. |
| 500 | Server error — retry with backoff. |
code in the response body is non-zero, check message for details. Use requestId when contacting support.Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Required. Target plan ID to switch the subscription to.
Required. Target quantity for the subscription after update.
Optional. Target addon configuration after the update.
Optional. Whether to apply available promo credit when creating the update invoice.
Optional. Maximum promo credit amount to apply. If omitted and applyPromoCredit is true, the system auto-computes the usable amount.
Optional. URL to redirect the customer to when the customer cancels or the update payment fails.
Optional. When provided, represents the expected currency code for the update invoice and must match the value returned from update_preview, otherwise the request is rejected.
Optional. When provided, represents the expected total amount (in minor units) for the update invoice and must match the value returned from update_preview, otherwise the request is rejected.
Optional. Target currency for the updated subscription. If not provided, use current subscription currency. Currency change is not allowed when a proration invoice is required.
Optional. Discount or coupon code applied to this update. Overrides the subscription's recurring discount for this invoice.
Optional. Override for when to apply the plan change: 1 = immediate (current period, proration will be computed if needed), 2 = at next period (no proration in current period). If 0 or omitted, the system uses default rules (immediate for upgrades, merchant configuration for downgrades, and immediate for non-active subscriptions).
Optional. Gateway ID to be used for the invoice generated by this update. If omitted, the subscription's current gateway is used.
Optional. Payment type for the selected gateway, such as card, wallet, etc.
Optional. If true, do not create an automatic payment for the update invoice; the invoice will be created in open status for manual collection.
Optional. Custom metadata map that will be stored on the update invoice and subscription pending update record.
Optional. Checkout UI mode: hosted | embedded | custom. Default is hosted.
Optional. UTC timestamp at which proration should start when effectImmediate = 1. Defaults to current time if not provided.
Optional. URL to redirect the customer to after the update is completed or payment succeeds.
Optional. SubscriptionId to be upgraded or downgraded. Either subscriptionId or userId must be provided. When userId is used instead of subscriptionId, the only active subscription of that user will be updated.
Optional. External tax percentage override for the update invoice, in basis points (e.g. 1000 = 10%%). Overrides the subscription taxPercentage when provided.
Optional. UserId associated with the subscription to update. Either subscriptionId or userId must be provided. When subscriptionId is omitted, the system uses this userId to locate the active subscription.