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

# Subscription update



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/subscription/update
openapi: 3.1.0
info:
  title: acquiring-order
  description: 接口文档
  termsOfService: https://www.waffo.com
  version: 1.0.0
servers: []
security: []
tags:
  - name: Subscription inquiry
    description: Subscription inquiry api description
  - name: Subscription manage
    description: >
      This API allows the merchant to request a subscription management URL from
      Waffo

      Waffo will generate a subscription management URL which merchant can
      redirect user to this URL for managing subscription details (e.g. view
      subscription detail and cancel subscription). This management URL has a
      fixed expiration time (e.g., 1 day).
  - name: Chargeback list
    description: Chargeback list api description
  - name: Payout create
    description: Payout create api description
  - name: Subscription change inquiry
    description: >
      This API allows merchants to query the status of a subscription change
      (upgrade/downgrade) request.

      此接口允许商户查询订阅升降级请求的状态。
  - name: Chargeback file download
    description: Chargeback file download api description
  - name: Subscription change
    description: >
      This API allows merchants to upgrade or downgrade a user's subscription
      plan. The change request will create a new subscription based on the
      original subscription, applying any remaining amount from the original
      subscription.


      此接口允许商户升级或降级用户的订阅计划。升降级请求将基于原订阅创建新订阅，并将原订阅的剩余金额应用到新订阅中。
  - name: Chargeback accept
    description: Chargeback accept api description
  - name: Subscription update
    description: ' Subscription update api description'
  - name: Chargeback file upload
    description: Chargeback file upload api description
  - name: Chargeback update
    description: Chargeback update api description
  - name: Wallet inquiry
    description: Wallet inquiry api description
  - name: Order inquiry
    description: Order inquiry api description
  - name: Order refund
    description: Order refund api description
  - name: Payout inquiry
    description: Payout inquiry api description
  - name: Order create
    description: ' Order create api description'
  - name: Pay Method Config Inquiry
    description: Pay Method Config Inquiry api description
  - name: Refund inquiry
    description: Refund inquiry api description
  - name: Subscription cancel
    description: >
      Cancel an active subscription when the merchant no longer wishes to
      continue the recurring billing cycle. This endpoint can only be invoked
      when the subscription status is active
  - name: Merchant config inquiry
    description: Merchant config inquiry api description
  - name: Order cancel
    description: Order cancel api description
  - name: Chargeback inquiry
    description: Chargeback inquiry api description
  - name: Subscription create
    description: Subscription create api description
paths:
  /api/v1/subscription/update:
    post:
      tags:
        - Subscription update
      summary: Subscription update
      operationId: subscriptionUpdate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionUpdateRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ResponseSubscriptionUpdateResponse'
components:
  schemas:
    SubscriptionUpdateRequest:
      type: object
      description: Provide subscriptionRequest or subscriptionId
      properties:
        subscriptionRequest:
          type: string
          description: >-
            Merchant subscription request ID (provide subscriptionRequest or
            subscriptionId)
          example: <subscriptionRequest>
          maxLength: 32
          minLength: 0
        subscriptionId:
          type: string
          description: >-
            Waffo subscription Id (provide subscriptionRequest or
            subscriptionId)
          example: <subscriptionId>
          maxLength: 64
          minLength: 0
        amount:
          type: string
          description: >-
            Merchant subscription amount, for example 100. At least one of
            amount, productInfo.trialPeriodAmount, and
            productInfo.scheduledAmounts must be provided.
          example: 100
          maxLength: 24
          minLength: 0
        productInfo:
          $ref: '#/components/schemas/SubscriptionUpdateRequest.ProductInfo'
          description: Subscription product info
    ResponseSubscriptionUpdateResponse:
      type: object
      description: response data
      properties:
        code:
          type: string
          example: 0
        msg:
          type: string
          example: success
        data:
          $ref: '#/components/schemas/SubscriptionUpdateResponse'
    SubscriptionUpdateRequest.ProductInfo:
      type: object
      description: Subscription product information
      properties:
        trialPeriodAmount:
          type: string
          description: >
            The subscription amount that user pay during the trial period, for
            example 8000

            The amount shall >= 0

            If the value is empty, there is no trial period

            At least one of amount, productInfo.trialPeriodAmount, and
            productInfo.scheduledAmounts must be provided.
          example: 0
          maxLength: 24
          minLength: 0
        scheduledAmounts:
          type: array
          description: >-
            Scheduled amount list for each period. Use scheduled amounts when a
            merchant wants to set different amounts for each subscription
            period. At least one of amount, productInfo.trialPeriodAmount, and
            productInfo.scheduledAmounts must be provided.
          items:
            $ref: '#/components/schemas/SubscriptionScheduledAmount'
    SubscriptionUpdateResponse:
      type: object
      properties:
        subscriptionId:
          type: string
          description: Waffo subscription Id
        subscriptionRequest:
          type: string
          description: Subscription request id sent from Merchant
        previousTrialPeriodAmount:
          type: string
          description: Merchant subscription previous trail amount, for example 10
        newTrialPeriodAmount:
          type: string
          description: Merchant subscription new trail amount after update, , for example 8
        previousAmount:
          type: string
          description: Merchant subscription previous amount, for example 100
        newAmount:
          type: string
          description: Merchant subscription new  amount after update, for example 90
        previousScheduledAmounts:
          type: array
          description: Previous scheduled amount list for each period
          items:
            $ref: '#/components/schemas/SubscriptionScheduledAmount'
        newScheduledAmounts:
          type: array
          description: New scheduled amount list for each period
          items:
            $ref: '#/components/schemas/SubscriptionScheduledAmount'
        nextEffectivePeriod:
          type: string
          description: The next period number when the new amount takes effect
    SubscriptionScheduledAmount:
      type: object
      description: Scheduled amount item for a specific period
      properties:
        period:
          type: string
          description: Period number, for example 1
        amount:
          type: string
          description: Merchant subscription amount for this period, for example 100

````