curl --request POST \
--url https://api.unibee.dev/merchant/subscription/renew_preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"applyPromoCredit": true,
"applyPromoCreditAmount": 123,
"discount": {
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"endTime": 123,
"metadata": {},
"recurring": true
},
"discountCode": "<string>",
"gatewayId": 123,
"gatewayPaymentType": "<string>",
"metadata": {},
"productData": {
"description": "<string>",
"name": "<string>"
},
"productId": 123,
"renewMode": "<string>",
"subscriptionId": "<string>",
"taxPercentage": 123,
"userId": 123
}
'import requests
url = "https://api.unibee.dev/merchant/subscription/renew_preview"
payload = {
"applyPromoCredit": True,
"applyPromoCreditAmount": 123,
"discount": {
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"endTime": 123,
"metadata": {},
"recurring": True
},
"discountCode": "<string>",
"gatewayId": 123,
"gatewayPaymentType": "<string>",
"metadata": {},
"productData": {
"description": "<string>",
"name": "<string>"
},
"productId": 123,
"renewMode": "<string>",
"subscriptionId": "<string>",
"taxPercentage": 123,
"userId": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
applyPromoCredit: true,
applyPromoCreditAmount: 123,
discount: {
cycleLimit: 123,
discountAmount: 123,
discountPercentage: 123,
endTime: 123,
metadata: {},
recurring: true
},
discountCode: '<string>',
gatewayId: 123,
gatewayPaymentType: '<string>',
metadata: {},
productData: {description: '<string>', name: '<string>'},
productId: 123,
renewMode: '<string>',
subscriptionId: '<string>',
taxPercentage: 123,
userId: 123
})
};
fetch('https://api.unibee.dev/merchant/subscription/renew_preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.unibee.dev/merchant/subscription/renew_preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'applyPromoCredit' => true,
'applyPromoCreditAmount' => 123,
'discount' => [
'cycleLimit' => 123,
'discountAmount' => 123,
'discountPercentage' => 123,
'endTime' => 123,
'metadata' => [
],
'recurring' => true
],
'discountCode' => '<string>',
'gatewayId' => 123,
'gatewayPaymentType' => '<string>',
'metadata' => [
],
'productData' => [
'description' => '<string>',
'name' => '<string>'
],
'productId' => 123,
'renewMode' => '<string>',
'subscriptionId' => '<string>',
'taxPercentage' => 123,
'userId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.unibee.dev/merchant/subscription/renew_preview"
payload := strings.NewReader("{\n \"applyPromoCredit\": true,\n \"applyPromoCreditAmount\": 123,\n \"discount\": {\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"recurring\": true\n },\n \"discountCode\": \"<string>\",\n \"gatewayId\": 123,\n \"gatewayPaymentType\": \"<string>\",\n \"metadata\": {},\n \"productData\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"productId\": 123,\n \"renewMode\": \"<string>\",\n \"subscriptionId\": \"<string>\",\n \"taxPercentage\": 123,\n \"userId\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.unibee.dev/merchant/subscription/renew_preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"applyPromoCredit\": true,\n \"applyPromoCreditAmount\": 123,\n \"discount\": {\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"recurring\": true\n },\n \"discountCode\": \"<string>\",\n \"gatewayId\": 123,\n \"gatewayPaymentType\": \"<string>\",\n \"metadata\": {},\n \"productData\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"productId\": 123,\n \"renewMode\": \"<string>\",\n \"subscriptionId\": \"<string>\",\n \"taxPercentage\": 123,\n \"userId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unibee.dev/merchant/subscription/renew_preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"applyPromoCredit\": true,\n \"applyPromoCreditAmount\": 123,\n \"discount\": {\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"recurring\": true\n },\n \"discountCode\": \"<string>\",\n \"gatewayId\": 123,\n \"gatewayPaymentType\": \"<string>\",\n \"metadata\": {},\n \"productData\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"productId\": 123,\n \"renewMode\": \"<string>\",\n \"subscriptionId\": \"<string>\",\n \"taxPercentage\": 123,\n \"userId\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"data": {
"applyPromoCredit": true,
"currency": "<string>",
"discountAmount": 123,
"invoice": {
"PaymentMethodId": "<string>",
"autoCharge": true,
"billingCycleAnchor": 123,
"bizType": 123,
"countryCode": "<string>",
"createFrom": "<string>",
"creditAccount": {
"amount": 123,
"createTime": 123,
"currency": "<string>",
"currencyAmount": 123,
"exchangeRate": 123,
"id": 123,
"payoutEnable": 123,
"rechargeEnable": 123,
"totalDecrementAmount": 123,
"totalIncrementAmount": 123,
"type": 123,
"userId": 123
},
"creditPayout": {
"creditAmount": 123,
"currencyAmount": 123,
"exchangeRate": 123
},
"cryptoAmount": 123,
"cryptoCurrency": "<string>",
"currency": "<string>",
"data": "<string>",
"dayUtilDue": 123,
"discount": {
"advance": true,
"billingType": 123,
"code": "<string>",
"createTime": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"id": 123,
"isDeleted": 123,
"merchantId": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"status": 123,
"upgradeLongerOnly": true,
"upgradeOnly": true,
"userIds": [
123
],
"userLimit": 123,
"userScope": 123
},
"discountAmount": 123,
"discountCode": "<string>",
"finishTime": 123,
"gatewayId": 123,
"id": 123,
"invoiceId": "<string>",
"invoiceName": "<string>",
"lines": [
{
"amount": 123,
"amountExcludingTax": 123,
"currency": "<string>",
"description": "<string>",
"discountAmount": 123,
"discountCode": "<string>",
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"lineId": "<string>",
"metricCharge": {
"metricId": 123,
"CurrentUsedValue": 123,
"chargePricing": {
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
},
"description": "<string>",
"lines": [
{
"amount": 123,
"flatAmount": 123,
"quantity": 123,
"step": "<string>",
"unitAmount": 123
}
],
"maxEventId": 123,
"minEventId": 123,
"name": "<string>",
"totalChargeAmount": 123
},
"name": "<string>",
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"originAmount": 123,
"originUnitAmountExcludeTax": 123,
"pdfDescription": "<string>",
"periodEnd": 123,
"periodStart": 123,
"plan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"planMetricChargeConfigs": [
{
"chargeType": 123,
"metricCode": "<string>",
"metricId": 123,
"metricName": "<string>",
"metricType": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"planMetricLimitConfigs": [
{
"metricCode": "<string>",
"metricId": 123,
"metricLimit": 123,
"metricName": "<string>",
"metricType": 123
}
],
"proration": true,
"prorationDate": 123,
"prorationScale": 123,
"quantity": 123,
"tax": 123,
"taxCode": "<string>",
"taxPercentage": 123,
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"unitAmountExcludingTax": 123,
"ustaxAlert": "<string>"
}
],
"link": "<string>",
"metadata": {},
"originAmount": 123,
"paidTime": 123,
"partialCreditPaidAmount": 123,
"paymentId": "<string>",
"paymentLink": "<string>",
"paymentType": "<string>",
"periodEnd": 123,
"periodStart": 123,
"planSnapshot": {
"addons": [
{
"addonPlan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"quantity": 123
}
],
"autoCharge": true,
"chargeType": 123,
"multiCurrencySnapshot": {
"chargeCurrency": "<string>",
"rates": [
{
"from": "<string>",
"rate": 123,
"to": "<string>"
}
]
},
"plan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"previousAddons": [
{
"addonPlan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"quantity": 123
}
],
"previousPlan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
}
},
"productName": "<string>",
"promoCreditAccount": {
"amount": 123,
"createTime": 123,
"currency": "<string>",
"currencyAmount": 123,
"exchangeRate": 123,
"id": 123,
"payoutEnable": 123,
"rechargeEnable": 123,
"totalDecrementAmount": 123,
"totalIncrementAmount": 123,
"type": 123,
"userId": 123
},
"promoCreditDiscountAmount": 123,
"promoCreditPayout": {
"creditAmount": 123,
"currencyAmount": 123,
"exchangeRate": 123
},
"promoCreditTransaction": {
"accountType": 123,
"bizId": "<string>",
"by": "<string>",
"createTime": 123,
"creditAmountAfter": 123,
"creditAmountBefore": 123,
"creditId": 123,
"currency": "<string>",
"deltaAmount": 123,
"deltaCurrencyAmount": 123,
"description": "<string>",
"exchangeRate": 123,
"id": 123,
"invoiceId": "<string>",
"merchantId": 123,
"name": "<string>",
"transactionId": "<string>",
"transactionType": 123,
"userId": 123
},
"prorationDate": 123,
"prorationScale": 123,
"refundId": "<string>",
"sendNote": "<string>",
"sendStatus": 123,
"status": 123,
"subscriptionAmount": 123,
"subscriptionAmountExcludingTax": 123,
"subscriptionId": "<string>",
"taxAmount": 123,
"taxPercentage": 123,
"totalAmount": 123,
"totalAmountExcludingTax": 123,
"trialEnd": 123,
"userId": 123,
"userMetricChargeForInvoice": {
"meteredChargeStats": [
{
"metricId": 123,
"CurrentUsedValue": 123,
"chargePricing": {
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
},
"description": "<string>",
"lines": [
{
"amount": 123,
"flatAmount": 123,
"quantity": 123,
"step": "<string>",
"unitAmount": 123
}
],
"maxEventId": 123,
"minEventId": 123,
"name": "<string>",
"totalChargeAmount": 123
}
],
"recurringChargeStats": [
{
"metricId": 123,
"CurrentUsedValue": 123,
"chargePricing": {
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
},
"description": "<string>",
"lines": [
{
"amount": 123,
"flatAmount": 123,
"quantity": 123,
"step": "<string>",
"unitAmount": 123
}
],
"maxEventId": 123,
"minEventId": 123,
"name": "<string>",
"totalChargeAmount": 123
}
]
},
"vatNumber": "<string>"
},
"originAmount": 123,
"subscription": {
"addonData": "<string>",
"amount": 123,
"billingCycleAnchor": 123,
"cancelAtPeriodEnd": 123,
"cancelOrExpireTime": 123,
"cancelReason": "<string>",
"countryCode": "<string>",
"createTime": 123,
"currency": "<string>",
"currentPeriodEnd": 123,
"currentPeriodPaid": 123,
"currentPeriodStart": 123,
"defaultPaymentMethodId": "<string>",
"dunningTime": 123,
"externalSubscriptionId": "<string>",
"features": "<string>",
"firstPaidTime": 123,
"gasPayer": "<string>",
"gatewayId": 123,
"gatewayStatus": "<string>",
"id": 123,
"lastUpdateTime": 123,
"latestInvoiceId": "<string>",
"merchantId": 123,
"metadata": {},
"multiTrial": {
"currency": "<string>",
"currentIndex": 123,
"finished": true,
"planId": 123,
"regularPrice": 123,
"startedAt": 123,
"trials": [
{
"compareAtPrice": 123,
"duration": 123,
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"price": 123
}
],
"version": 123
},
"originalPeriodEnd": 123,
"pendingUpdateId": "<string>",
"planId": 123,
"productId": 123,
"quantity": 123,
"returnUrl": "<string>",
"status": 123,
"subscriptionId": "<string>",
"taskTime": "<string>",
"taxPercentage": 123,
"testClock": 123,
"trialEnd": 123,
"type": 123,
"userId": 123,
"vatNumber": "<string>"
},
"taxAmount": 123,
"totalAmount": 123
},
"merchantId": 123,
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Renew Subscription Preview
Preview renew invoice of an existing subscription.
curl --request POST \
--url https://api.unibee.dev/merchant/subscription/renew_preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"applyPromoCredit": true,
"applyPromoCreditAmount": 123,
"discount": {
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"endTime": 123,
"metadata": {},
"recurring": true
},
"discountCode": "<string>",
"gatewayId": 123,
"gatewayPaymentType": "<string>",
"metadata": {},
"productData": {
"description": "<string>",
"name": "<string>"
},
"productId": 123,
"renewMode": "<string>",
"subscriptionId": "<string>",
"taxPercentage": 123,
"userId": 123
}
'import requests
url = "https://api.unibee.dev/merchant/subscription/renew_preview"
payload = {
"applyPromoCredit": True,
"applyPromoCreditAmount": 123,
"discount": {
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"endTime": 123,
"metadata": {},
"recurring": True
},
"discountCode": "<string>",
"gatewayId": 123,
"gatewayPaymentType": "<string>",
"metadata": {},
"productData": {
"description": "<string>",
"name": "<string>"
},
"productId": 123,
"renewMode": "<string>",
"subscriptionId": "<string>",
"taxPercentage": 123,
"userId": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
applyPromoCredit: true,
applyPromoCreditAmount: 123,
discount: {
cycleLimit: 123,
discountAmount: 123,
discountPercentage: 123,
endTime: 123,
metadata: {},
recurring: true
},
discountCode: '<string>',
gatewayId: 123,
gatewayPaymentType: '<string>',
metadata: {},
productData: {description: '<string>', name: '<string>'},
productId: 123,
renewMode: '<string>',
subscriptionId: '<string>',
taxPercentage: 123,
userId: 123
})
};
fetch('https://api.unibee.dev/merchant/subscription/renew_preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.unibee.dev/merchant/subscription/renew_preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'applyPromoCredit' => true,
'applyPromoCreditAmount' => 123,
'discount' => [
'cycleLimit' => 123,
'discountAmount' => 123,
'discountPercentage' => 123,
'endTime' => 123,
'metadata' => [
],
'recurring' => true
],
'discountCode' => '<string>',
'gatewayId' => 123,
'gatewayPaymentType' => '<string>',
'metadata' => [
],
'productData' => [
'description' => '<string>',
'name' => '<string>'
],
'productId' => 123,
'renewMode' => '<string>',
'subscriptionId' => '<string>',
'taxPercentage' => 123,
'userId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.unibee.dev/merchant/subscription/renew_preview"
payload := strings.NewReader("{\n \"applyPromoCredit\": true,\n \"applyPromoCreditAmount\": 123,\n \"discount\": {\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"recurring\": true\n },\n \"discountCode\": \"<string>\",\n \"gatewayId\": 123,\n \"gatewayPaymentType\": \"<string>\",\n \"metadata\": {},\n \"productData\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"productId\": 123,\n \"renewMode\": \"<string>\",\n \"subscriptionId\": \"<string>\",\n \"taxPercentage\": 123,\n \"userId\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.unibee.dev/merchant/subscription/renew_preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"applyPromoCredit\": true,\n \"applyPromoCreditAmount\": 123,\n \"discount\": {\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"recurring\": true\n },\n \"discountCode\": \"<string>\",\n \"gatewayId\": 123,\n \"gatewayPaymentType\": \"<string>\",\n \"metadata\": {},\n \"productData\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"productId\": 123,\n \"renewMode\": \"<string>\",\n \"subscriptionId\": \"<string>\",\n \"taxPercentage\": 123,\n \"userId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unibee.dev/merchant/subscription/renew_preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"applyPromoCredit\": true,\n \"applyPromoCreditAmount\": 123,\n \"discount\": {\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"recurring\": true\n },\n \"discountCode\": \"<string>\",\n \"gatewayId\": 123,\n \"gatewayPaymentType\": \"<string>\",\n \"metadata\": {},\n \"productData\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"productId\": 123,\n \"renewMode\": \"<string>\",\n \"subscriptionId\": \"<string>\",\n \"taxPercentage\": 123,\n \"userId\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"data": {
"applyPromoCredit": true,
"currency": "<string>",
"discountAmount": 123,
"invoice": {
"PaymentMethodId": "<string>",
"autoCharge": true,
"billingCycleAnchor": 123,
"bizType": 123,
"countryCode": "<string>",
"createFrom": "<string>",
"creditAccount": {
"amount": 123,
"createTime": 123,
"currency": "<string>",
"currencyAmount": 123,
"exchangeRate": 123,
"id": 123,
"payoutEnable": 123,
"rechargeEnable": 123,
"totalDecrementAmount": 123,
"totalIncrementAmount": 123,
"type": 123,
"userId": 123
},
"creditPayout": {
"creditAmount": 123,
"currencyAmount": 123,
"exchangeRate": 123
},
"cryptoAmount": 123,
"cryptoCurrency": "<string>",
"currency": "<string>",
"data": "<string>",
"dayUtilDue": 123,
"discount": {
"advance": true,
"billingType": 123,
"code": "<string>",
"createTime": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"id": 123,
"isDeleted": 123,
"merchantId": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"status": 123,
"upgradeLongerOnly": true,
"upgradeOnly": true,
"userIds": [
123
],
"userLimit": 123,
"userScope": 123
},
"discountAmount": 123,
"discountCode": "<string>",
"finishTime": 123,
"gatewayId": 123,
"id": 123,
"invoiceId": "<string>",
"invoiceName": "<string>",
"lines": [
{
"amount": 123,
"amountExcludingTax": 123,
"currency": "<string>",
"description": "<string>",
"discountAmount": 123,
"discountCode": "<string>",
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"lineId": "<string>",
"metricCharge": {
"metricId": 123,
"CurrentUsedValue": 123,
"chargePricing": {
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
},
"description": "<string>",
"lines": [
{
"amount": 123,
"flatAmount": 123,
"quantity": 123,
"step": "<string>",
"unitAmount": 123
}
],
"maxEventId": 123,
"minEventId": 123,
"name": "<string>",
"totalChargeAmount": 123
},
"name": "<string>",
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"originAmount": 123,
"originUnitAmountExcludeTax": 123,
"pdfDescription": "<string>",
"periodEnd": 123,
"periodStart": 123,
"plan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"planMetricChargeConfigs": [
{
"chargeType": 123,
"metricCode": "<string>",
"metricId": 123,
"metricName": "<string>",
"metricType": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"planMetricLimitConfigs": [
{
"metricCode": "<string>",
"metricId": 123,
"metricLimit": 123,
"metricName": "<string>",
"metricType": 123
}
],
"proration": true,
"prorationDate": 123,
"prorationScale": 123,
"quantity": 123,
"tax": 123,
"taxCode": "<string>",
"taxPercentage": 123,
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"unitAmountExcludingTax": 123,
"ustaxAlert": "<string>"
}
],
"link": "<string>",
"metadata": {},
"originAmount": 123,
"paidTime": 123,
"partialCreditPaidAmount": 123,
"paymentId": "<string>",
"paymentLink": "<string>",
"paymentType": "<string>",
"periodEnd": 123,
"periodStart": 123,
"planSnapshot": {
"addons": [
{
"addonPlan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"quantity": 123
}
],
"autoCharge": true,
"chargeType": 123,
"multiCurrencySnapshot": {
"chargeCurrency": "<string>",
"rates": [
{
"from": "<string>",
"rate": 123,
"to": "<string>"
}
]
},
"plan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"previousAddons": [
{
"addonPlan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
},
"quantity": 123
}
],
"previousPlan": {
"amount": 123,
"autoChargeConfig": {
"autoChargeLeadTime": 123,
"autoChargeMaxRetryCount": 123,
"autoChargeRetryInterval": 123,
"incompleteExpireTime": 123
},
"autoUpgradePlanId": 123,
"bindingAddonIds": "<string>",
"bindingOnetimeAddonIds": "<string>",
"cancelAtTrialEnd": 123,
"checkoutTemplateId": 123,
"checkoutUrl": "<string>",
"compareAtAmount": 123,
"createTime": 123,
"currency": "<string>",
"description": "<string>",
"disableAutoCharge": 123,
"externalPlanId": "<string>",
"extraMetricData": "<string>",
"gasPayer": "<string>",
"homeUrl": "<string>",
"id": 123,
"imageUrl": "<string>",
"internalName": "<string>",
"intervalCount": 123,
"intervalUnit": "<string>",
"merchantId": 123,
"metadata": {},
"metricLimits": [
{
"metricId": 123,
"metricLimit": 123
}
],
"metricMeteredCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"metricRecurringCharge": [
{
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
}
],
"multiCurrencies": [
{
"amount": 123,
"autoExchange": true,
"currency": "<string>",
"disable": true,
"exchangeRate": 123,
"fixedAmount": 123
}
],
"multiTrials": [
{
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"trialCompareAtPrice": 123,
"trialDuration": 123,
"trialPrice": 123
}
],
"planName": "<string>",
"productId": 123,
"publishStatus": 123,
"status": 123,
"taxPercentage": 123,
"trialAmount": 123,
"trialDemand": "<string>",
"trialDurationTime": 123,
"type": 123,
"usVATConfig": {
"active": true,
"fromAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
},
"nexusAddresses": [
{
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
],
"sellOnUSOnly": true,
"taxCode": "<string>",
"toAddress": {
"address": "<string>",
"city": "<string>",
"countryCode": "<string>",
"state": "<string>",
"verified": true,
"zipCode": "<string>"
}
}
}
},
"productName": "<string>",
"promoCreditAccount": {
"amount": 123,
"createTime": 123,
"currency": "<string>",
"currencyAmount": 123,
"exchangeRate": 123,
"id": 123,
"payoutEnable": 123,
"rechargeEnable": 123,
"totalDecrementAmount": 123,
"totalIncrementAmount": 123,
"type": 123,
"userId": 123
},
"promoCreditDiscountAmount": 123,
"promoCreditPayout": {
"creditAmount": 123,
"currencyAmount": 123,
"exchangeRate": 123
},
"promoCreditTransaction": {
"accountType": 123,
"bizId": "<string>",
"by": "<string>",
"createTime": 123,
"creditAmountAfter": 123,
"creditAmountBefore": 123,
"creditId": 123,
"currency": "<string>",
"deltaAmount": 123,
"deltaCurrencyAmount": 123,
"description": "<string>",
"exchangeRate": 123,
"id": 123,
"invoiceId": "<string>",
"merchantId": 123,
"name": "<string>",
"transactionId": "<string>",
"transactionType": 123,
"userId": 123
},
"prorationDate": 123,
"prorationScale": 123,
"refundId": "<string>",
"sendNote": "<string>",
"sendStatus": 123,
"status": 123,
"subscriptionAmount": 123,
"subscriptionAmountExcludingTax": 123,
"subscriptionId": "<string>",
"taxAmount": 123,
"taxPercentage": 123,
"totalAmount": 123,
"totalAmountExcludingTax": 123,
"trialEnd": 123,
"userId": 123,
"userMetricChargeForInvoice": {
"meteredChargeStats": [
{
"metricId": 123,
"CurrentUsedValue": 123,
"chargePricing": {
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
},
"description": "<string>",
"lines": [
{
"amount": 123,
"flatAmount": 123,
"quantity": 123,
"step": "<string>",
"unitAmount": 123
}
],
"maxEventId": 123,
"minEventId": 123,
"name": "<string>",
"totalChargeAmount": 123
}
],
"recurringChargeStats": [
{
"metricId": 123,
"CurrentUsedValue": 123,
"chargePricing": {
"chargeType": 123,
"graduatedAmounts": [
{
"endValue": 123,
"flatAmount": 123,
"perAmount": 123,
"startValue": 123
}
],
"metricId": 123,
"standardAmount": 123,
"standardStartValue": 123
},
"description": "<string>",
"lines": [
{
"amount": 123,
"flatAmount": 123,
"quantity": 123,
"step": "<string>",
"unitAmount": 123
}
],
"maxEventId": 123,
"minEventId": 123,
"name": "<string>",
"totalChargeAmount": 123
}
]
},
"vatNumber": "<string>"
},
"originAmount": 123,
"subscription": {
"addonData": "<string>",
"amount": 123,
"billingCycleAnchor": 123,
"cancelAtPeriodEnd": 123,
"cancelOrExpireTime": 123,
"cancelReason": "<string>",
"countryCode": "<string>",
"createTime": 123,
"currency": "<string>",
"currentPeriodEnd": 123,
"currentPeriodPaid": 123,
"currentPeriodStart": 123,
"defaultPaymentMethodId": "<string>",
"dunningTime": 123,
"externalSubscriptionId": "<string>",
"features": "<string>",
"firstPaidTime": 123,
"gasPayer": "<string>",
"gatewayId": 123,
"gatewayStatus": "<string>",
"id": 123,
"lastUpdateTime": 123,
"latestInvoiceId": "<string>",
"merchantId": 123,
"metadata": {},
"multiTrial": {
"currency": "<string>",
"currentIndex": 123,
"finished": true,
"planId": 123,
"regularPrice": 123,
"startedAt": 123,
"trials": [
{
"compareAtPrice": 123,
"duration": 123,
"intervalCount": 123,
"intervalUnit": "<string>",
"metadata": {},
"name": "<string>",
"price": 123
}
],
"version": 123
},
"originalPeriodEnd": 123,
"pendingUpdateId": "<string>",
"planId": 123,
"productId": 123,
"quantity": 123,
"returnUrl": "<string>",
"status": 123,
"subscriptionId": "<string>",
"taskTime": "<string>",
"taxPercentage": 123,
"testClock": 123,
"trialEnd": 123,
"type": 123,
"userId": 123,
"vatNumber": "<string>"
},
"taxAmount": 123,
"totalAmount": 123
},
"merchantId": 123,
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Endpoint Overview
POSThttps://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.| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <your_api_key> |
Content-Type | Yes | application/json (for request body) |
Parameters
Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.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. |
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. |
metadata | object | No | Optional. Custom metadata map that will be stored on the renewal invoice and subscription timeline. |
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. |
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. |
Request examples
cURL
curl -X POST "https://api.unibee.dev/merchant/subscription/renew_preview" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"applyPromoCredit": false,
"applyPromoCreditAmount": 0,
"discount": "",
"discountCode": "",
"gatewayId": 0,
"gatewayPaymentType": "",
"metadata": {},
"productData": "",
"productId": 0,
"subscriptionId": "id_example",
"taxPercentage": 0,
"userId": 0
}'
Sandbox
curl -X POST "https://api-sandbox.unibee.top/merchant/subscription/renew_preview" \
-H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"applyPromoCredit": false,
"applyPromoCreditAmount": 0,
"discount": "",
"discountCode": "",
"gatewayId": 0,
"gatewayPaymentType": "",
"metadata": {},
"productData": "",
"productId": 0,
"subscriptionId": "id_example",
"taxPercentage": 0,
"userId": 0
}'
Response
Success responses return a JSON envelope withcode, data, message, redirect, and requestId. code 0 indicates success.
| Field | Type | Description |
|---|---|---|
code | integer | Response code. 0 = success |
data | object | Response payload |
data.applyPromoCredit | boolean | Whether promo credit is effectively applied in this renew preview. |
data.currency | string | Currency used for the renew preview. |
data.discountAmount | integer | Total discount amount applied to the renew invoice, including promo credit if applicable. |
data.invoice | object | |
data.originAmount | integer | Original invoice amount before discounts and promo credits for the renew, in minor units. |
data.subscription | object | |
data.taxAmount | integer | Total tax amount applied to the renew invoice, in minor units. |
data.totalAmount | integer | Final payable amount for the renew invoice, including tax and after discounts, in minor units. |
message | string | Human-readable message |
requestId | string | Request ID for support |
Error handling
| 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.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Preview renew invoice of an existing subscription.
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.
Show child attributes
Show child attributes
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. Custom metadata map that will be stored on the renewal invoice and subscription timeline.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
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. 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).
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.

