# Create a subscription item

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/subscription_items:
    post:
      summary: Create a subscription item
      deprecated: false
      description: ''
      tags:
        - API Reference/Subscription Items
      parameters:
        - name: Accept
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              x-apifox-refs:
                01HCCR36FWGCFRTDF4YRWRXCAF: &ref_1
                  $ref: '#/components/schemas/Subscription%20item'
                  x-apifox-overrides:
                    id: null
                    object: null
                    subscription: &ref_0
                      type: string
                      description: The subscription this subscription_item belongs to.
                    tax_rates: null
                    created: null
                    price: null
                    billing_thresholds: null
                  required:
                    - subscription
              x-apifox-orders:
                - 01HCCR36FWGCFRTDF4YRWRXCAF
                - price_data
                - price
              properties:
                metadata:
                  type: string
                  description: >-
                    Set of key-value pairs that you can attach to an object.
                    This can be useful for storing additional information about
                    the object in a structured format.
                quantity:
                  type: integer
                  description: >-
                    The quantity of the plan to which the customer should be
                    subscribed.
                subscription: *ref_0
                price_data:
                  type: object
                  properties:
                    currency:
                      type: string
                      description: Three-letter ISO currency code.
                    product:
                      type: string
                      description: The ID of the product that this price will belong to.
                    recurring:
                      type: object
                      properties:
                        interval:
                          type: string
                          description: >-
                            Specifies billing frequency. Either day, week, month
                            or year.
                        interval_count:
                          type: string
                          description: >-
                            The number of intervals between subscription
                            billings. For example, interval=month and
                            interval_count=3 bills every 3 months. Maximum of
                            one year interval allowed (1 year, 12 months, or 52
                            weeks).
                      x-apifox-orders:
                        - interval
                        - interval_count
                      required:
                        - interval
                      description: >-
                        The recurring components of a price such as interval and
                        interval_count.
                      x-apifox-ignore-properties: []
                    unit_amount:
                      type: string
                      description: >-
                        A positive integer in pence (or 0 for a free price)
                        representing how much to charge.
                  x-apifox-orders:
                    - currency
                    - product
                    - recurring
                    - unit_amount
                  required:
                    - currency
                    - product
                    - recurring
                    - unit_amount
                  description: Data used to generate a new Price object inline.
                  x-apifox-ignore-properties: []
                price:
                  type: string
                  description: The ID of the price object.
              required:
                - subscription
              x-apifox-ignore-properties:
                - metadata
                - quantity
                - subscription
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                x-apifox-refs:
                  01HCCRCKXRD9G98504DFQF8H34: *ref_1
                x-apifox-orders:
                  - 01HCCRCKXRD9G98504DFQF8H34
                properties:
                  id:
                    type: string
                    description: Unique identifier for the object.
                  object:
                    type: string
                    description: >-
                      String representing the object’s type. Objects of the same
                      type share the same value.
                  metadata:
                    type: string
                    description: >-
                      Set of key-value pairs that you can attach to an object.
                      This can be useful for storing additional information
                      about the object in a structured format.
                  price:
                    description: The price the customer is subscribed to.
                    type: object
                    x-apifox-refs:
                      01HMZYXK76H2T05N689SJEYWDW:
                        x-apifox-overrides:
                          unit_amount_decimal: null
                          transform_quantity: null
                          tax_behavior: null
                          custom_unit_amount: null
                        type: object
                        properties: {}
                    x-apifox-orders:
                      - 01HMZYXK76H2T05N689SJEYWDW
                    properties:
                      id:
                        type: string
                        description: Unique identifier for the object, like "price_xxxx".
                      object:
                        type: string
                        description: '''price'''
                      active:
                        type: boolean
                        description: Whether the price can be used for new purchases.
                      billing_scheme:
                        type: string
                        description: >-
                          Describes how to compute the price per period. Either
                          per_unit or tiered
                        enum:
                          - per_unit
                          - tiered
                        x-apifox-enum:
                          - value: per_unit
                            name: ''
                            description: only per_unit is supported now.
                          - value: tiered
                            name: ''
                            description: ''
                      created:
                        type: integer
                        description: >-
                          Time at which the object was created. Measured in
                          seconds since the Unix epoch.
                      currency:
                        type: string
                        description: 'Three-letter ISO currency code, in uppercase. '
                      livemode:
                        type: boolean
                        description: >-
                          Has the value true if the object exists in live mode
                          or the value false if the object exists in test mode.
                      lookup_key:
                        type: string
                        description: >-
                          A lookup key used to retrieve prices dynamically from
                          a static string. This may be up to 200 characters.
                      metadata:
                        type: object
                        properties: {}
                        x-apifox-orders: []
                        description: >-
                          Set of key-value pairs that you can attach to an
                          object. This can be useful for storing additional
                          information about the object in a structured format.
                        x-apifox-ignore-properties: []
                      nickname:
                        type: string
                        description: >-
                          A brief description of the price, hidden from
                          customers.
                      product:
                        type: string
                        description: The ID of the product this price is associated with.
                      type:
                        type: string
                        description: >-
                          One of one_time or recurring depending on whether the
                          price is for a one-time purchase or a recurring
                          (subscription) purchase.
                        enum:
                          - one_time
                          - recurring
                        x-apifox-enum:
                          - value: one_time
                            name: ''
                            description: only one-time is supported now.
                          - value: recurring
                            name: ''
                            description: ''
                      unit_amount:
                        type: integer
                        description: >-
                          The unit amount in cents to be charged, represented as
                          a whole integer if possible. Only set if
                          billing_scheme=per_unit.
                      recurring:
                        type: object
                        properties:
                          interval:
                            type: string
                            description: >-
                              The frequency at which a subscription is billed.
                              One of day, week, month or year.
                            enum:
                              - day
                              - week
                              - month
                              - year
                            x-apifox-enum:
                              - value: day
                                name: ''
                                description: ''
                              - value: week
                                name: ''
                                description: ''
                              - value: month
                                name: ''
                                description: ''
                              - value: year
                                name: ''
                                description: ''
                          interval_count:
                            type: integer
                            description: >-
                              The number of intervals (specified in the interval
                              attribute) between subscription billings. For
                              example, interval=month and interval_count=3 bills
                              every 3 months.
                          usage_type:
                            type: string
                            description: >-
                              Configures how the quantity per period should be
                              determined.
                            enum:
                              - licensed
                            x-apifox-enum:
                              - value: licensed
                                name: ''
                                description: ''
                        x-apifox-orders:
                          - interval
                          - interval_count
                          - usage_type
                        description: The recurring components of a price
                        required:
                          - interval
                        x-apifox-ignore-properties: []
                      tiers_mode:
                        type: 'null'
                        description: （未实现）
                      tiers:
                        type: array
                        items:
                          type: object
                          properties:
                            up_to:
                              type: string
                              description: >-
                                Specifies the upper bound of this tier. The
                                lower bound of a tier is the upper bound of the
                                previous tier adding one. Use inf to define a
                                fallback tier.
                            flat_amount:
                              type: string
                              description: >-
                                The flat billing amount for an entire tier,
                                regardless of the number of units in the tier.
                            unit_amount:
                              type: string
                              description: >-
                                The per unit billing amount for each individual
                                unit for which this tier applies.
                          x-apifox-orders:
                            - up_to
                            - flat_amount
                            - unit_amount
                          x-apifox-ignore-properties: []
                        description: （未实现）
                    x-apifox-ignore-properties:
                      - id
                      - object
                      - active
                      - billing_scheme
                      - created
                      - currency
                      - livemode
                      - lookup_key
                      - metadata
                      - nickname
                      - product
                      - type
                      - unit_amount
                      - recurring
                      - tiers_mode
                      - tiers
                  quantity:
                    type: integer
                    description: >-
                      The quantity of the plan to which the customer should be
                      subscribed.
                  subscription:
                    type: string
                    description: The subscription this subscription_item belongs to.
                  created:
                    type: string
                    description: >-
                      Time at which the object was created. Measured in seconds
                      since the Unix epoch.
                x-apifox-ignore-properties:
                  - id
                  - object
                  - metadata
                  - price
                  - quantity
                  - subscription
                  - created
          headers: {}
          x-apifox-name: OK
      security:
        - basic: []
      x-apifox-folder: API Reference/Subscription Items
      x-apifox-status: developing
      x-run-in-apifox: https://app.apifox.com/web/project/1296482/apis/api-115695280-run
