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

# Update Merchant Subscription Config

## Endpoint Overview

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

Update Merchant Subscription Config

***

## 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                                                                                                                                              |
| ---------------------------------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `downgradeEffectImmediately`                   | boolean | No       | DowngradeEffectImmediately, Immediate Downgrade (by default, the downgrades takes effect at the end of the period ）                                      |
| `downgradeNonImmediatelyEffectBeforePeriodEnd` | integer | No       | DowngradeNonImmediatelyEffectBeforePeriodEnd, seconds, For non-immediate downgrade, can take effect before period end (default 30 minutes, 1800 seconds) |
| `gatewayVATRule`                               | array   | No       |                                                                                                                                                          |
| `incompleteExpireTime`                         | integer | No       | IncompleteExpireTime, seconds, Incomplete Status Duration(The period during which subscription remains in                                                |
| `invoiceEmail`                                 | boolean | No       | InvoiceEmail, Enable Invoice Email (Toggle to send invoice email to customers)                                                                           |
| `showZeroInvoice`                              | boolean | No       | ShowZeroInvoice, Display Invoices With Zero Amount (Invoice With Zero Amount will hidden in list by default)                                             |
| `tryAutomaticPaymentBeforePeriodEnd`           | integer | No       | TryAutomaticPaymentBeforePeriodEnd, Auto-charge Start Before Period End （Time Difference for Auto-Payment Activation Before Period End）                  |
| `upgradeProration`                             | boolean | No       | UpgradeProration, Prorated Upgrade Invoices(Upgrades will generate prorated invoice by default)                                                          |

***

## Request examples

### cURL

```bash theme={null}
curl -X POST "https://api.unibee.dev/merchant/subscription/config/update" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "downgradeEffectImmediately": false,
  "downgradeNonImmediatelyEffectBeforePeriodEnd": 0,
  "gatewayVATRule": [],
  "incompleteExpireTime": 0,
  "invoiceEmail": "user@example.com",
  "showZeroInvoice": false,
  "tryAutomaticPaymentBeforePeriodEnd": 0,
  "upgradeProration": false
}'
```

### Sandbox

```bash theme={null}
curl -X POST "https://api-sandbox.unibee.top/merchant/subscription/config/update" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "downgradeEffectImmediately": false,
  "downgradeNonImmediatelyEffectBeforePeriodEnd": 0,
  "gatewayVATRule": [],
  "incompleteExpireTime": 0,
  "invoiceEmail": "user@example.com",
  "showZeroInvoice": false,
  "tryAutomaticPaymentBeforePeriodEnd": 0,
  "upgradeProration": false
}'
```

***

## 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.config` | 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/config/update
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/config/update:
    post:
      tags:
        - Subscription Config
      summary: Update Merchant Subscription Config
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/unibee.api.merchant.subscription.ConfigUpdateReq
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      config:
                        $ref: >-
                          #/components/schemas/unibee.api.bean.SubscriptionConfig
                    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.ConfigUpdateReq:
      properties:
        downgradeEffectImmediately:
          description: >-
            DowngradeEffectImmediately, Immediate Downgrade (by default, the
            downgrades takes effect at the end of the period ）
          format: '*bool'
          properties: {}
          type: boolean
        downgradeNonImmediatelyEffectBeforePeriodEnd:
          description: >-
            DowngradeNonImmediatelyEffectBeforePeriodEnd, seconds, For
            non-immediate downgrade, can take effect before period end (default
            30 minutes, 1800 seconds)
          format: '*int64'
          properties: {}
          type: integer
        gatewayVATRule:
          format: '[]*bean.MerchantVatRule'
          items:
            $ref: '#/components/schemas/unibee.api.bean.MerchantVatRule'
          properties: {}
          type: array
        incompleteExpireTime:
          description: >-
            IncompleteExpireTime, seconds, Incomplete Status Duration(The period
            during which subscription remains in 
          format: '*int64'
          properties: {}
          type: integer
        invoiceEmail:
          description: >-
            InvoiceEmail, Enable Invoice Email (Toggle to send invoice email to
            customers)
          format: '*bool'
          properties: {}
          type: boolean
        showZeroInvoice:
          description: >-
            ShowZeroInvoice, Display Invoices With Zero Amount (Invoice With
            Zero Amount will hidden in list by default)
          format: '*bool'
          properties: {}
          type: boolean
        tryAutomaticPaymentBeforePeriodEnd:
          description: >-
            TryAutomaticPaymentBeforePeriodEnd, Auto-charge Start Before Period
            End （Time Difference for Auto-Payment Activation Before Period End）
          format: '*int64'
          properties: {}
          type: integer
        upgradeProration:
          description: >-
            UpgradeProration, Prorated Upgrade Invoices(Upgrades will generate
            prorated invoice by default)
          format: '*bool'
          properties: {}
          type: boolean
      type: object
    unibee.api.bean.SubscriptionConfig:
      properties:
        downgradeEffectImmediately:
          description: >-
            DowngradeEffectImmediately, whether subscription update should
            effect immediately or at period end, default at period end
          format: bool
          properties: {}
          type: boolean
        downgradeNonImmediatelyEffectBeforePeriodEnd:
          description: >-
            DowngradeNonImmediatelyEffectBeforePeriodEnd, for non-immediate
            downgrade, can take effect before period end (in seconds), default
            30 minutes (1800)
          format: int64
          properties: {}
          type: integer
        fiatExchangeApiKey:
          format: string
          properties: {}
          type: string
        gatewayVATRule:
          format: string
          properties: {}
          type: string
        incompleteExpireTime:
          description: IncompleteExpireTime, em.. default 1day for plan of month type
          format: int64
          properties: {}
          type: integer
        invoiceEmail:
          description: InvoiceEmail, whether to send invoice email to user, default yes
          format: bool
          properties: {}
          type: boolean
        invoicePdfGenerate:
          description: >-
            InvoicePdfGenerate, whether to generate invoice pdf to user, default
            yes
          format: bool
          properties: {}
          type: boolean
        showZeroInvoice:
          description: ShowZeroInvoice, show zero invoice or not, default no
          format: bool
          properties: {}
          type: boolean
        tryAutomaticPaymentBeforePeriodEnd:
          description: TryAutomaticPaymentBeforePeriodEnd, default 30 min
          format: int64
          properties: {}
          type: integer
        upgradeProration:
          description: >-
            UpgradeProration, whether subscription update generation proration
            invoice or not, default yes
          format: bool
          properties: {}
          type: boolean
      type: object
    unibee.api.bean.MerchantVatRule:
      properties:
        gatewayNames:
          format: string
          properties: {}
          type: string
        ignoreVatNumber:
          format: bool
          properties: {}
          type: boolean
        taxPercentage:
          format: '*int64'
          properties: {}
          type: integer
        validCountryCodes:
          format: string
          properties: {}
          type: string
      type: object
  securitySchemes:
    Authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````