Skip to main content
POST
Renew Subscription Preview

Endpoint Overview

POST https://api.unibee.dev/merchant/subscription/renew_preview Preview renew invoice of an existing subscription.

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

Preview renew invoice of an existing subscription.

applyPromoCredit
boolean<*bool>

Optional. Whether to apply available promo credit to this renewal invoice.

applyPromoCreditAmount
integer<*int64>

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

discount
object
discountCode
string<string>

Optional. Discount or coupon code applied only to this renewal. Overrides the subscription's recurring discount for this invoice.

gatewayId
integer<*int64>

Optional. Payment gateway ID used for the renewal invoice. If omitted, the subscription's original gateway configuration is used.

gatewayPaymentType
string<string>

Optional. Payment type for the selected gateway, such as card, wallet, etc.

metadata
object

Optional. Custom metadata map that will be stored on the renewal invoice and subscription timeline.

productData
object
productId
integer<int64>

Optional. Product ID used together with userId when subscriptionId is not specified, to narrow down which subscription to renew. If 0, the system uses its default product selection rules.

renewMode
string<string>

Optional. Renewal period mode: next_period (default, start from the current period/trial end when renewing early) or reset_now (start a fresh cycle from now).

subscriptionId
string<string>

Optional. SubscriptionId to be renewed. Either subscriptionId or userId must be provided. When subscriptionId is omitted, the system first tries to find the latest active or incomplete subscription for the user (and productId if provided), otherwise falls back to the latest subscription.

taxPercentage
integer<*int64>

Optional. External tax percentage override for the renewal invoice, in basis points (e.g. 1000 = 10%%). Overrides the subscription taxPercentage when provided.

userId
integer<int64>

Optional. UserId associated with the subscription to renew. Either subscriptionId or userId must be provided. Used to locate the target subscription when subscriptionId is not provided.

Response

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