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

# New Subscription Onetime Addon Payment

> Create payment for subscription onetime addon purchase

## Endpoint Overview

**POST** `https://api.unibee.dev/merchant/subscription/new_onetime_addon_payment`

Create payment for subscription onetime addon purchase

***

## 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                                                                                                                                                            |
| ------------------------ | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `addonId`                | integer | Yes      | AddonId, id of one-time addon, the new payment will created base on the addon's amount'                                                                                |
| `applyPromoCredit`       | boolean | No       | apply promo credit or not                                                                                                                                              |
| `applyPromoCreditAmount` | integer | No       | apply promo credit amount, auto compute if not specified                                                                                                               |
| `cancelUrl`              | string  | No       | CancelUrl, back to cancelUrl if user cancel the payment                                                                                                                |
| `currency`               | string  | No       | The currency of payment                                                                                                                                                |
| `discountAmount`         | integer | No       | Amount of discount                                                                                                                                                     |
| `discountCode`           | string  | No       | DiscountCode                                                                                                                                                           |
| `discountPercentage`     | integer | No       | Percentage of discount, 100=1%, ignore if discountAmount specified                                                                                                     |
| `gatewayId`              | integer | No       | GatewayId, use user's gateway if not provide                                                                                                                           |
| `gatewayPaymentType`     | string  | No       | Gateway Payment Type                                                                                                                                                   |
| `metadata`               | object  | No       | Metadata，custom data                                                                                                                                                   |
| `quantity`               | integer | Yes      | Quantity, quantity of the new payment which one-time addon purchased                                                                                                   |
| `returnUrl`              | string  | No       | ReturnUrl, the addon's payment will redirect based on the returnUrl provided when it's back from gateway side                                                          |
| `subscriptionId`         | string  | No       | SubscriptionId, id of subscription which addon will attached, either SubscriptionId or UserId needed, The only one active subscription of userId will attach the addon |
| `taxPercentage`          | integer | No       | TaxPercentage，1000 = 10%, default user's taxPercentage if not specified                                                                                                |
| `userId`                 | integer | No       | UserId, either SubscriptionId or UserId needed, The only one active subscription will update if userId provide instead of subscriptionId                               |

***

## Request examples

### cURL

```bash theme={null}
curl -X POST "https://api.unibee.dev/merchant/subscription/new_onetime_addon_payment" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "addonId": 0,
  "applyPromoCredit": false,
  "applyPromoCreditAmount": 0,
  "cancelUrl": "https://example.com",
  "currency": "",
  "discountAmount": 0,
  "discountCode": "",
  "discountPercentage": 0,
  "gatewayId": 0,
  "gatewayPaymentType": "",
  "metadata": {},
  "quantity": 0,
  "returnUrl": "https://example.com",
  "subscriptionId": "id_example",
  "taxPercentage": 0,
  "userId": 0
}'
```

### Sandbox

```bash theme={null}
curl -X POST "https://api-sandbox.unibee.top/merchant/subscription/new_onetime_addon_payment" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "addonId": 0,
  "applyPromoCredit": false,
  "applyPromoCreditAmount": 0,
  "cancelUrl": "https://example.com",
  "currency": "",
  "discountAmount": 0,
  "discountCode": "",
  "discountPercentage": 0,
  "gatewayId": 0,
  "gatewayPaymentType": "",
  "metadata": {},
  "quantity": 0,
  "returnUrl": "https://example.com",
  "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.invoice`                  | object  |                                                                                                                                                                                    |
