Skip to main content
POST
Update Subscription Preview

Endpoint Overview

POST https://api.unibee.dev/merchant/subscription/update_preview Update Subscription Preview

Authorization

All UniBee Merchant API requests require authentication via API key.

Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

Request body


Request examples

cURL

Sandbox


Response

Success responses return a JSON envelope with code, data, message, redirect, and requestId. code 0 indicates success.

Error handling

When code in the response body is non-zero, check message for details. Use requestId when contacting support.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
newPlanId
integer<int64>
required

Required. Target plan ID to switch the subscription to.

subscriptionId
string<string>
required

Required. SubscriptionId to be upgraded or downgraded.

addonParams
object[]

Optional. Target addon configuration after the update.

applyPromoCredit
boolean<*bool>

Optional. Whether to apply available promo credit to the update preview.

applyPromoCreditAmount
integer<*int64>

Optional. Maximum promo credit amount to apply in preview. If omitted and applyPromoCredit is true, the system auto-computes the usable amount.

currency
string<*string>

Optional. Target currency for the updated subscription. If not provided, use current subscription currency. Currency change may be restricted when proration is required.

discountCode
string<string>

Optional. Discount code applied to the update preview.

effectImmediate
integer<int>

Optional. When to apply the plan change: 1 = immediate (current period, proration will be computed), 2 = at next period (no proration in current period).

gatewayId
integer<int64>

Optional. Gateway ID for previewing payment routing. If not provided, the subscription's current gateway is used for preview.

prorationDate
integer<*int64>

Optional. UTC timestamp at which proration should start when effectImmediate = 1. Defaults to current time if not provided.

quantity
integer<int64>

Optional. Target quantity for the subscription. If <= 0, it defaults to 1.

Response

200 - application/json
code
integer<int>
data
object
merchantId
integer<int64>
message
string<string>
redirect
string<string>
requestId
string<string>