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

# 创建产品

> 创建产品

## 概述

本页说明 `POST /merchant/open/institution/v1/pay/merchant/product/create` 接口。完整的请求参数、响应结构与示例由上方关联的 OpenAPI 定义渲染。

## 说明

* 认证方式使用 GatePay 标准签名请求头。
* 本页展示同一接口的机构路径版本。
* 除创建子账户、查询子账户详情、分页查询子账户外，机构侧请求需携带 `X-GatePay-On-Behalf-Of`。
* 通用签名规则请参见 [/api-reference/version/100/cn/common/securityAndSignature](/api-reference/version/100/cn/common/securityAndSignature)。


## OpenAPI

````yaml api-reference/version/100/cn/openapi/institution/subscription/productCreate-openapi.json POST /merchant/open/institution/v1/pay/merchant/product/create
openapi: 3.1.0
info:
  title: GatePay 机构订阅 API
  description: GatePay 支付平台 API 接口文档
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://openplatform.gateapi.io
security: []
paths:
  /merchant/open/institution/v1/pay/merchant/product/create:
    post:
      summary: 创建产品
      description: 创建产品
      parameters:
        - $ref: '#/components/parameters/X-GatePay-Certificate-ClientId'
        - $ref: '#/components/parameters/X-GatePay-Signature'
        - $ref: '#/components/parameters/X-GatePay-Timestamp'
        - $ref: '#/components/parameters/X-GatePay-Nonce'
        - $ref: '#/components/parameters/X-GatePay-On-Behalf-Of'
      requestBody:
        description: 创建产品入参
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductRequest'
            examples:
              basicExample:
                summary: 基础示例
                value:
                  merchantProductNo: MTDC123
                  productName: 美团单车
                  productDesc: 美团单车会员
                  productLogo: >-
                    https://s3.ap-northeast-1.amazonaws.com/gimg.gateimg.com/image/1627288/fe48d444c1943d65fb0125d766a7124d277f52d7112eebe6df47e321bafda073.jpg
                  priceList:
                    - merchantPriceNo: MTDC_1123
                      priceName: 包月
                      priceDesc: 每月一次
                      priceType: FIX_AMOUNT
                      amountType: fiat
                      cryptoCurrency: ''
                      cryptoAmount: null
                      fiatCurrency: USD
                      fiatAmount: 10
                      period: MONTH
                      interval: 1
                      promoConfigType: NONE
                      promoAmount: null
                      promoRate: null
        required: true
      responses:
        '200':
          description: 创建产品成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateProductResponse'
              examples:
                successResponse:
                  summary: 成功响应
                  value:
                    success: 'true'
                    code: '0'
                    message: ''
                    data:
                      merchantProductNo: MTDC123
                      productNo: '82973642140155927'
                      productName: 美团单车
                      productDesc: 美团单车会员
                      productLogo: >-
                        https://s3.ap-northeast-1.amazonaws.com/gimg.gateimg.com/image/1627288/fe48d444c1943d65fb0125d766a7124d277f52d7112eebe6df47e321bafda073.jpg
                      status: ACTIVE
                      createTime: 1774853409437
                      updateTime: 1774853409437
                      priceList:
                        - merchantPriceNo: MTDC_1123
                          priceNo: '82973642140155928'
                          productNo: '82973642140155927'
                          priceName: 包月
                          priceDesc: 每月一次
                          priceType: FIX_AMOUNT
                          payChannels:
                            - channel: GATEPAY
                              status: ACTIVE
                          amountType: fiat
                          cryptoCurrency: ''
                          cryptoAmount: null
                          fiatCurrency: USD
                          fiatAmount: 10
                          period: MONTH
                          interval: 1
                          promoConfigType: NONE
                          promoAmount: null
                          promoRate: null
                          status: ACTIVE
                          createTime: 1774853409437
                          updateTime: 1774853409437