| `data.link`                     | string  | if automatic payment is false, Gateway Link will provided that manual payment needed                                                                                               |
| `data.paid`                     | boolean | true\|false,automatic payment is default behavior for one-time addon purchased, payment will create attach to the purchase, when payment is success, return false, otherwise false |
| `data.subscriptionOnetimeAddon` | object  |                                                                                                                                                                                    |
| `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/new_onetime_addon_payment
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/new_onetime_addon_payment:
    post:
      tags:
        - Subscription Payment
      summary: New Subscription Onetime Addon Payment
      description: Create payment for subscription onetime addon purchase
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/unibee.api.merchant.subscription.OnetimeAddonNewReq
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      invoice:
                        $ref: '#/components/schemas/unibee.api.bean.Invoice'
                      link:
                        description: >-
                          if automatic payment is false, Gateway Link will
                          provided that manual payment needed
                        format: string
                        properties: {}
                        type: string
                      paid:
                        description: >-
                          true|false,automatic payment is default behavior for
                          one-time addon purchased, payment will create attach
                          to the purchase, when payment is success, return
                          false, otherwise false
                        format: bool
                        properties: {}
                        type: boolean
                      subscriptionOnetimeAddon:
                        $ref: >-
                          #/components/schemas/unibee.api.bean.SubscriptionOnetimeAddon
                    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.OnetimeAddonNewReq:
      description: Create payment for subscription onetime addon purchase
      properties:
        addonId:
          description: >-
            AddonId, id of one-time addon, the new payment will created base on
            the addon's amount'
          format: int64
          properties: {}
          type: integer
        applyPromoCredit:
          description: apply promo credit or not
          format: '*bool'
          properties: {}
          type: boolean
        applyPromoCreditAmount:
          description: apply promo credit amount, auto compute if not specified
          format: '*int64'
          properties: {}
          type: integer
        cancelUrl:
          description: CancelUrl, back to cancelUrl if user cancel the payment
          format: string
          properties: {}
          type: string
        currency:
          description: The currency of payment
          format: string
          properties: {}
          type: string
        discountAmount:
          description: Amount of discount
          format: '*int64'
          properties: {}
          type: integer
        discountCode:
          description: DiscountCode
          format: string
          properties: {}
          type: string
        discountPercentage:
          description: Percentage of discount, 100=1%, ignore if discountAmount specified
          format: '*int64'
          properties: {}
          type: integer
        gatewayId:
          description: GatewayId, use user's gateway if not provide
          format: '*int64'
          properties: {}
          type: integer
        gatewayPaymentType:
          description: Gateway Payment Type
          format: string
          properties: {}
          type: string
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          description: Metadata，custom data
          format: map[string]interface {}
          properties: {}
          type: object
        quantity:
          description: Quantity, quantity of the new payment which one-time addon purchased
          format: int64
          properties: {}
          type: integer
        returnUrl:
          description: >-
            ReturnUrl, the addon's payment will redirect based on the returnUrl
            provided when it's back from gateway side
          format: string
          properties: {}
          type: string
        subscriptionId:
          description: >-
            SubscriptionId, id of subscription which addon will attached, either
            SubscriptionId or UserId needed, The only one active subscription of
            userId will attach the addon
          format: string
          properties: {}
          type: string
        taxPercentage:
          description: >-
            TaxPercentage，1000 = 10%, default user's taxPercentage if not
            specified
          format: '*int64'
          properties: {}
          type: integer
        userId:
          description: >-
            UserId, either SubscriptionId or UserId needed, The only one active
            subscription will update if userId provide instead of subscriptionId
          format: int64
          properties: {}
          type: integer
      required:
        - addonId
        - quantity
      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.SubscriptionOnetimeAddon:
      properties:
        addonId:
          description: onetime addonId
          format: int64
          properties: {}
          type: integer
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        id:
          description: id
          format: int64
          properties: {}
          type: integer
        invoiceId:
          description: invoice id
          format: string
          properties: {}
          type: string
        isDeleted:
          description: 0-UnDeleted，1-Deleted
          format: int
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        paymentId:
          description: PaymentId
          format: string
          properties: {}
          type: string
        paymentLink:
          description: PaymentLink
          format: string
          properties: {}
          type: string
        quantity:
          description: quantity
          format: int64
          properties: {}
          type: integer
        status:
          description: status, 1-create, 2-paid, 3-cancel, 4-expired
          format: int
          properties: {}
          type: integer
        subscriptionId:
          description: subscription_id
          format: string
          properties: {}
          type: string
      type: object
    interface:
      properties: {}
      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

````