> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unibee.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Renew Subscription Preview

> Preview renew invoice of an existing subscription.

## 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.

| 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

```bash theme={null}
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

```bash theme={null}
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 with `code`, `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.                                        |

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


## OpenAPI

````yaml post /merchant/subscription/renew_preview
openapi: 3.0.0
info:
  description: UniBee Api Server
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: OpenAPI UniBee
  version: daily,buildtime:202603161017
servers:
  - url: https://api.unibee.dev
  - url: https://api-sandbox.unibee.top
security:
  - Authorization: []
paths:
  /merchant/subscription/renew_preview:
    post:
      tags:
        - Subscription Update
      summary: Renew Subscription Preview
      description: Preview renew invoice of an existing subscription.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/unibee.api.merchant.subscription.RenewPreviewReq
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      applyPromoCredit:
                        description: >-
                          Whether promo credit is effectively applied in this
                          renew preview.
                        format: bool
                        properties: {}
                        type: boolean
                      currency:
                        description: Currency used for the renew preview.
                        format: string
                        properties: {}
                        type: string
                      discountAmount:
                        description: >-
                          Total discount amount applied to the renew invoice,
                          including promo credit if applicable.
                        format: int64
                        properties: {}
                        type: integer
                      invoice:
                        $ref: '#/components/schemas/unibee.api.bean.Invoice'
                      originAmount:
                        description: >-
                          Original invoice amount before discounts and promo
                          credits for the renew, in minor units.
                        format: int64
                        properties: {}
                        type: integer
                      subscription:
                        $ref: '#/components/schemas/unibee.api.bean.Subscription'
                      taxAmount:
                        description: >-
                          Total tax amount applied to the renew invoice, in
                          minor units.
                        format: int64
                        properties: {}
                        type: integer
                      totalAmount:
                        description: >-
                          Final payable amount for the renew invoice, including
                          tax and after discounts, in minor units.
                        format: int64
                        properties: {}
                        type: integer
                    type: object
                  merchantId:
                    format: int64
                    properties: {}
                    type: integer
                  message:
                    format: string
                    properties: {}
                    type: string
                  redirect:
                    format: string
                    properties: {}
                    type: string
                  requestId:
                    format: string
                    properties: {}
                    type: string
                type: object
          description: ''
components:
  schemas:
    unibee.api.merchant.subscription.RenewPreviewReq:
      description: Preview renew invoice of an existing subscription.
      properties:
        applyPromoCredit:
          description: >-
            Optional. Whether to apply available promo credit to this renewal
            invoice.
          format: '*bool'
          properties: {}
          type: boolean
        applyPromoCreditAmount:
          description: >-
            Optional. Maximum promo credit amount to apply. If omitted and
            applyPromoCredit is true, the system auto-computes the usable
            amount.
          format: '*int64'
          properties: {}
          type: integer
        discount:
          $ref: '#/components/schemas/unibee.api.bean.ExternalDiscountParam'
        discountCode:
          description: >-
            Optional. Discount or coupon code applied only to this renewal.
            Overrides the subscription's recurring discount for this invoice.
          format: string
          properties: {}
          type: string
        gatewayId:
          description: >-
            Optional. Payment gateway ID used for the renewal invoice. If
            omitted, the subscription's original gateway configuration is used.
          format: '*int64'
          properties: {}
          type: integer
        gatewayPaymentType:
          description: >-
            Optional. Payment type for the selected gateway, such as card,
            wallet, etc.
          format: string
          properties: {}
          type: string
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          description: >-
            Optional. Custom metadata map that will be stored on the renewal
            invoice and subscription timeline.
          format: map[string]interface {}
          properties: {}
          type: object
        productData:
          $ref: '#/components/schemas/unibee.api.bean.PlanProductParam'
        productId:
          description: >-
            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.
          format: int64
          properties: {}
          type: integer
        subscriptionId:
          description: >-
            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.
          format: string
          properties: {}
          type: string
        taxPercentage:
          description: >-
            Optional. External tax percentage override for the renewal invoice,
            in basis points (e.g. 1000 = 10%%). Overrides the subscription
            taxPercentage when provided.
          format: '*int64'
          properties: {}
          type: integer
        userId:
          description: >-
            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.
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.Invoice:
      properties:
        PaymentMethodId:
          format: string
          properties: {}
          type: string
        autoCharge:
          format: bool
          properties: {}
          type: boolean
        billingCycleAnchor:
          description: billing_cycle_anchor
          format: int64
          properties: {}
          type: integer
        bizType:
          description: biz type from payment 1-onetime payment, 3-subscription
          format: int
          properties: {}
          type: integer
        countryCode:
          format: string
          properties: {}
          type: string
        createFrom:
          description: create from
          format: string
          properties: {}
          type: string
        creditAccount:
          $ref: '#/components/schemas/unibee.api.bean.CreditAccount'
        creditPayout:
          $ref: '#/components/schemas/unibee.api.bean.CreditPayout'
        cryptoAmount:
          description: crypto_amount, cent
          format: int64
          properties: {}
          type: integer
        cryptoCurrency:
          description: crypto_currency
          format: string
          properties: {}
          type: string
        currency:
          format: string
          properties: {}
          type: string
        data:
          format: string
          properties: {}
          type: string
        dayUtilDue:
          description: day util due after finish
          format: int64
          properties: {}
          type: integer
        discount:
          $ref: '#/components/schemas/unibee.api.bean.MerchantDiscountCode'
        discountAmount:
          format: int64
          properties: {}
          type: integer
        discountCode:
          format: string
          properties: {}
          type: string
        finishTime:
          format: int64
          properties: {}
          type: integer
        gatewayId:
          format: int64
          properties: {}
          type: integer
        id:
          format: int64
          properties: {}
          type: integer
        invoiceId:
          format: string
          properties: {}
          type: string
        invoiceName:
          format: string
          properties: {}
          type: string
        lines:
          format: '[]*bean.InvoiceItemSimplify'
          items:
            $ref: '#/components/schemas/unibee.api.bean.InvoiceItemSimplify'
          properties: {}
          type: array
        link:
          description: invoice link
          format: string
          properties: {}
          type: string
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          description: Metadata，Map
          format: map[string]interface {}
          properties: {}
          type: object
        originAmount:
          format: int64
          properties: {}
          type: integer
        partialCreditPaidAmount:
          description: partial credit paid amount
          format: int64
          properties: {}
          type: integer
        paymentId:
          description: paymentId
          format: string
          properties: {}
          type: string
        paymentLink:
          description: invoice payment link
          format: string
          properties: {}
          type: string
        paymentType:
          format: string
          properties: {}
          type: string
        periodEnd:
          format: int64
          properties: {}
          type: integer
        periodStart:
          format: int64
          properties: {}
          type: integer
        planSnapshot:
          $ref: '#/components/schemas/unibee.api.bean.InvoicePlanSnapshot'
        productName:
          format: string
          properties: {}
          type: string
        promoCreditAccount:
          $ref: '#/components/schemas/unibee.api.bean.CreditAccount'
        promoCreditDiscountAmount:
          description: promo credit discount amount
          format: int64
          properties: {}
          type: integer
        promoCreditPayout:
          $ref: '#/components/schemas/unibee.api.bean.CreditPayout'
        promoCreditTransaction:
          $ref: '#/components/schemas/unibee.api.bean.CreditTransaction'
        prorationDate:
          format: int64
          properties: {}
          type: integer
        prorationScale:
          format: int64
          properties: {}
          type: integer
        refundId:
          description: refundId
          format: string
          properties: {}
          type: string
        sendNote:
          description: send_note
          format: string
          properties: {}
          type: string
        sendStatus:
          description: email send status，0-No | 1- YES| 2-Unnecessary
          format: int
          properties: {}
          type: integer
        status:
          description: status，1-pending｜2-processing｜3-paid | 4-failed | 5-cancelled
          format: int
          properties: {}
          type: integer
        subscriptionAmount:
          format: int64
          properties: {}
          type: integer
        subscriptionAmountExcludingTax:
          format: int64
          properties: {}
          type: integer
        subscriptionId:
          description: subscription_id
          format: string
          properties: {}
          type: string
        taxAmount:
          format: int64
          properties: {}
          type: integer
        taxPercentage:
          description: TaxPercentage，1000 = 10%
          format: int64
          properties: {}
          type: integer
        totalAmount:
          format: int64
          properties: {}
          type: integer
        totalAmountExcludingTax:
          format: int64
          properties: {}
          type: integer
        trialEnd:
          description: trial_end, utc time
          format: int64
          properties: {}
          type: integer
        userId:
          description: UserId
          format: int64
          properties: {}
          type: integer
        userMetricChargeForInvoice:
          $ref: >-
            #/components/schemas/unibee.api.bean.UserMetricChargeInvoiceItemEntity
        vatNumber:
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.Subscription:
      properties:
        addonData:
          description: plan addon json data
          format: string
          properties: {}
          type: string
        amount:
          description: amount, cent
          format: int64
          properties: {}
          type: integer
        billingCycleAnchor:
          description: billing_cycle_anchor
          format: int64
          properties: {}
          type: integer
        cancelAtPeriodEnd:
          description: whether cancel at period end，0-false | 1-true
          format: int
          properties: {}
          type: integer
        cancelOrExpireTime:
          description: >-
            the cancel or expire time, utc time, 0 if subscription not in
            cancelled or expired status
          format: int64
          properties: {}
          type: integer
        cancelReason:
          format: string
          properties: {}
          type: string
        countryCode:
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency
          format: string
          properties: {}
          type: string
        currentPeriodEnd:
          description: current_period_end, utc time
          format: int64
          properties: {}
          type: integer
        currentPeriodPaid:
          description: current period paid or not, 1-paid, other-the utc time to expire
          format: int64
          properties: {}
          type: integer
        currentPeriodStart:
          description: current_period_start, utc time
          format: int64
          properties: {}
          type: integer
        defaultPaymentMethodId:
          format: string
          properties: {}
          type: string
        dunningTime:
          description: dunning_time, utc time
          format: int64
          properties: {}
          type: integer
        externalSubscriptionId:
          description: external_subscription_id
          format: string
          properties: {}
          type: string
        features:
          description: features
          format: string
          properties: {}
          type: string
        firstPaidTime:
          description: first success payment time
          format: int64
          properties: {}
          type: integer
        gasPayer:
          description: who pay the gas, merchant|user
          format: string
          properties: {}
          type: string
        gatewayId:
          description: gateway_id
          format: int64
          properties: {}
          type: integer
        gatewayStatus:
          description: >-
            gateway
            status，Stripe：https://stripe.com/docs/billing/subscriptions/webhooks 
            Paypal：https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_get
          format: string
          properties: {}
          type: string
        id:
          format: int64
          properties: {}
          type: integer
        lastUpdateTime:
          format: int64
          properties: {}
          type: integer
        latestInvoiceId:
          description: latest_invoice_id
          format: string
          properties: {}
          type: string
        link:
          format: string
          properties: {}
          type: string
        merchantId:
          description: merchant id
          format: int64
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        originalPeriodEnd:
          description: original_period_end, utc time
          format: int64
          properties: {}
          type: integer
        pendingUpdateId:
          format: string
          properties: {}
          type: string
        planId:
          description: plan id
          format: int64
          properties: {}
          type: integer
        productId:
          description: product id
          format: int64
          properties: {}
          type: integer
        quantity:
          description: quantity
          format: int64
          properties: {}
          type: integer
        returnUrl:
          format: string
          properties: {}
          type: string
        status:
          description: >-
            status，1-Pending｜2-Active｜3-PendingInActive | 4-Cancel | 5-Expire |
            6- Suspend| 7-Incomplete | 8-Processing | 9- Failed
          format: int
          properties: {}
          type: integer
        subscriptionId:
          description: subscription id
          format: string
          properties: {}
          type: string
        taskTime:
          description: task_time
          format: '*gtime.Time'
          properties: {}
          type: string
        taxPercentage:
          description: TaxPercentage，1000 = 10%
          format: int64
          properties: {}
          type: integer
        testClock:
          description: >-
            test_clock, simulator clock for subscription, if set , sub will out
            of cronjob controll
          format: int64
          properties: {}
          type: integer
        trialEnd:
          description: trial_end, utc time
          format: int64
          properties: {}
          type: integer
        type:
          description: sub type, 0-gateway sub, 1-unibee sub
          format: int
          properties: {}
          type: integer
        userId:
          description: userId
          format: int64
          properties: {}
          type: integer
        vatNumber:
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.ExternalDiscountParam:
      properties:
        cycleLimit:
          description: >-
            the count limitation of subscription recurring cycle, recurring need
            enable if cycleLimit set
          format: '*int'
          properties: {}
          type: integer
        discountAmount:
          description: Amount of discount
          format: '*int64'
          properties: {}
          type: integer
        discountPercentage:
          description: Percentage of discount, 100=1%, ignore if discountAmount set
          format: '*int64'
          properties: {}
          type: integer
        endTime:
          description: end of discount available utc time
          format: '*int64'
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          description: Metadata，Map
          format: map[string]interface {}
          properties: {}
          type: object
        recurring:
          description: Discount recurring enable, default false
          format: '*bool'
          properties: {}
          type: boolean
      type: object
    interface:
      properties: {}
      type: object
    unibee.api.bean.PlanProductParam:
      properties:
        description:
          description: Description
          format: string
          properties: {}
          type: string
        name:
          description: Name
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.CreditAccount:
      properties:
        amount:
          description: credit amount, in cent if type is main
          format: int64
          properties: {}
          type: integer
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency
          format: string
          properties: {}
          type: string
        currencyAmount:
          description: currency amount, in cent
          format: int64
          properties: {}
          type: integer
        exchangeRate:
          description: >-
            keep two decimal places，multiply by 100 saved, 1 currency = 1 credit
            * (exchange_rate/100), main account fixed rate to 100
          format: int64
          properties: {}
          type: integer
        id:
          description: Id
          format: int64
          properties: {}
          type: integer
        payoutEnable:
          description: 0-no, 1-yes
          format: int
          properties: {}
          type: integer
        rechargeEnable:
          description: 0-no, 1-yes
          format: int
          properties: {}
          type: integer
        totalDecrementAmount:
          description: the total decrement amount
          format: int64
          properties: {}
          type: integer
        totalIncrementAmount:
          description: the total increment amount
          format: int64
          properties: {}
          type: integer
        type:
          description: type of credit account, 1-main account, 2-gift account
          format: int
          properties: {}
          type: integer
        userId:
          description: user_id
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.CreditPayout:
      properties:
        creditAmount:
          description: credit amount, scale = 100
          format: int64
          properties: {}
          type: integer
        currencyAmount:
          description: currency amount,cent
          format: int64
          properties: {}
          type: integer
        exchangeRate:
          description: >-
            exchange rate, keep two decimal places，scale = 100, 1 currency = 1
            credit * (exchange_rate/100), main account fixed rate to 100
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.MerchantDiscountCode:
      properties:
        advance:
          description: >-
            AdvanceConfig, 0-false,1-true, will enable all advance config if set
            true
          format: bool
          properties: {}
          type: boolean
        billingType:
          description: billing_type, 1-one-time, 2-recurring
          format: int
          properties: {}
          type: integer
        code:
          description: code
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency of discount, available when discount_type is fixed_amount
          format: string
          properties: {}
          type: string
        cycleLimit:
          description: the count limitation of subscription cycle , 0-no limit
          format: int
          properties: {}
          type: integer
        discountAmount:
          description: amount of discount, available when discount_type is fixed_amount
          format: int64
          properties: {}
          type: integer
        discountPercentage:
          description: >-
            percentage of discount, 100=1%, available when discount_type is
            percentage
          format: int64
          properties: {}
          type: integer
        discountType:
          description: discount_type, 1-percentage, 2-fixed_amount
          format: int
          properties: {}
          type: integer
        endTime:
          description: end of discount available utc time, 0-invalid
          format: int64
          properties: {}
          type: integer
        id:
          description: Id
          format: int64
          properties: {}
          type: integer
        isDeleted:
          description: 0-UnDeleted，> 0, Deleted, the deleted utc time
          format: int
          properties: {}
          type: integer
        merchantId:
          description: merchantId
          format: int64
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        name:
          description: name
          format: string
          properties: {}
          type: string
        planApplyGroup:
          $ref: '#/components/schemas/unibee.api.bean.GroupPlanSelector'
        planApplyType:
          description: >-
            plan apply type, 0-apply for all, 1-apply for plans specified,
            2-exclude for plans specified, 3-Apply to Plans by Groups(Billing
            Period Included), 4-Apply to Plans except by Groups(Billing Period
            Included)
          format: int
          properties: {}
          type: integer
        planIds:
          description: >-
            Ids of plan which discount code can effect, default effect all plans
            if not set
          format: '[]int64'
          items:
            format: int64
            properties: {}
            type: integer
          properties: {}
          type: array
        quantity:
          description: quantity of code, 0-no limit
          format: int64
          properties: {}
          type: integer
        startTime:
          description: start of discount available utc time
          format: int64
          properties: {}
          type: integer
        status:
          description: status, 1-editable, 2-active, 3-deactivate, 4-expire, 10-archive
          format: int
          properties: {}
          type: integer
        upgradeLongerOnly:
          description: >-
            AdvanceConfig, 0-false,1-true, will forbid for all except upgrade to
            longer plan if set true
          format: bool
          properties: {}
          type: boolean
        upgradeOnly:
          description: >-
            AdvanceConfig, 0-false,1-true, will forbid for all except same
            interval upgrade action if set true
          format: bool
          properties: {}
          type: boolean
        userLimit:
          description: >-
            AdvanceConfig, The limit of every customer can apply, the recurring
            apply not involved, 0-unlimited
          format: int
          properties: {}
          type: integer
        userScope:
          description: >-
            AdvanceConfig, Apply user scope,0-for all, 1-for only new user,
            2-for only renewals, renewals is upgrade&downgrade&renew
          format: int
          properties: {}
          type: integer
      type: object
    unibee.api.bean.InvoiceItemSimplify:
      properties:
        amount:
          format: int64
          properties: {}
          type: integer
        amountExcludingTax:
          format: int64
          properties: {}
          type: integer
        currency:
          format: string
          properties: {}
          type: string
        description:
          format: string
          properties: {}
          type: string
        discountAmount:
          format: int64
          properties: {}
          type: integer
        discountCode:
          format: string
          properties: {}
          type: string
        fromAddress:
          $ref: '#/components/schemas/unibee.api.bean.USAddress'
        lineId:
          format: string
          properties: {}
          type: string
        metricCharge:
          $ref: '#/components/schemas/unibee.api.bean.UserMetricChargeInvoiceItem'
        name:
          format: string
          properties: {}
          type: string
        nexusAddresses:
          format: '[]*bean.USAddress'
          items:
            $ref: '#/components/schemas/unibee.api.bean.USAddress'
          properties: {}
          type: array
        originAmount:
          format: int64
          properties: {}
          type: integer
        originUnitAmountExcludeTax:
          format: int64
          properties: {}
          type: integer
        pdfDescription:
          format: string
          properties: {}
          type: string
        periodEnd:
          format: int64
          properties: {}
          type: integer
        periodStart:
          format: int64
          properties: {}
          type: integer
        plan:
          $ref: '#/components/schemas/unibee.api.bean.Plan'
        planMetricChargeConfigs:
          description: Metric charge configurations bound to this plan/addon
          format: '[]*bean.InvoiceMetricCharge'
          items:
            $ref: '#/components/schemas/unibee.api.bean.InvoiceMetricCharge'
          properties: {}
          type: array
        planMetricLimitConfigs:
          description: Metric limit configurations bound to this plan/addon
          format: '[]*bean.InvoiceMetricLimit'
          items:
            $ref: '#/components/schemas/unibee.api.bean.InvoiceMetricLimit'
          properties: {}
          type: array
        proration:
          format: bool
          properties: {}
          type: boolean
        prorationDate:
          format: int64
          properties: {}
          type: integer
        prorationScale:
          format: int64
          properties: {}
          type: integer
        quantity:
          format: int64
          properties: {}
          type: integer
        tax:
          format: int64
          properties: {}
          type: integer
        taxCode:
          format: string
          properties: {}
          type: string
        taxPercentage:
          description: Tax Percentage，1000 = 10%
          format: int64
          properties: {}
          type: integer
        toAddress:
          $ref: '#/components/schemas/unibee.api.bean.USAddress'
        unitAmountExcludingTax:
          format: int64
          properties: {}
          type: integer
        ustaxAlert:
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.InvoicePlanSnapshot:
      properties:
        addons:
          description: Addons associated with the current plan.
          format: '[]*bean.PlanAddonDetail'
          items:
            $ref: '#/components/schemas/unibee.api.bean.PlanAddonDetail'
          properties: {}
          type: array
        autoCharge:
          description: Billing charge
          format: bool
          properties: {}
          type: boolean
        chargeType:
          description: >-
            Billing charge type. 0: One-time, 1: New Subscription, 2: Upgrade,
            3: Downgrade, 4: Renewal, 5: Billing Cycle Charge.
          format: bean.InvoiceSnapshotChargeType
          properties: {}
          type: integer
        plan:
          $ref: '#/components/schemas/unibee.api.bean.Plan'
        previousAddons:
          description: >-
            Addons from the previous plan, relevant for upgrade or downgrade
            (paidType = 2 or 3).
          format: '[]*bean.PlanAddonDetail'
          items:
            $ref: '#/components/schemas/unibee.api.bean.PlanAddonDetail'
          properties: {}
          type: array
        previousPlan:
          $ref: '#/components/schemas/unibee.api.bean.Plan'
      type: object
    unibee.api.bean.CreditTransaction:
      properties:
        accountType:
          description: >-
            type of credit account, 1-main recharge account, 2-promo credit
            account
          format: int
          properties: {}
          type: integer
        bizId:
          description: business id
          format: string
          properties: {}
          type: string
        by:
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        creditAmountAfter:
          description: the credit amount after transaction,cent
          format: int64
          properties: {}
          type: integer
        creditAmountBefore:
          description: the credit amount before transaction,cent
          format: int64
          properties: {}
          type: integer
        creditId:
          description: id of credit account
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency
          format: string
          properties: {}
          type: string
        deltaAmount:
          description: delta amount,cent
          format: int64
          properties: {}
          type: integer
        deltaCurrencyAmount:
          description: delta currency amount, in cent
          format: int64
          properties: {}
          type: integer
        description:
          description: recharge transaction description
          format: string
          properties: {}
          type: string
        exchangeRate:
          description: >-
            ExchangeRate for transaction, keep two decimal places，multiply by
            100 saved, 1 currency = 1 credit * (exchange_rate/100), main account
            fixed rate to 100
          format: int64
          properties: {}
          type: integer
        id:
          description: Id
          format: int64
          properties: {}
          type: integer
        invoiceId:
          description: invoice_id
          format: string
          properties: {}
          type: string
        merchantId:
          description: merchant id
          format: int64
          properties: {}
          type: integer
        name:
          description: recharge transaction title
          format: string
          properties: {}
          type: string
        transactionId:
          description: unique id for timeline
          format: string
          properties: {}
          type: string
        transactionType:
          description: >-
            transaction type。1-recharge income，2-payment out，3-refund
            income，4-withdraw out，5-withdraw failed income, 6-admin
            change，7-recharge refund out
          format: int
          properties: {}
          type: integer
        userId:
          description: user_id
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.UserMetricChargeInvoiceItemEntity:
      properties:
        meteredChargeStats:
          description: MeteredChargeStats
          format: '[]*bean.UserMetricChargeInvoiceItem'
          items:
            $ref: '#/components/schemas/unibee.api.bean.UserMetricChargeInvoiceItem'
          properties: {}
          type: array
        recurringChargeStats:
          description: RecurringChargeStats
          format: '[]*bean.UserMetricChargeInvoiceItem'
          items:
            $ref: '#/components/schemas/unibee.api.bean.UserMetricChargeInvoiceItem'
          properties: {}
          type: array
      type: object
    unibee.api.bean.GroupPlanSelector:
      properties:
        currency:
          format: '[]string'
          items:
            format: string
            properties: {}
            type: string
          properties: {}
          type: array
        groupPlanIntervalSelector:
          format: '[]*bean.GroupPlanIntervalSelector'
          items:
            $ref: '#/components/schemas/unibee.api.bean.GroupPlanIntervalSelector'
          properties: {}
          type: array
        type:
          description: 1-main plan，2-addon plan,3-onetime
          format: '[]int'
          items:
            format: int
            properties: {}
            type: integer
          properties: {}
          type: array
      type: object
    unibee.api.bean.USAddress:
      properties:
        address:
          format: string
          properties: {}
          type: string
        city:
          format: string
          properties: {}
          type: string
        countryCode:
          format: string
          properties: {}
          type: string
        state:
          format: string
          properties: {}
          type: string
        verified:
          format: bool
          properties: {}
          type: boolean
        zipCode:
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.UserMetricChargeInvoiceItem:
      properties:
        CurrentUsedValue:
          description: CurrentUsedValue
          format: int64
          properties: {}
          type: integer
        chargePricing:
          $ref: '#/components/schemas/unibee.api.bean.PlanMetricMeteredChargeParam'
        description:
          description: Description
          format: string
          properties: {}
          type: string
        lines:
          description: Lines
          format: '[]*bean.MetricPlanChargeLine'
          items:
            $ref: '#/components/schemas/unibee.api.bean.MetricPlanChargeLine'
          properties: {}
          type: array
        maxEventId:
          format: int64
          properties: {}
          type: integer
        metricId:
          description: MetricId
          format: int64
          properties: {}
          type: integer
        minEventId:
          format: int64
          properties: {}
          type: integer
        name:
          description: Name
          format: string
          properties: {}
          type: string
        totalChargeAmount:
          description: TotalChargeAmount
          format: int64
          properties: {}
          type: integer
      required:
        - metricId
      type: object
    unibee.api.bean.Plan:
      properties:
        amount:
          description: amount, cent, without tax
          format: int64
          properties: {}
          type: integer
        bindingAddonIds:
          description: binded recurring addon planIds，split with ,
          format: string
          properties: {}
          type: string
        bindingOnetimeAddonIds:
          description: binded onetime addon planIds，split with ,
          format: string
          properties: {}
          type: string
        cancelAtTrialEnd:
          description: >-
            whether cancel at subscription first trial end，0-false | 1-true,
            will pass to cancelAtPeriodEnd of subscription
          format: int
          properties: {}
          type: integer
        checkoutUrl:
          description: CheckoutUrl
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency
          format: string
          properties: {}
          type: string
        description:
          description: description
          format: string
          properties: {}
          type: string
        disableAutoCharge:
          description: disable auto-charge, 0-false,1-true
          format: int
          properties: {}
          type: integer
        externalPlanId:
          description: external_user_id
          format: string
          properties: {}
          type: string
        extraMetricData:
          format: string
          properties: {}
          type: string
        gasPayer:
          description: who pay the gas, merchant|user
          format: string
          properties: {}
          type: string
        homeUrl:
          description: home_url
          format: string
          properties: {}
          type: string
        id:
          format: int64
          properties: {}
          type: integer
        imageUrl:
          description: image_url
          format: string
          properties: {}
          type: string
        internalName:
          description: PlanInternalName
          format: string
          properties: {}
          type: string
        intervalCount:
          description: period unit count
          format: int
          properties: {}
          type: integer
        intervalUnit:
          description: period unit,day|month|year|week
          format: string
          properties: {}
          type: string
        merchantId:
          description: merchant id
          format: int64
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        metricLimits:
          description: Plan's MetricLimit List
          format: '[]*bean.PlanMetricLimitParam'
          items:
            $ref: '#/components/schemas/unibee.api.bean.PlanMetricLimitParam'
          properties: {}
          type: array
        metricMeteredCharge:
          description: Plan's MetricMeteredCharge
          format: '[]*bean.PlanMetricMeteredChargeParam'
          items:
            $ref: '#/components/schemas/unibee.api.bean.PlanMetricMeteredChargeParam'
          properties: {}
          type: array
        metricRecurringCharge:
          description: Plan's MetricRecurringCharge
          format: '[]*bean.PlanMetricMeteredChargeParam'
          items:
            $ref: '#/components/schemas/unibee.api.bean.PlanMetricMeteredChargeParam'
          properties: {}
          type: array
        multiCurrencies:
          description: Plan's MultiCurrencies
          format: '[]*bean.PlanMultiCurrency'
          items:
            $ref: '#/components/schemas/unibee.api.bean.PlanMultiCurrency'
          properties: {}
          type: array
        planName:
          description: PlanName
          format: string
          properties: {}
          type: string
        productId:
          description: product id
          format: int64
          properties: {}
          type: integer
        publishStatus:
          description: 1-UnPublish,2-Publish, Use For Display Plan At UserPortal
          format: int
          properties: {}
          type: integer
        status:
          description: status，1-editing，2-active，3-inactive，4-soft archive, 5-hard archive
          format: int
          properties: {}
          type: integer
        taxPercentage:
          description: TaxPercentage 1000 = 10%
          format: int
          properties: {}
          type: integer
        trialAmount:
          description: price of trial period
          format: int64
          properties: {}
          type: integer
        trialDemand:
          format: string
          properties: {}
          type: string
        trialDurationTime:
          description: duration of trial
          format: int64
          properties: {}
          type: integer
        type:
          description: type，1-main plan，2-addon plan
          format: int
          properties: {}
          type: integer
        usVATConfig:
          $ref: '#/components/schemas/unibee.api.bean.USVATConfig'
      type: object
    unibee.api.bean.InvoiceMetricCharge:
      properties:
        chargeType:
          description: 'Charge type: 0-standard pricing, 1-graduated pricing'
          format: int
          properties: {}
          type: integer
        metricCode:
          description: Metric code
          format: string
          properties: {}
          type: string
        metricId:
          description: Metric ID
          format: int64
          properties: {}
          type: integer
        metricName:
          description: Metric name
          format: string
          properties: {}
          type: string
        metricType:
          description: 'Metric type: 2-charge_metered, 3-charge_recurring'
          format: int
          properties: {}
          type: integer
        standardAmount:
          description: Standard amount per unit (cent), used when chargeType=0
          format: int64
          properties: {}
          type: integer
        standardStartValue:
          description: Start value for standard pricing
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.InvoiceMetricLimit:
      properties:
        metricCode:
          description: Metric code
          format: string
          properties: {}
          type: string
        metricId:
          description: Metric ID
          format: int64
          properties: {}
          type: integer
        metricLimit:
          description: Limit value for this metric
          format: int64
          properties: {}
          type: integer
        metricName:
          description: Metric name
          format: string
          properties: {}
          type: string
        metricType:
          description: 'Metric type: 1-limit_metered, 4-limit_recurring'
          format: int
          properties: {}
          type: integer
      type: object
    unibee.api.bean.PlanAddonDetail:
      properties:
        addonPlan:
          $ref: '#/components/schemas/unibee.api.bean.Plan'
        quantity:
          description: Quantity
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.GroupPlanIntervalSelector:
      properties:
        intervalCount:
          description: 'Number Of IntervalUnit，em: day|month|year|week'
          format: int
          properties: {}
          type: integer
        intervalUnit:
          description: 'Plan Interval Unit，em: day|month|year|week'
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.PlanMetricMeteredChargeParam:
      properties:
        chargeType:
          description: ChargeType,0-standard pricing 1-graduated pricing
          format: int
          properties: {}
          type: integer
        graduatedAmounts:
          description: GraduatedAmounts, used for graduated pricing
          format: '[]*bean.MetricPlanChargeGraduatedStep'
          items:
            $ref: '#/components/schemas/unibee.api.bean.MetricPlanChargeGraduatedStep'
          properties: {}
          type: array
        metricId:
          description: MetricId
          format: int64
          properties: {}
          type: integer
        standardAmount:
          description: StandardAmount, cent, used for standard pricing,cent
          format: int64
          properties: {}
          type: integer
        standardStartValue:
          description: StandardStartValue, used for standard pricing
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.MetricPlanChargeLine:
      properties:
        amount:
          description: Amount,cent
          format: int64
          properties: {}
          type: integer
        flatAmount:
          description: FlatAmount,cent
          format: int64
          properties: {}
          type: integer
        quantity:
          description: Quantity
          format: int64
          properties: {}
          type: integer
        step:
          description: Step
          format: string
          properties: {}
          type: string
        unitAmount:
          description: UnitAmount,cent
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.PlanMetricLimitParam:
      properties:
        metricId:
          description: MetricId
          format: int64
          properties: {}
          type: integer
        metricLimit:
          description: MetricLimit
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.PlanMultiCurrency:
      properties:
        amount:
          description: the amount of exchange rate
          format: int64
          properties: {}
          type: integer
        autoExchange:
          description: >-
            using https://app.exchangerate-api.com/ to update exchange rate if
            true, the exchange APIKey need setup first
          format: bool
          properties: {}
          type: boolean
        currency:
          description: target currency
          format: string
          properties: {}
          type: string
        disable:
          description: disable currency exchange
          format: bool
          properties: {}
          type: boolean
        exchangeRate:
          description: exchange rate, no setup required if AutoExchange is true
          format: float64
          properties: {}
          type: number
      type: object
    unibee.api.bean.USVATConfig:
      properties:
        active:
          format: bool
          properties: {}
          type: boolean
        fromAddress:
          $ref: '#/components/schemas/unibee.api.bean.USAddress'
        nexusAddresses:
          format: '[]*bean.USAddress'
          items:
            $ref: '#/components/schemas/unibee.api.bean.USAddress'
          properties: {}
          type: array
        sellOnUSOnly:
          format: bool
          properties: {}
          type: boolean
        taxCode:
          format: string
          properties: {}
          type: string
        toAddress:
          $ref: '#/components/schemas/unibee.api.bean.USAddress'
      type: object
    unibee.api.bean.MetricPlanChargeGraduatedStep:
      properties:
        endValue:
          description: EndValue, -1 = infinity value(∞)
          format: int64
          properties: {}
          type: integer
        flatAmount:
          description: FlatAmount,cent
          format: int64
          properties: {}
          type: integer
        perAmount:
          description: PerAmount,cent
          format: int64
          properties: {}
          type: integer
        startValue:
          description: StartValue
          format: int64
          properties: {}
          type: integer
      type: object
  securitySchemes:
    Authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````