Manually renew an existing subscription by generating a new recurring invoice and payment.
https://api.unibee.dev/merchant/subscription/renew
Manually renew an existing subscription by generating a new recurring invoice and payment.
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <your_api_key> |
Content-Type | Yes | application/json (for request body) |
| Name | Type | Required | Description |
|---|---|---|---|
applyPromoCredit | boolean | No | Optional. Whether to apply available promo credit to this renewal 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 renewal payment is cancelled or fails. |
discount | string | No | |
discountCode | string | No | Optional. Discount or coupon code applied only to this renewal. Overrides the subscription’s recurring discount for this invoice. |
gatewayId | integer | No | Optional. Payment gateway ID used for the renewal invoice. If omitted, the subscription’s original gateway configuration 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 renewal 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 renewal invoice and subscription timeline. |
paymentUIMode | string | No | Optional. Checkout UI mode: hosted | embedded | custom. Default is hosted. |
productData | string | No | |
productId | integer | No | 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. |
returnUrl | string | No | Optional. URL to redirect the customer to after successful renewal or payment completion. |
subscriptionId | string | No | 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 | No | Optional. External tax percentage override for the renewal invoice, in basis points (e.g. 1000 = 10%%). Overrides the subscription taxPercentage when provided. |
userId | integer | No | 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. |
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 renewal invoice generated by this request. |
data.link | string | Hosted payment or invoice link. When paid=false, redirect the customer to this link to complete the renewal payment. |
data.paid | boolean | Whether the renewal invoice has been successfully paid at the time of response. |
data.paymentId | string | ID of the payment created for the renewal invoice, if any. |
data.subscription | 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.
Manually renew an existing subscription by generating a new recurring invoice and payment.
Optional. Whether to apply available promo credit to this renewal 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 renewal payment is cancelled or fails.
Optional. Discount or coupon code applied only to this renewal. Overrides the subscription's recurring discount for this invoice.
Optional. Payment gateway ID used for the renewal invoice. If omitted, the subscription's original gateway configuration 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 renewal invoice; the invoice will be created in open status for manual collection.
Optional. Custom metadata map that will be stored on the renewal invoice and subscription timeline.
Optional. Checkout UI mode: hosted | embedded | custom. Default is hosted.
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.
Optional. URL to redirect the customer to after successful renewal or payment completion.
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.
Optional. External tax percentage override for the renewal invoice, in basis points (e.g. 1000 = 10%%). Overrides the subscription taxPercentage when provided.
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.