components:
  schemas:
    Subscription item:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object.
        object:
          type: string
          description: >-
            String representing the object’s type. Objects of the same type
            share the same value.
        metadata:
          type: string
          description: >-
            Set of key-value pairs that you can attach to an object. This can be
            useful for storing additional information about the object in a
            structured format.
        price:
          description: The price the customer is subscribed to.
          type: object
          x-apifox-refs:
            01HMZYXK76H2T05N689SJEYWDW:
              $ref: '#/components/schemas/Price'
              x-apifox-overrides:
                unit_amount_decimal: null
                transform_quantity: null
                tax_behavior: null
                custom_unit_amount: null
          x-apifox-orders:
            - 01HMZYXK76H2T05N689SJEYWDW
          properties:
            id: &ref_2
              type: string
              description: Unique identifier for the object, like "price_xxxx".
            object: &ref_3
              type: string
              description: '''price'''
            active: &ref_4
              type: boolean
              description: Whether the price can be used for new purchases.
            billing_scheme:
              type: string
              description: >-
                Describes how to compute the price per period. Either per_unit
                or tiered
              enum: &ref_5
                - per_unit
                - tiered
              x-apifox-enum:
                - value: per_unit
                  name: ''
                  description: only per_unit is supported now.
                - value: tiered
                  name: ''
                  description: ''
            created: &ref_6
              type: integer
              description: >-
                Time at which the object was created. Measured in seconds since
                the Unix epoch.
            currency: &ref_7
              type: string
              description: 'Three-letter ISO currency code, in uppercase. '
            livemode: &ref_8
              type: boolean
              description: >-
                Has the value true if the object exists in live mode or the
                value false if the object exists in test mode.
            lookup_key: &ref_9
              type: string
              description: >-
                A lookup key used to retrieve prices dynamically from a static
                string. This may be up to 200 characters.
            metadata:
              type: object
              properties: {}
              x-apifox-orders: &ref_10 []
              description: >-
                Set of key-value pairs that you can attach to an object. This
                can be useful for storing additional information about the
                object in a structured format.
              x-apifox-ignore-properties: []
            nickname: &ref_11
              type: string
              description: A brief description of the price, hidden from customers.
            product: &ref_12
              type: string
              description: The ID of the product this price is associated with.
            type:
              type: string
              description: >-
                One of one_time or recurring depending on whether the price is
                for a one-time purchase or a recurring (subscription) purchase.
              enum: &ref_13
                - one_time
                - recurring
              x-apifox-enum:
                - value: one_time
                  name: ''
                  description: only one-time is supported now.
                - value: recurring
                  name: ''
                  description: ''
            unit_amount: &ref_14
              type: integer
              description: >-
                The unit amount in cents to be charged, represented as a whole
                integer if possible. Only set if billing_scheme=per_unit.
            recurring:
              type: object
              properties:
                interval:
                  type: string
                  description: >-
                    The frequency at which a subscription is billed. One of day,
                    week, month or year.
                  enum: &ref_15
                    - day
                    - week
                    - month
                    - year
                  x-apifox-enum:
                    - value: day
                      name: ''
                      description: ''
                    - value: week
                      name: ''
                      description: ''
                    - value: month
                      name: ''
                      description: ''
                    - value: year
                      name: ''
                      description: ''
                interval_count: &ref_16
                  type: integer
                  description: >-
                    The number of intervals (specified in the interval
                    attribute) between subscription billings. For example,
                    interval=month and interval_count=3 bills every 3 months.
                usage_type:
                  type: string
                  description: Configures how the quantity per period should be determined.
                  enum: &ref_17
                    - licensed
                  x-apifox-enum:
                    - value: licensed
                      name: ''
                      description: ''
              x-apifox-orders: &ref_18
                - interval
                - interval_count
                - usage_type
              description: The recurring components of a price
              required:
                - interval
              x-apifox-ignore-properties: []
            tiers_mode: &ref_19
              type: 'null'
              description: （未实现）
            tiers:
              type: array
              items:
                type: object
                properties:
                  up_to: &ref_20
                    type: string
                    description: >-
                      Specifies the upper bound of this tier. The lower bound of
                      a tier is the upper bound of the previous tier adding one.
                      Use inf to define a fallback tier.
                  flat_amount: &ref_21
                    type: string
                    description: >-
                      The flat billing amount for an entire tier, regardless of
                      the number of units in the tier.
                  unit_amount: &ref_22
                    type: string
                    description: >-
                      The per unit billing amount for each individual unit for
                      which this tier applies.
                x-apifox-orders: &ref_23
                  - up_to
                  - flat_amount
                  - unit_amount
                x-apifox-ignore-properties: []
              description: （未实现）
          x-apifox-ignore-properties:
            - id
            - object
            - active
            - billing_scheme
            - created
            - currency
            - livemode
            - lookup_key
            - metadata
            - nickname
            - product
            - type
            - unit_amount
            - recurring
            - tiers_mode
            - tiers
        quantity:
          type: integer
          description: The quantity of the plan to which the customer should be subscribed.
        subscription:
          type: string
          description: The subscription this subscription_item belongs to.
        billing_thresholds:
          type: object
          properties:
            usage_gte:
              type: integer
              description: >-
                Usage threshold that triggers the subscription to create an
                invoice
          description: >-
            Define thresholds at which an invoice will be sent, and the related
            subscription advanced to a new billing period
          x-apifox-orders:
            - usage_gte
          deprecated: true
          x-apifox-ignore-properties: []
        created:
          type: string
          description: >-
            Time at which the object was created. Measured in seconds since the
            Unix epoch.
        tax_rates:
          type: object
          properties: {}
          description: 未完成
          x-apifox-orders: []
          deprecated: true
          x-apifox-ignore-properties: []
      x-apifox-orders:
        - id
        - object
        - metadata
        - price
        - quantity
        - subscription
        - billing_thresholds
        - created
        - tax_rates
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
    Price:
      type: object
      properties:
        id: *ref_2
        object: *ref_3
        active: *ref_4
        billing_scheme:
          type: string
          description: >-
            Describes how to compute the price per period. Either per_unit or
            tiered
          enum: *ref_5
          x-apifox-enum:
            - value: per_unit
              name: ''
              description: only per_unit is supported now.
            - value: tiered
              name: ''
              description: ''
        created: *ref_6
        currency: *ref_7
        livemode: *ref_8
        lookup_key: *ref_9
        metadata:
          type: object
          properties: {}
          x-apifox-orders: *ref_10
          description: >-
            Set of key-value pairs that you can attach to an object. This can be
            useful for storing additional information about the object in a
            structured format.
          x-apifox-ignore-properties: []
        nickname: *ref_11
        product: *ref_12
        type:
          type: string
          description: >-
            One of one_time or recurring depending on whether the price is for a
            one-time purchase or a recurring (subscription) purchase.
          enum: *ref_13
          x-apifox-enum:
            - value: one_time
              name: ''
              description: only one-time is supported now.
            - value: recurring
              name: ''
              description: ''
        unit_amount: *ref_14
        custom_unit_amount:
          type: 'null'
          description: （未实现）
        recurring:
          type: object
          properties:
            interval:
              type: string
              description: >-
                The frequency at which a subscription is billed. One of day,
                week, month or year.
              enum: *ref_15
              x-apifox-enum:
                - value: day
                  name: ''
                  description: ''
                - value: week
                  name: ''
                  description: ''
                - value: month
                  name: ''
                  description: ''
                - value: year
                  name: ''
                  description: ''
            interval_count: *ref_16
            usage_type:
              type: string
              description: Configures how the quantity per period should be determined.
              enum: *ref_17
              x-apifox-enum:
                - value: licensed
                  name: ''
                  description: ''
          x-apifox-orders: *ref_18
          description: The recurring components of a price
          required:
            - interval
          x-apifox-ignore-properties: []
        tax_behavior:
          type: string
          description: （未实现）
        tiers_mode: *ref_19
        tiers:
          type: array
          items:
            type: object
            properties:
              up_to: *ref_20
              flat_amount: *ref_21
              unit_amount: *ref_22
            x-apifox-orders: *ref_23
            x-apifox-ignore-properties: []
          description: （未实现）
        transform_quantity:
          type: 'null'
          description: （未实现）
        unit_amount_decimal:
          type: string
          description: （未实现）
      x-apifox-orders:
        - id
        - object
        - active
        - billing_scheme
        - created
        - currency
        - livemode
        - lookup_key
        - metadata
        - nickname
        - product
        - type
        - unit_amount
        - custom_unit_amount
        - recurring
        - tax_behavior
        - tiers_mode
        - tiers
        - transform_quantity
        - unit_amount_decimal
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
  securitySchemes:
    basic:
      type: http
      scheme: basic
servers:
  - url: https://apitest.wooshpay.com
    description: 官网测试
security:
  - basic: []

```
