> ## 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.

# Create Order

> Create a new payment order on GatePay. The response returns payment information that can be used to redirect the user to the payment page or render a payment QR code.

## Overview

This page documents the `/v1/pay/order` endpoint. The full schema, parameters, and examples are rendered from the linked OpenAPI definition above.

## Notes

* Authentication uses the standard GatePay signed headers.
* This page documents the standard merchant endpoint.
* For shared signing rules, see [/api-reference/version/100/en/common/securityAndSignature](/api-reference/version/100/en/common/securityAndSignature).


## OpenAPI

````yaml /api-reference/version/100/en/openapi/payment-order-openapi.json POST /v1/pay/order
openapi: 3.1.0
info:
  title: GatePay API
  description: GatePay payment API reference.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://openplatform.gateapi.io
security: []
paths:
  /v1/pay/order:
    post:
      summary: Create Order
      description: >-
        Create a new payment order on GatePay. The response returns payment
        information that can be used to redirect the user to the payment page or
        render a payment QR code.
      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'
      requestBody:
        description: Payment order creation parameters
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayOrderRequest'
            examples:
              basicExample:
                summary: Basic example
                value:
                  merchantTradeNo: '22212345678555'
                  env:
                    terminalType: APP
                  currency: GT
                  orderAmount: '1.21'
                  goods:
                    goodsType: '312221'
                    goodsName: NF2T
                    goodsDetail: '123444'
                  returnUrl: http://47.99.158.63:8205/payment/redirect
                  channelId: '123456'
        required: true
      responses:
        '200':
          description: Payment order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayOrderResponse'
              examples:
                successResponse:
                  summary: Successful response
                  value:
                    code: SUCCESS
                    message: 订单创建成功
                    data:
                      orderId: GATE202400001
                      merchantTradeNo: '22212345678555'
                      paymentUrl: https://pay.gateapi.io/paypage?order=GATE202400001
                      qrCode: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
                      orderAmount: '1.21'
                      currency: GT
                      expireTime: 1672909255498
                      orderStatus: CREATED
                      createTime: 1672905655498
components:
  parameters:
    X-GatePay-Certificate-ClientId:
      name: X-GatePay-Certificate-ClientId
      in: header
      required: true
      description: Merchant client ID obtained from the GatePay platform
      schema:
        type: string
        example: 4186d0c6-6a35-55a9-8dc6-5312769dbff8
    X-GatePay-Signature:
      name: X-GatePay-Signature
      in: header
      required: true
      description: HMAC-SHA256 signature used to verify request validity
      schema:
        type: string
        example: >-
          672d5650dcc9bb22ebf25fa16c28d03c0e159d742a9176d4340a5da326d75dc8a2ec24c97fa6fc5d1533dd6e968863747e1d86a45e562cbe899f9ed7e9ca7f77
    X-GatePay-Timestamp:
      name: X-GatePay-Timestamp
      in: header
      required: true
      description: >-
        Timestamp in milliseconds. The difference from server time must not
        exceed 5 minutes.
      schema:
        type: string
        example: '1672905655498'
    X-GatePay-Nonce:
      name: X-GatePay-Nonce
      in: header
      required: true
      description: Nonce used to prevent replay attacks
      schema:
        type: string
        example: '9578'
  schemas:
    PayOrderRequest:
      type: object
      required:
        - merchantTradeNo
        - currency
        - orderAmount
        - env
        - goods
      properties:
        merchantTradeNo:
          type: string
          description: Merchant order number. Must be unique.
          minLength: 5
          maxLength: 32
          example: '22212345678555'
        env:
          $ref: '#/components/schemas/Env'
        currency:
          type: string
          description: >-
            Order currency. Refer to the "Supported Networks and Currencies"
            section above for the currently supported options.
          example: GT
        orderAmount:
          type: string
          description: Order amount. Must be a positive number and supports decimals.
          pattern: ^\d+(\.\d{1,2})?$
          example: '1.21'
        goods:
          $ref: '#/components/schemas/Goods'
        orderExpireTime:
          type: integer
          description: >-
            Order expiration time as a UTC timestamp in milliseconds. Defaults
            to 1 hour if omitted, and the maximum expiration time is 1 hour.
          format: int64
          example: 1770789143000
        returnUrl:
          type: string
          description: >-
            Return URL after the order is paid successfully. Maximum length is
            256 characters. Redirection occurs only after payment is completed
            on the hosted payment page.
          format: uri
          maxLength: 512
          example: http://47.99.158.63:8205/payment/redirect
        cancelUrl:
          type: string
          description: Return URL after the order payment is cancelled.
          format: uri
          maxLength: 512
          example: http://47.99.158.63:8205/payment/redirect
        channelId:
          type: string
          description: Customer channel name
          maxLength: 32
          example: '123456'
    PayOrderResponse:
      type: object
      properties:
        code:
          type: string
          description: Response code
          enum:
            - SUCCESS
            - ERROR
          example: SUCCESS
        message:
          type: string
          description: Response message
          example: 订单创建成功
        data:
          $ref: '#/components/schemas/PayOrderData'
    Env:
      type: object
      required:
        - terminalType
      properties:
        terminalType:
          type: string
          description: Terminal type
          enum:
            - WEB
            - APP
            - MINIAPP
            - WAP
            - OTHERS
          example: APP
    Goods:
      type: object
      required:
        - goodsType
        - goodsName
      properties:
        goodsType:
          type: string
          description: Product type code
          maxLength: 32
          example: '312221'
        goodsName:
          type: string
          description: Product name
          maxLength: 100
          example: NF2T
        goodsDetail:
          type: string
          description: Product detail description
          maxLength: 500
          example: '123444'
    PayOrderData:
      type: object
      properties:
        orderId:
          type: string
          description: Order ID generated by the GatePay platform
          example: GATE202400001
        merchantTradeNo:
          type: string
          description: Merchant order number
          example: '22212345678555'
        paymentUrl:
          type: string
          description: Payment page URL
          format: uri
          example: https://pay.gateapi.io/paypage?order=GATE202400001
        qrCode:
          type: string
          description: Payment QR code (base64 format)
          example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
        orderAmount:
          type: string
          description: Order amount
          example: '1.21'
        currency:
          type: string
          description: Currency type
          example: GT
        expireTime:
          type: integer
          format: int64
          description: Order expiration timestamp (milliseconds)
          example: 1672909255498
        orderStatus:
          type: string
          description: Order status
          enum:
            - CREATED
            - PAID
            - EXPIRED
            - CANCELLED
          example: CREATED
        createTime:
          type: integer
          format: int64
          description: Order creation timestamp (milliseconds)
          example: 1672905655498

````