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

# Create Payment

> Use this API to initiate a payment transaction for an existing order using the order hash. This API processes the payment using the specified payment method and returns transaction details including redirect URLs for payment completion.




## OpenAPI

````yaml /openapi/payments/flowwise.yaml post /order/pay/{order_hash}
openapi: 3.0.3
info:
  title: Flowwise Native API
  version: 1.0.0
  description: >
    Manage orders, payments, refunds, and customers using the Flowwise Native
    API.

    [Source](https://cashfree.atlassian.net/wiki/spaces/ORC/pages/1084032020/API+Documentation)
servers:
  - url: https://sandbox.flowwise.com/router
    description: Sandbox
  - url: https://app.flowwise.com/router
    description: Production
security:
  - ApiKeyAuth: []
    ApiSecret: []
paths:
  /order/pay/{order_hash}:
    post:
      summary: Create Payment
      description: >
        Use this API to initiate a payment transaction for an existing order
        using the order hash. This API processes the payment using the specified
        payment method and returns transaction details including redirect URLs
        for payment completion.
      parameters:
        - $ref: '#/components/parameters/OrderHash'
      requestBody:
        required: true
        description: Request parameters to create a new payment.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentRequest'
            example:
              payment_method: upi
              payment_method_details:
                upi_id: priya.sharma@paytm
                app_name: PhonePe
              return_base_url: https://mystore.com/payment-success
      responses:
        '200':
          description: Success response for payment creation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePaymentResponse'
              example:
                payment_id: pay_summer_fashion_001_upi
                order_id: order_summer_fashion_001
                payment_method: upi
                payment_amount: 2299.5
                payment_status: SUCCESS
                capture_status: SUCCESS
                capture_amount: 2299.5
                processor_ref: UPI434512345678901234
                redirect_url: >-
                  https://payments.flowwise.com/redirect/pay_summer_fashion_001_upi
                return_url: >-
                  https://mystore.com/payment-success?order_id=order_summer_fashion_001
                payload: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...
                payment_time: '2024-12-03T14:32:15Z'
                order_expiry_time: '2024-12-03T16:30:00Z'
        '400':
          description: Bad Request - Invalid payment request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Invalid payment method details provided
                code: invalid_payment_method
                type: validation_error
        '401':
          description: Unauthorized - Invalid or missing authentication credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Invalid API credentials provided
                code: unauthorized
                type: authentication_error
        '404':
          description: Not Found - Order not found or expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Order not found or has expired
                code: order_not_found
                type: resource_error
        '500':
          description: Internal Server Error - Payment processing failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Payment processing failed due to server error
                code: payment_failed
                type: server_error
      security:
        - ApiKeyAuth: []
          ApiSecret: []
components:
  parameters:
    OrderHash:
      name: order_hash
      in: path
      required: true
      description: Hash value for the order used for payment processing.
      schema:
        type: string
        example: a7f8e3d2c1b9f4e6d8a2c5b7f9e3d1a8
  schemas:
    CreatePaymentRequest:
      type: object
      required:
        - payment_method
        - payment_method_details
      properties:
        payment_method:
          type: string
          enum:
            - upi
            - card
            - netbanking
            - wallet
          description: Payment method to be used for the transaction.
          example: upi
        payment_method_details:
          type: object
          description: >-
            Details specific to the payment method. For structure information,
            see the documentation.
          example:
            upi_id: priya.sharma@paytm
            app_name: PhonePe
        return_base_url:
          type: string
          format: uri
          description: >-
            Base URL where the customer will be redirected after payment
            completion.
          example: https://mystore.com/payment-success
    CreatePaymentResponse:
      type: object
      properties:
        payment_id:
          type: string
          description: Unique identifier for the payment transaction.
          example: pay_summer_fashion_001_upi
        order_id:
          type: string
          description: Unique identifier for the associated order.
          example: order_summer_fashion_001
        payment_method:
          type: string
          description: Payment method used for the transaction.
          example: upi
        payment_amount:
          type: number
          description: Amount processed for the payment.
          example: 2299.5
        payment_status:
          type: string
          description: Current status of the payment transaction.
          example: SUCCESS
        capture_status:
          type: string
          description: Status of the payment capture process.
          example: SUCCESS
        capture_amount:
          type: number
          description: Amount that has been captured from the payment.
          example: 2299.5
        processor_ref:
          type: string
          description: Reference identifier from the payment processor.
          example: UPI434512345678901234
        redirect_url:
          type: string
          format: uri
          description: URL to redirect the customer for payment completion.
          example: https://payments.flowwise.com/redirect/pay_summer_fashion_001_upi
        return_url:
          type: string
          format: uri
          description: URL where the customer will be redirected after payment completion.
          example: >-
            https://mystore.com/payment-success?order_id=order_summer_fashion_001
        payload:
          type: string
          description: Additional payload data for the payment.
          example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...
        payment_time:
          type: string
          format: date-time
          description: Date and time when the payment was initiated.
          example: '2024-12-03T14:32:15Z'
        order_expiry_time:
          type: string
          format: date-time
          description: Date and time when the order expires.
          example: '2024-12-03T16:30:00Z'
    ErrorResponse:
      type: object
      description: Error response structure returned when an API request fails.
      properties:
        message:
          type: string
          description: Human-readable error message describing what went wrong.
        code:
          type: string
          description: Machine-readable error code for programmatic handling.
        type:
          type: string
          description: Category or type of error that occurred.
      required:
        - message
        - code
        - type
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-client-id
      description: >-
        Client app ID. You can find your app ID in the [Merchant
        Dashboard](https://merchant.cashfree.com/auth/login/pg/developers/api-keys?env=prod).
    ApiSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: >-
        Client secret key. You can find your secret key in the [Merchant
        Dashboard](https://merchant.cashfree.com/auth/login/pg/developers/api-keys?env=prod).

````