# Create a price

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/prices:
    post:
      summary: Create a price
      deprecated: false
      description: 'Creates a new price for an existing product. '
      tags:
        - API Reference/Prices
      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
              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.
                unit_amount:
                  type: string
                  description: >-
                    A positive integer in cents (or 0 for a free price)
                    representing how much to charge.
                active:
                  type: string
                  description: >-
                    Whether the price can be used for new purchases. Defaults to
                    true.
                metadata:
                  type: object
                  properties: {}
                  description: 'Set of key-value pairs that you can attach to an object. '
                  x-apifox-orders: []
                  x-apifox-ignore-properties: []
                nickname:
                  type: string
                  description: A brief description of the price, hidden from customers.
                product_data:
                  description: >-
                    These fields can be used to create a new product that this
                    price will belong to.
                  type: object
                  x-apifox-refs:
                    01GMQ45WG7NXSF73BHPPFCYV5R:
                      $ref: '#/components/schemas/Product'
                      x-apifox-overrides:
                        id: null
                        object: null
                        created: null
                        livemode: null
                        updated: null
                        default_price: null
                        package_dimensions: null
                        shippable: null
                        statement_descriptor: null
                        tax_code: null
                        unit_label: null
                  x-apifox-orders:
                    - 01GMQ45WG7NXSF73BHPPFCYV5R
                  properties:
                    active:
                      type: boolean
                      description: Whether the product is currently available for purchase.
                    description:
                      type: string
                      description: >-
                        The product’s description, meant to be displayable to
                        the customer. Use this field to optionally store a long
                        form explanation of the product being sold for your own
                        rendering purposes.
                    images:
                      type: array
                      items:
                        type: string
                      description: >-
                        A list of up to 8 URLs of images for this product, meant
                        to be displayable to the customer.
                    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: []
                    name:
                      type: string
                      description: >-
                        The product’s name, meant to be displayable to the
                        customer. Whenever this product is sold via a
                        subscription, name will show up on associated invoice
                        line item descriptions.
                    url:
                      type: string
                      description: A URL of a publicly-accessible webpage for this product.
                  required:
                    - name
                  x-apifox-ignore-properties:
                    - active
                    - description
                    - images
                    - metadata
                    - name
                    - url
                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: indicates that the fixed amount
                    - value: tiered
                      name: ''
                      description: >-
                        indicates that the unit pricing will be computed using a
                        tiering strategy as defined using the tiers and
                        tiers_mode attributes.
                lookup_key:
                  type: string
                  description: >-
                    A lookup key used to retrieve prices dynamically from a
                    static string. This may be up to 200 characters.
                recurring:
                  type: object
                  properties:
                    interval:
                      type: string
                      description: >-
                        Specifies billing frequency. Either day, week, month or
                        year.
                      enum:
                        - day
                        - month
                        - week
                        - year
                      x-apifox-enum:
                        - value: day
                          name: ''
                          description: ''
                        - value: month
                          name: ''
                          description: ''
                        - value: week
                          name: ''
                          description: ''
                        - value: year
                          name: ''
                          description: ''
                    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 three years interval allowed
                        (3 years, 36 months, or 156 weeks).
                    usage_type:
                      type: string
                      description: >-
                        Configures how the quantity per period should be
                        determined. Can be either metered or licensed. licensed
                        automatically bills the quantity set when adding it to a
                        subscription. metered aggregates the total usage based
                        on usage records. Defaults to licensed
                      enum:
                        - licensed
                      x-apifox-enum:
                        - value: licensed
                          name: ''
                          description: ''
                  description: >-
                    The recurring components of a price such as interval and
                    usage_type.
                  x-apifox-orders:
                    - interval
                    - interval_count
                    - usage_type
                  required:
                    - interval
                  x-apifox-ignore-properties: []
              x-apifox-orders:
                - currency
                - product
                - unit_amount
                - active
                - metadata
                - nickname
                - product_data
                - billing_scheme
                - lookup_key
                - recurring
              required:
                - currency
                - unit_amount
              x-apifox-ignore-properties: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                x-apifox-refs:
                  01GMQ4738VPE2GFPK35AYRPNSX:
                    $ref: '#/components/schemas/Price'
                    x-apifox-overrides:
                      unit_amount_decimal: null
                      transform_quantity: null
                      tax_behavior: null
                      custom_unit_amount: null
                      tiers: null
                      tiers_mode: null
                    required:
                      - tiers
                x-apifox-orders:
                  - 01GMQ4738VPE2GFPK35AYRPNSX
                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: []
                x-apifox-ignore-properties:
                  - id
                  - object
                  - active
                  - billing_scheme
                  - created
                  - currency
                  - livemode
                  - lookup_key
                  - metadata
                  - nickname
                  - product
                  - type
                  - unit_amount
                  - recurring
          headers: {}
          x-apifox-name: OK
      security:
        - basic: []
      x-apifox-folder: API Reference/Prices
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/1296482/apis/api-55501373-run
components:
  schemas:
    Product:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object, like 'prod_xxx'.
        object:
          type: string
          description: '''product'''
        active:
          type: boolean
          description: Whether the product is currently available for purchase.
        created:
          type: integer
          description: >-
            Time at which the object was created. Measured in seconds since the
            Unix epoch.
        description:
          type: string
          description: >-
            The product’s description, meant to be displayable to the customer.
            Use this field to optionally store a long form explanation of the
            product being sold for your own rendering purposes.
        images:
          type: array
          items:
            type: string
          description: >-
            A list of up to 8 URLs of images for this product, meant to be
            displayable to the customer.
        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.
        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: []
        name:
          type: string
          description: >-
            The product’s name, meant to be displayable to the customer.
            Whenever this product is sold via a subscription, name will show up
            on associated invoice line item descriptions.
        updated:
          type: integer
          description: >-
            Time at which the object was last updated. Measured in seconds since
            the Unix epoch.
        url:
          type: string
          description: A URL of a publicly-accessible webpage for this product.
        default_price:
          type: 'null'
          description: （未实现）
        package_dimensions:
          type: 'null'
          description: （未实现）
        shippable:
          type: 'null'
          description: （未实现）
        statement_descriptor:
          type: 'null'
          description: （未实现）
        tax_code:
          type: 'null'
          description: （未实现）
        unit_label:
          type: 'null'
          description: （未实现）
      x-apifox-orders:
        - id
        - object
        - active
        - created
        - description
        - images
        - livemode
        - metadata
        - name
        - updated
        - url
        - default_price
        - package_dimensions
        - shippable
        - statement_descriptor
        - tax_code
        - unit_label
      required:
        - name
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
    Price:
      type: object
      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.
        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:
                - 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: []
        tax_behavior:
          type: string
          description: （未实现）
        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: （未实现）
        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: []

```
