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

# 创建一次性支付

> Create a one-time payment with an existing payment instrument. Use either productId and priceId, or amount and currency. To charge in a different payment currency, provide paymentCurrency and Clink will apply the available fixed multi-currency price or automatic currency conversion.



## OpenAPI

````yaml POST /payment
openapi: 3.1.0
info:
  title: Clink API
  description: >-
    Official API documentation for Clink's payment processing platform. This API
    enables merchants to create and manage payment sessions, handle
    subscriptions, and process transactions.
  version: 1.0.0
servers:
  - url: https://uat-api.clinkbill.com/api/
security:
  - ApiKeyAuth: []
paths:
  /payment:
    post:
      summary: Create Payment
      description: >-
        Create a one-time payment with an existing payment instrument. Use
        either productId and priceId, or amount and currency. To charge in a
        different payment currency, provide paymentCurrency and Clink will apply
        the available fixed multi-currency price or automatic currency
        conversion.
      operationId: createPayment
      parameters:
        - $ref: '#/components/parameters/TimestampHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentApiRequest'
            examples:
              pricePayment:
                summary: Use a predefined price
                value:
                  customerId: cus_xxxxx
                  productId: prd_xxxxx
                  priceId: price_xxxxx
                  paymentInstrumentId: pi_xxxxx
                  paymentMethodType: CARD
                  returnUrl: https://merchant.example.com/payment/return
                  merchantReferenceId: pay_ref_123
                  platformType: WEB
                  deviceType: Android
              amountPayment:
                summary: Use direct amount and currency
                value:
                  customerEmail: customer@example.com
                  paymentInstrumentId: pi_xxxxx
                  paymentMethodType: CARD
                  amount: 19.99
                  currency: USD
                  returnUrl: https://merchant.example.com/payment/return
                  priceDataList:
                    - name: One-time service
                      quantity: 1
                      unitAmount: 19.99
                      currency: USD
                  platformType: WEB
                  deviceType: Android
              convertedCurrencyPayment:
                summary: Use a specified payment currency
                value:
                  customerId: cus_xxxxx
                  productId: prd_xxxxx
                  priceId: price_xxxxx
                  paymentInstrumentId: pi_xxxxx
                  paymentMethodType: CARD
                  paymentCurrency: HKD
                  returnUrl: https://merchant.example.com/payment/return
                  platformType: WEB
                  deviceType: Android
              pixPayment:
                summary: Create a PIX payment
                value:
                  customerEmail: customer@example.com
                  paymentInstrumentId: pi_pix_xxxxx
                  paymentMethodType: PIX
                  amount: 100
                  currency: BRL
                  returnUrl: https://merchant.example.com/payment/return
                  priceDataList:
                    - name: PIX payment
                      quantity: 1
                      unitAmount: 100
                      currency: BRL
                  platformType: WEB
                  deviceType: Android
              upiPayment:
                summary: Create a UPI payment
                value:
                  customerEmail: customer@example.com
                  paymentInstrumentId: pi_upi_xxxxx
                  paymentMethodType: UPI
                  amount: 1000
                  currency: INR
                  returnUrl: https://merchant.example.com/payment/return
                  priceDataList:
                    - name: UPI payment
                      quantity: 1
                      unitAmount: 1000
                      currency: INR
                  platformType: WEB
                  deviceType: Android
      responses:
        '200':
          description: Payment created successfully
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/CreatePaymentApiResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePaymentApiResponse'
        '401':
          description: Unauthorized
          content:
            '*/*':
              schema:
                type: string
