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

> Create a one-time payment with an existing payment instrument, or omit paymentInstrumentId for payment methods that support automatic payment instrument creation. 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. You can provide billingAddress for the payment instrument and tax calculation.



## 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, or omit
        paymentInstrumentId for payment methods that support automatic payment
        instrument creation. 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. You can provide billingAddress
        for the payment instrument and tax calculation.
      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
                  billingAddress:
                    city: San Francisco
                    region: CA
                    country: US
                    line1: 123 Market Street
                    line2: Suite 100
                    postalCode: '94105'
                  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
              applePayPayment:
                summary: Apple Pay (self-decrypt)
                value:
                  customerId: cus_xxxxx
                  productId: prd_xxxxx
                  priceId: price_xxxxx
                  paymentMethodType: APPLEPAY
                  additionalPaymentInstrument:
                    tokenValue: >-
                      {"paymentData":{"version":"EC_v1","data":"...","signature":"...","header":{"ephemeralPublicKey":"...","publicKeyHash":"...","transactionId":"..."}},"paymentMethod":{"displayName":"Visa
                      1234","network":"Visa","type":"debit"},"transactionIdentifier":"..."}
                  platformType: WEB
                  deviceType: iOS
              googlePayPayment:
                summary: Google Pay (self-decrypt)
                value:
                  customerEmail: customer@example.com
                  amount: 19.99
                  currency: USD
                  paymentMethodType: GOOGLEPAY
                  additionalPaymentInstrument:
                    tokenValue: >-
                      {"protocolVersion":"ECv2","signature":"...","intermediateSigningKey":{"signedKey":"...","signatures":["..."]},"signedMessage":"..."}
                  platformType: WEB
                  deviceType: Android
              cashappPaymentAutoPaymentInstrument:
                summary: >-
                  Create a Cash App payment and automatically create the payment
                  instrument
                value:
                  customerId: cus_xxxxx
                  productId: prd_xxxxx
                  priceId: price_xxxxx
                  paymentMethodType: CASHAPP
                  returnUrl: https://merchant.example.com/payment/return
                  merchantReferenceId: pay_ref_124
                  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:
        - paymentMethodType
      type: object
      allOf:
        - if:
            properties:
              paymentMethodType:
                enum:
                  - APPLEPAY
                  - GOOGLEPAY
            required:
              - paymentMethodType
          then:
            required:
              - additionalPaymentInstrument
            properties:
              additionalPaymentInstrument:
                required:
                  - tokenValue
          else:
            required:
              - returnUrl
      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. Required for CARD and other methods
            that do not support automatic creation. For APPLEPAY and GOOGLEPAY
            it is optional: when omitted, Clink creates the wallet payment
            instrument from additionalPaymentInstrument.tokenValue; if provided,
            it must belong to the customer and match paymentMethodType.
        paymentMethodType:
          type: string
          description: >-
            Payment method type (uppercase). CARD requires a previously saved
            card and its paymentInstrumentId. APPLEPAY and GOOGLEPAY require
            additionalPaymentInstrument.tokenValue and support automatic payment
            instrument creation.
          enum:
            - ALIPAY
            - APPLEPAY
            - CARD
            - CASHAPP
            - GCASH
            - GOOGLEPAY
            - KAKAO
            - KCP
            - 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.
        productUrl:
          type: string
          maxLength: 2048
          description: >-
            URL of the product page. Used for the product name link in the
            receipt email when the matching line item has no productUrl.
            Standard products fall back to the product's own productUrl when
            omitted. Must start with http:// or https:// (scheme is
            case-insensitive) and be at most 2048 characters. Requests whose
            productUrl uses any other scheme are rejected.
        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.
            Required for all payment methods except APPLEPAY and GOOGLEPAY,
            which are settled synchronously and do not redirect.
        additionalPaymentInstrument:
          $ref: '#/components/schemas/WalletTokenPayload'
        promotionCode:
          type: string
          description: Promotion code to apply.
        metadata:
          type: object
          description: Merchant metadata. Values must be strings.
          additionalProperties:
            type: string
        billingAddress:
          $ref: '#/components/schemas/BillingAddressJson'
          description: >-
            Optional billing address used for the payment instrument and this
            payment's tax calculation. This address takes precedence over the
            existing payment instrument address, customer billing address, and
            request IP country for this payment. When Clink automatically
            creates a payment instrument, the address is saved to the new
            payment instrument. When paymentInstrumentId references an existing
            payment instrument, this address does not update that payment
            instrument.
        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
        productUrl:
          type: string
          maxLength: 2048
          description: >-
            URL of the product page for this line item. Renders that product
            name as a link in the receipt email and takes precedence over the
            session-level productUrl. Must start with http:// or https://
            (scheme is case-insensitive) and be at most 2048 characters.
            Requests whose productUrl uses any other scheme are rejected.
    WalletTokenPayload:
      type: object
      description: >-
        Complete wallet token for APPLEPAY / GOOGLEPAY, as returned by the
        wallet SDK. The token is single-use: generate a new one for every
        payment attempt.
      properties:
        tokenValue:
          type: string
          minLength: 1
          description: >-
            The complete wallet token as a string. Apple Pay:
            JSON.stringify(payment.token) (the PKPaymentToken). Google Pay: the
            raw tokenizationData.token (ECv2 JSON).
    BillingAddressJson:
      type: object
      description: >-
        Billing address information used for a payment instrument and tax
        calculation.
      properties:
        city:
          type: string
          description: City.
          example: San Francisco
        country:
          type: string
          description: Country code or name.
          example: US
        line1:
          type: string
          description: First line of the street address.
          example: 123 Market Street
        line2:
          type: string
          description: Second line of the street address.
          example: Suite 100
        postalCode:
          type: string
          description: Postal or zip code.
          example: '94105'
        region:
          type: string
          description: Region, state, or province.
          example: CA
    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
        paymentInstrumentId:
          type: string
          description: >-
            Payment instrument ID used for the one-time payment. When
            paymentInstrumentId is omitted for an auto-creatable payment method,
            this is the automatically created payment instrument ID.
        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)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.