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

# 统一下单

> 商户业务系统通过统一下单接口发起支付收款订单，支付网关会根据商户配置的支付通道路由支付通道完成支付下单。支付网关根据不同的支付方式返回对应的支付参数，业务系统使用支付参数发起收款。



## OpenAPI

````yaml docs/api/cn/openapi.json post /api/pay/unifiedOrder
openapi: 3.0.1
info:
  title: 支付Api接口文档
  contact:
    name: epay123
  license:
    name: Apache 2.0
    url: https://docs.epay123.net
  version: 1.0.1
servers:
  - url: https://sandbox-pay.epay123.net
    description: Generated server url
security: []
paths:
  /api/pay/unifiedOrder:
    post:
      tags:
        - 支付订单接口
      summary: 统一下单
      description: >-
        商户业务系统通过统一下单接口发起支付收款订单，支付网关会根据商户配置的支付通道路由支付通道完成支付下单。支付网关根据不同的支付方式返回对应的支付参数，业务系统使用支付参数发起收款。
      operationId: unifiedOrder
      requestBody:
        description: 统一下单请求参数
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnifiedOrderRQ'
        required: true
      responses:
        '200':
          description: 成功返回结果
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiResUnifiedOrderRS'
components:
  schemas:
    UnifiedOrderRQ:
      required:
        - amount
        - appId
        - body
        - currency
        - mchNo
        - mchOrderNo
        - reqTime
        - sign
        - signType
        - subject
        - version
        - wayCode
      type: object
      properties:
        version:
          type: string
          description: 版本号
          example: 1.0.1
        signType:
          type: string
          description: 签名类型，目前只支持MD5方式
          example: MD5
        sign:
          type: string
          description: 签名值，详见签名算法
          example: xxxxxx
        reqTime:
          type: string
          description: 时间戳,13位时间戳
          example: '1622016572190'
        mchNo:
          type: string
          description: 商户号
          example: M1234567890
        appId:
          type: string
          description: 商户应用ID
          example: 88808634c46ff1a7807888888
        mchOrderNo:
          type: string
          description: 商户订单号
          example: mho1624005107281
        wayCode:
          type: string
          description: 支付方式  如： QR_CASHIER、CB_COIN_ADDR等
          example: QR_CASHIER
        amount:
          minimum: 1
          type: integer
          description: 支付金额， 单位：分
          format: int64
          example: 100
        currency:
          type: string
          description: 货币代码
          example: USD
        clientIp:
          type: string
          description: 客户端IP地址
          example: 192.166.1.132
        subject:
          type: string
          description: 商品标题
          example: 商品标题
        body:
          type: string
          description: 商品描述信息
          example: 商品描述
        notifyUrl:
          type: string
          description: 异步通知地址
          example: https://xxx/notify
        returnUrl:
          type: string
          description: 跳转通知地址
          example: https://xxx/returnUrl
        expiredTime:
          type: integer
          description: 订单失效时间, 单位：秒
          format: int32
          example: 3600
        channelExtra:
          type: string
          description: 特定渠道发起额外参数
          example: '{"authCode":"280812820366966512"}'
        extParam:
          type: string
          description: 商户扩展参数
          example: '{}'
        divisionMode:
          type: integer
          description: 分账模式： 0-该笔订单不允许分账, 1-支付成功按配置自动完成分账, 2-商户手动分账(解冻商户金额)
          format: int32
          example: 1
        channelUserId:
          type: string
    ApiResUnifiedOrderRS:
      type: object
      properties:
        code:
          title: code
          type: integer
          description: 业务响应码
          format: int32
          example: 200
        msg:
          title: msg
          type: string
          description: 业务响应信息
          example: 成功
        data:
          $ref: '#/components/schemas/UnifiedOrderRS'
        sign:
          title: sign
          type: string
          description: 签名值
    UnifiedOrderRS:
      title: data
      required:
        - mchOrderNo
        - orderState
        - payDataType
        - payOrderId
      type: object
      properties:
        payOrderId:
          type: string
          description: 支付订单号
          example: P202106181642329900002
        mchOrderNo:
          type: string
          description: 商户订单号
          example: mho1624005752661
        orderState:
          type: integer
          description: 支付订单状态 0-订单生成 1-支付中 2-支付成功 3-支付失败 4-已撤销 5-已退款 6-订单关闭
          format: int32
          example: 3
        payDataType:
          type: string
          description: 支付参数类型 payUrl-跳转链接的方式 codeUrl-二维码地址 codeImgUrl-二维码图片地址 none-空支付参数
        payData:
          type: string
          description: 支付参数
        errCode:
          type: string
          description: 渠道返回错误代码
          example: ACQ.PAYMENT_AUTH_CODE_INVALID
        errMsg:
          type: string
          description: 渠道返回错误信息
          example: Business Failed
      description: 数据对象

````