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

# submit.php (redirect checkout compatibility endpoint)

> Creates (or reuses) an Epay-compatible payment and returns HTTP 302 redirect to the hosted payment page.
This endpoint also accepts GET with the same parameters.

Signature algorithm:
1. Remove `sign` and `sign_type`, and drop empty values.
2. Sort parameters by key in ascending order.
3. Join as `k=v` with `&`, append merchant API key.
4. MD5 the final string and compare in lowercase.




## OpenAPI

````yaml /openapi.yaml post /epay/submit.php
openapi: 3.1.0
info:
  title: Kyren Pay API
  description: >
    The Kyren Pay API enables merchants to accept payments from customers
    worldwide.

    Integrate checkout sessions, manage products, track orders, and handle
    webhooks.


    **Data types**: The API uses the following types for request/response data:

    - **string**: For text, identifiers, and **all amount/price fields** (e.g.
    `price`, `amount`, `platformFee`, `available`)
      to avoid floating-point precision issues. Use decimal format like `"9.99"`.
    - **integer**: For counts, pagination, and timestamps

    - **timestamp**: Unix timestamp in milliseconds (integer) for all time
    fields (e.g. `createdAt`, `paidAt`, `expiresAt`).
      Time parameters (e.g. `startDate`, `endDate`) also use Unix milliseconds.
  version: 1.0.0
  contact:
    name: Kyren Pay Support
    email: support@kyren.top
    url: https://kyren.top
servers:
  - url: https://api.kyren.top
    description: Production
  - url: https://staging-api.kyren.top
    description: Staging, available only with credentials issued by Kyren
security:
  - ApiKeyAuth: []
tags:
  - name: Config
    description: Retrieve platform configuration such as supported currencies.
  - name: Products
    description: Create and manage products that represent the goods or services you sell.
  - name: Checkouts
    description: Create checkout sessions to collect payments from your customers.
  - name: Orders
    description: View and manage orders created from completed checkout sessions.
  - name: Balance
    description: View your account balance and transaction history.
  - name: Epay Compatibility
    description: >
      Compatibility endpoints for existing integrations built on 易支付 API
      conventions.

      These endpoints use form/query parameters with `pid + sign` verification
      (MD5), not `x-api-key` header auth.
paths:
  /epay/submit.php:
    post:
      tags:
        - Epay Compatibility
      summary: submit.php (redirect checkout compatibility endpoint)
      description: >
        Creates (or reuses) an Epay-compatible payment and returns HTTP 302
        redirect to the hosted payment page.

        This endpoint also accepts GET with the same parameters.


        Signature algorithm:

        1. Remove `sign` and `sign_type`, and drop empty values.

        2. Sort parameters by key in ascending order.

        3. Join as `k=v` with `&`, append merchant API key.

        4. MD5 the final string and compare in lowercase.
      operationId: createEpaySubmit
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/EpaySubmitRequest'
            example:
              pid: merch_001
              type: alipay
              out_trade_no: order_20260409001
              notify_url: https://merchant.example.com/pay/notify
              return_url: https://merchant.example.com/pay/return
              name: Pro Plan Subscription
              money: '99.00'
              money_type: CNY
              display_merchant_name: Campaign Store
              param: user_42
              sign: fb7f5f742f89eb1f137fbc293f2bf42a
              sign_type: MD5
      responses:
        '200':
          description: Request rejected (returns compatibility error body)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EpaySimpleResponse'
              example:
                code: 0
                msg: 签名验证失败
        '302':
          description: Redirect to checkout/payment page
          headers:
            Location:
              description: Redirect target URL
              schema:
                type: string
                format: uri
      security: []
components:
  schemas:
    EpaySubmitRequest:
      type: object
      required:
        - pid
        - type
        - out_trade_no
        - notify_url
        - return_url
        - name
        - money
        - sign
        - sign_type
      properties:
        pid:
          type: string
          description: Merchant ID
        type:
          $ref: '#/components/schemas/EpayPaymentType'
        out_trade_no:
          type: string
          description: Merchant order number (must be unique under one merchant)
        notify_url:
          type: string
          format: uri
          description: Merchant async callback URL
        return_url:
          type: string
          format: uri
          description: Merchant sync return URL
        name:
          type: string
          description: Product name
        money:
          type: string
          description: Order amount, decimal string, must be greater than 0
        money_type:
          type: string
          default: CNY
          description: Currency code. Defaults to CNY when omitted.
        param:
          type: string
          description: Pass-through parameter returned in callbacks and order queries
        display_merchant_name:
          type: string
          maxLength: 80
          description: >-
            Optional per-payment merchant display name shown on Kyren
            intermediate payment pages
        sign:
          type: string
          description: Lowercase MD5 signature
        sign_type:
          $ref: '#/components/schemas/EpaySignType'
    EpaySimpleResponse:
      type: object
      properties:
        code:
          type: integer
          enum:
            - 0
        msg:
          type: string
    EpayPaymentType:
      type: string
      enum:
        - alipay
        - wxpay
        - creditcard
        - crypto
        - paynow
      description: Payment channel type in Epay compatibility mode.
    EpaySignType:
      type: string
      enum:
        - MD5
      description: Signature type. Current compatibility implementation only supports MD5.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >
        Your API key. Public production API-key endpoints accept `kyren_live_*`
        keys. Staging credentials are environment-specific and must be used only
        with the staging environment for which Kyren issued them.

````