components:
  parameters:
    TimestampHeader:
      name: X-Timestamp
      in: header
      required: true
      description: >-
        Current timestamp in milliseconds since Unix epoch (required for request
        signing)
      schema:
        type: string
        example: '1783513683000'
  schemas:
    CreatePaymentApiRequest:
      required:
        - paymentInstrumentId
        - paymentMethodType
        - returnUrl
      type: object
      description: >-
        Parameters required to create a one-time payment by API. Provide at
        least one customer identifier. Provide either priceId with productId, or
        amount with currency. Use paymentCurrency to charge the customer in a
        different supported payment currency.
      properties:
        customerId:
          type: string
          description: Existing customer ID. At least one customer identifier is required.
        customerEmail:
          type: string
          description: >-
            Customer email. Used to resolve or create a customer when customerId
            is not provided.
        referenceCustomerId:
          type: string
          description: >-
            Merchant-side customer ID used to resolve, create, or bind a
            customer.
        paymentInstrumentId:
          type: string
          description: Existing payment instrument ID.
        paymentMethodType:
          type: string
          description: Payment method type. Supported values are uppercase.
          enum:
            - ALIPAY
            - CARD
            - CASHAPP
            - GCASH
            - KAKAO
            - PIX
            - PROMPTPAY
            - QRIS
            - TNG
            - UPI
            - WECHAT
        priceId:
          type: string
          description: Predefined one-time price ID. If provided, productId is required.
        productId:
          type: string
          description: Product ID. Required when priceId is provided.
        priceDataList:
          type: array
          description: >-
            Product and price line items for direct amount payments or
            display/risk data.
          items:
            $ref: '#/components/schemas/PriceData'
        amount:
          type: number
          description: >-
            Direct payment amount. Required with currency when priceId is not
            provided.
        currency:
          type: string
          description: >-
            Original pricing currency. Required with amount when priceId is not
            provided. If paymentCurrency is not provided, this currency is also
            used as the payment currency.
        paymentCurrency:
          type: string
          description: >-
            Optional target payment currency. When provided, Clink uses the
            configured fixed multi-currency price when available, otherwise
            automatically converts from the original pricing currency. The
            requested payment method must support the target currency.
          example: HKD
        merchantReferenceId:
          type: string
          description: Merchant-side reference ID for reconciliation.
        returnUrl:
          type: string
          description: URL where the customer is redirected after required payment actions.
        promotionCode:
          type: string
          description: Promotion code to apply.
        metadata:
          type: object
          description: Merchant metadata. Values must be strings.
          additionalProperties:
            type: string
        platformType:
          type: string
          description: Platform type. Supported values are WEB and WAP.
          enum:
            - WEB
            - WAP
        deviceType:
          type: string
          description: Device type. Supported values are Android and iOS.
          enum:
            - Android
            - iOS
    CreatePaymentApiResponse:
      type: object
      properties:
        code:
          type: integer
          description: Response status code, 200 when success
          format: int32
          example: 200
        msg:
          type: string
          example: success
          description: Brief description of what happened, 'success' when happy case
        data:
          $ref: '#/components/schemas/CreatePaymentApiVo'
    PriceData:
      required:
        - name
        - unitAmount
      type: object
      properties:
        name:
          type: string
          description: Display name of the product shown to customers during checkout
        quantity:
          minimum: 1
          type: integer
          description: Number of units to be purchased (minimum 1)
          format: int32
        unitAmount:
          minimum: 0
          exclusiveMinimum: true
          type: number
          description: Price per unit in the specified currency (must be greater than 0)
        currency:
          type: string
          description: Three-letter ISO currency code for the price (e.g., USD, EUR, GBP)
        imageUrl:
          type: string
          description: URL of the product image to display during checkout
    CreatePaymentApiVo:
      type: object
      description: >-
        Response data returned after creating a one-time payment. It contains
        the order and session identifiers, together with the payment flow
        result.
      properties:
        orderId:
          type: string
          description: Unique identifier of the created order
        sessionId:
          type: string
          description: Unique identifier of the related payment session
        status:
          type: integer
          format: int32
          description: >-
            Payment result status. `1` means success, `2` means pending, `3`
            means failure, and `5` means need next action to complete payment.
          enum:
            - 1
            - 2
            - 3
            - 5
        action:
          $ref: '#/components/schemas/Action'
          description: >-
            Next action required to complete payment when status is `5`
            (NEXT_ACTION).
        amount:
          type: number
          description: Amount charged for this one-time payment
        currency:
          type: string
          description: Actual currency used for the payment
    Action:
      type: object
      description: >-
        Describes the next client action required to continue or complete a
        payment flow. It is typically returned when the status is NEXT_ACTION.
      properties:
        redirectUrl:
          type: string
          description: >-
            Redirect URL that the client should open or navigate to for the next
            payment step.
        method:
          type: string
          description: HTTP method used to perform the next action.
          enum:
            - GET
            - POST
        type:
          type: string
          description: Payment method or action type that triggered this next step.
          enum:
            - ALIPAY
            - CARD
            - CASHAPP
            - GCASH
            - KAKAO
            - PIX
            - PROMPTPAY
            - QRIS
            - TNG
            - UPI
            - WECHAT
        walletHandleRedirectOrDisplayQrCode:
          $ref: '#/components/schemas/WalletHandleRedirectOrDisplayQrCode'
          description: >-
            Wallet-side display or redirect payload used for QR code rendering,
            mobile auth links, hosted instructions, or fallback URLs.
        paymentMethodType:
          type: string
          description: Payment method type associated with this action.
        postData:
          type: object
          description: Form or request parameters to submit when `method` is `POST`.
          additionalProperties:
            type: string
    WalletHandleRedirectOrDisplayQrCode:
      type: object
      description: Wallet response payload for redirect flows or QR code display flows.
      properties:
        imageUrlPng:
          type: string
          description: >-
            PNG QR code image URL. This field may also contain a Base64-encoded
            image string.
        imageUrlSvg:
          type: string
          description: >-
            SVG QR code image URL. This field may also contain a Base64-encoded
            image string.
        imageDataUrl:
          type: string
          description: Base64-encoded QR code image data URL.
        hostedInstructionsUrl:
          type: string
          description: Hosted instruction or guidance URL for H5 redirection flows.
        mobileAuthUrl:
          type: string
          description: Mobile authorization URL or deeplink used by mobile redirect flows.
        fallbackUrl:
          type: string
          description: Fallback HTTPS URL used when app redirection fails.
        packageName:
          type: string
          description: Android package name used by mobile app redirect flows.
        expiresAt:
          type: integer
          format: int64
          description: Expiration time in Unix seconds.
        expiresSecond:
          type: integer
          format: int64
          description: Optional countdown in seconds until expiration.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Your secret API key obtained from the Clink dashboard (Developers
        section)

````