components:
  parameters:
    X-GatePay-Certificate-ClientId:
      name: X-GatePay-Certificate-ClientId
      in: header
      required: true
      description: 商户客户端ID，在 GatePay 平台申请获得
      schema:
        type: string
        example: 4186d0c6-6a35-55a9-8dc6-5312769dbff8
    X-GatePay-Signature:
      name: X-GatePay-Signature
      in: header
      required: true
      description: HMAC-SHA256签名，用于验证请求合法性
      schema:
        type: string
        example: >-
          672d5650dcc9bb22ebf25fa16c28d03c0e159d742a9176d4340a5da326d75dc8a2ec24c97fa6fc5d1533dd6e968863747e1d86a45e562cbe899f9ed7e9ca7f77
    X-GatePay-Timestamp:
      name: X-GatePay-Timestamp
      in: header
      required: true
      description: 时间戳（毫秒），与服务器时间差不能超过5分钟
      schema:
        type: string
        example: '1672905655498'
    X-GatePay-Nonce:
      name: X-GatePay-Nonce
      in: header
      required: true
      description: 随机数，用于防止重放攻击
      schema:
        type: string
        example: '9578'
    X-GatePay-On-Behalf-Of:
      name: X-GatePay-On-Behalf-Of
      in: header
      required: true
      schema:
        type: string
      description: >-
        必填代理归属请求头。请填写本次请求的发起方账户 ID；在机构代理商户 API 中通常填写目标子账户 ID，在机构代扣与划转接口中可填写机构账户
        ID 或子账户 ID。
  schemas:
    CreateProductRequest:
      type: object
      required:
        - merchantProductNo
        - productName
        - priceList
      properties:
        merchantProductNo:
          type: string
          description: 产品编码（商户侧唯一标识）
          example: MPROD_20240312_001
        productName:
          type: string
          description: 产品名称
          example: 高级会员订阅
        productDesc:
          type: string
          description: 产品描述
          example: 年度高级会员服务
        productLogo:
          type: string
          description: 产品图片URL
          example: https://www.example.com/images/product_logo.png
        priceList:
          type: array
          description: 价格列表
          minItems: 1
          items:
            type: object
            required:
              - merchantPriceNo
              - priceName
              - priceType
              - amountType
              - period
              - interval
              - promoConfigType
            properties:
              merchantPriceNo:
                type: string
                description: 价格编号（商户侧唯一标识）
                example: MPRICE_20240312_001
              priceName:
                type: string
                description: 价格名称
                example: 年度订阅
              priceDesc:
                type: string
                description: 价格描述
                example: 按年自动扣费
              priceType:
                type: string
                description: '价格模型。FIX_AMOUNT: 固定金额扣款, ACCOUNT_AUTH: 授权支付（需填写payChannels）'
                enum:
                  - FIX_AMOUNT
                  - ACCOUNT_AUTH
                example: FIX_AMOUNT
              payChannels:
                type: array
                description: 支付渠道（priceType=ACCOUNT_AUTH时必填）
                items:
                  type: object
                  properties:
                    channel:
                      type: string
                      description: '渠道名称。GATEPAY: GatePay支付渠道, WEB3: Web3支付渠道'
                      enum:
                        - GATEPAY
                        - WEB3
                      example: GATEPAY
                    status:
                      type: string
                      description: '渠道状态。ACTIVE: 可用, INACTIVE: 不可用'
                      enum:
                        - ACTIVE
                        - INACTIVE
                      example: ACTIVE
              amountType:
                type: string
                description: '商户定价方式。crypto: 加密货币定价, fiat: 法币定价'
                enum:
                  - crypto
                  - fiat
                example: crypto
              cryptoCurrency:
                type: string
                description: 币种（amountType=crypto必填）
                example: USDT
              cryptoAmount:
                type: number
                format: double
                description: 金额（amountType=crypto必填）
                example: 99.99
              fiatCurrency:
                type: string
                description: 法币币种（amountType=fiat必填）
                example: USD
              fiatAmount:
                type: number
                format: double
                description: 法币金额（amountType=fiat必填）
                example: 99.99
              period:
                type: string
                description: '扣款周期。DAY: 每日扣款, WEEK: 每周扣款, MONTH: 每月扣款, YEAR: 每年扣款'
                enum:
                  - DAY
                  - WEEK
                  - MONTH
                  - YEAR
                example: YEAR
              interval:
                type: integer
                minimum: 1
                description: 扣款间隔，默认1，可叠加周期组合（如每2周传2）
                example: 1
              promoConfigType:
                type: string
                description: '特价类型。NONE: 无优惠, FIX_AMOUNT: 固定优惠金额, RAET: 折扣比例'
                enum:
                  - NONE
                  - FIX_AMOUNT
                  - RAET
                example: NONE
              promoAmount:
                type: number
                format: double
                description: 首期优惠金额（promoConfigType=FIX_AMOUNT时必填）
                example: 10
              promoRate:
                type: number
                format: double
                multipleOf: 0.01
                description: 首期优惠折扣（promoConfigType=RAET时必填，小数点后最多2位，如1折传0.1）
                example: 0.8
            allOf:
              - if:
                  properties:
                    amountType:
                      const: crypto
                then:
                  required:
                    - cryptoCurrency
                    - cryptoAmount
              - if:
                  properties:
                    amountType:
                      const: fiat
                then:
                  required:
                    - fiatCurrency
                    - fiatAmount
              - if:
                  properties:
                    promoConfigType:
                      const: FIX_AMOUNT
                then:
                  required:
                    - promoAmount
              - if:
                  properties:
                    promoConfigType:
                      const: RAET
                then:
                  required:
                    - promoRate
              - if:
                  properties:
                    priceType:
                      const: ACCOUNT_AUTH
                then:
                  required:
                    - payChannels
    CreateProductResponse:
      type: object
      properties:
        code:
          type: string
          description: 响应码，成功为 0
          example: '0'
        message:
          type: string
          description: 失败返回错误原因
          example: ''
        success:
          type: string
          description: 是否成功：true（成功）/ false（失败）
          example: 'true'
        data:
          type: object
          description: 产品信息
          properties:
            merchantProductNo:
              type: string
              description: 产品编码
              example: MPROD_20240312_001
            productNo:
              type: string
              description: 产品唯一编号
              example: SPROD_10000001
            merchantId:
              type: integer
              format: int64
              description: 商户id
              example: 10001
            productName:
              type: string
              description: 产品名称
              example: 高级会员订阅
            productDesc:
              type: string
              description: 产品描述
              example: 年度高级会员服务
            productLogo:
              type: string
              description: 产品图片
              example: https://www.example.com/images/product_logo.png
            createTime:
              type: integer
              format: int64
              description: 创建时间（时间戳）
              example: 1710230400000
            updateTime:
              type: integer
              format: int64
              description: 修改时间（时间戳）
              example: 1710230500000
            priceList:
              type: array
              description: 价格列表
              items:
                type: object
                properties:
                  merchantPriceNo:
                    type: string
                    description: 价格编号
                    example: MPRICE_20240312_001
                  priceNo:
                    type: string
                    description: 价格唯一编号
                    example: SPRICE_10000001
                  productNo:
                    type: string
                    description: 产品唯一编号
                    example: SPROD_10000001
                  priceName:
                    type: string
                    description: 价格名称
                    example: 年度订阅
                  priceDesc:
                    type: string
                    description: 价格描述
                    example: 按年自动扣费
                  priceType:
                    type: string
                    description: '价格模型。FIX_AMOUNT: 固定金额扣款, ACCOUNT_AUTH: 授权支付'
                    enum:
                      - FIX_AMOUNT
                      - ACCOUNT_AUTH
                    example: FIX_AMOUNT
                  payChannels:
                    type: array
                    description: 支付渠道
                    items:
                      type: object
                      properties:
                        channel:
                          type: string
                          description: '渠道名称。GATEPAY: GatePay支付渠道, WEB3: Web3支付渠道'
                          enum:
                            - GATEPAY
                            - WEB3
                          example: GATEPAY
                        status:
                          type: string
                          description: '渠道状态。ACTIVE: 可用, INACTIVE: 不可用'
                          enum:
                            - ACTIVE
                            - INACTIVE
                          example: ACTIVE
                  amountType:
                    type: string
                    description: 商户定价方式
                    example: CRYPTO
                  cryptoCurrency:
                    type: string
                    description: 币种
                    example: USDT
                  cryptoAmount:
                    type: number
                    format: double
                    description: 金额
                    example: 99.99
                  fiatCurrency:
                    type: string
                    description: 法币币种
                    example: USD
                  fiatAmount:
                    type: number
                    format: double
                    description: 法币金额
                    example: 99.99
                  exchangeRate:
                    type: number
                    format: double
                    description: 汇率
                    example: 6.85
                  period:
                    type: string
                    description: 扣款周期
                    example: YEAR
                  interval:
                    type: integer
                    description: 扣款间隔
                    example: 1
                  promoConfigType:
                    type: string
                    description: 特价类型
                    example: NONE
                  promoAmount:
                    type: number
                    format: double
                    description: 首期优惠金额（优惠后实际支付金额）
                    example: 10
                  promoRate:
                    type: number
                    format: double
                    description: 首期优惠折扣
                    example: 0.1
                  createTime:
                    type: integer
                    format: int64
                    description: 创建时间（时间戳）
                    example: 1710230400000
                  updateTime:
                    type: integer
                    format: int64
                    description: 修改时间（时间戳）
                    example: 1710230500000

````