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

# Raise a charge or create an auth.

> Use this API to create an auth or to raise a charge.



## OpenAPI

````yaml /openapi/payments/v2023-08-01.yaml post /subscriptions/pay
openapi: 3.0.0
info:
  version: '2023-08-01'
  title: Cashfree Payment Gateway APIs
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  contact:
    email: developers@cashfree.com
    name: API Support
    url: https://discord.com/invite/QdZkNSxXsB
  description: >-
    Cashfree's Payment Gateway APIs provide developers with a streamlined
    pathway to integrate advanced payment processing capabilities into their
    applications, platforms and websites.
servers:
  - url: https://sandbox.cashfree.com/pg
    description: Sandbox server
  - url: https://api.cashfree.com/pg
    description: Production server
security: []
tags:
  - name: Orders
    description: Collection of APIs to handle orders.
  - name: Payments
    description: Collection of APIs to handle payments.
  - name: Refunds
    description: Collection of APIs to handle refunds.
  - name: Settlements
    description: Collection of APIs to handle settlements.
  - name: Payment Links
    description: Collection of APIs to handle payment links.
  - name: Token Vault
    description: >-
      Collection of APIs to use Cashfree's token Vault. This helps you save
      cards and tokenize them in a PCI complaint manner. We support creation of
      network tokens which can be used across acquiring banks
  - name: softPOS
    description: Collection of APIs to manage softPOS' agent and order
  - name: Offers
    description: Collection of APIs to handle offers
  - name: Eligibility
    description: >-
      Collection of APIs to check eligibile entities - payment methods, offer,
      affordibility
  - name: Settlement Reconciliation
    description: Collection of APIs to handle settlements
  - name: PG Reconciliation
    description: Collection of APIs to handle reconciliation
  - name: Customers
    description: Collection of APIs to handle customers.
  - name: Easy-Split
    description: Collection of APIs to handle Easy-Split.
  - name: Simulation
    description: Collection of APIs to handle simulation.
  - name: Disputes
    description: Collection of APIs to handle disputes.
externalDocs:
  url: https://api.cashfree.com/pg
  description: This url will have the information of all the APIs.
paths:
  /subscriptions/pay:
    post:
      tags:
        - Subscription
      summary: Raise a charge or create an auth.
      description: Use this API to create an auth or to raise a charge.
      operationId: SubsCreatePayment
      parameters:
        - $ref: '#/components/parameters/apiVersionHeader'
        - $ref: '#/components/parameters/xRequestIDHeader'
        - $ref: '#/components/parameters/xIdempotencyKeyHeader'
      requestBody:
        $ref: '#/components/requestBodies/CreateSubscriptionPaymentRequest'
      responses:
        '200':
          description: response of created payment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubscriptionPaymentResponse'
          headers:
            x-api-version:
              $ref: '#/components/headers/x-api-version'
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-retry:
              $ref: '#/components/headers/x-ratelimit-retry'
            x-ratelimit-type:
              $ref: '#/components/headers/x-ratelimit-type'
            x-request-id:
              $ref: '#/components/headers/x-request-id'
            x-idempotency-key:
              $ref: '#/components/headers/x-idempotency-key'
            x-idempotency-replayed:
              $ref: '#/components/headers/x-idempotency-replayed'
        '400':
          $ref: '#/components/responses/Response400'
        '401':
          $ref: '#/components/responses/Response401'
        '404':
          $ref: '#/components/responses/Response404'
        '422':
          $ref: '#/components/responses/Response422'
        '429':
          $ref: '#/components/responses/Response429'
        '500':
          $ref: '#/components/responses/Response500'
      deprecated: false
      security:
        - XClientID: []
          XClientSecret: []
        - XClientID: []
          XPartnerAPIKey: []
        - XClientID: []
          XClientSignatureHeader: []
        - XPartnerMerchantID: []
          XPartnerAPIKey: []
components:
  parameters:
    apiVersionHeader:
      in: header
      name: x-api-version
      required: true
      description: API version to be used. Format is in YYYY-MM-DD
      schema:
        type: string
        description: API version to be used
        default: '2023-08-01'
      example: '2023-08-01'
    xRequestIDHeader:
      in: header
      name: x-request-id
      description: >-
        Request id for the API call. Can be used to resolve tech issues.
        Communicate this in your tech related queries to cashfree
      required: false
      schema:
        type: string
      example: 4dfb9780-46fe-11ee-be56-0242ac120002
    xIdempotencyKeyHeader:
      in: header
      name: x-idempotency-key
      required: false
      description: >
        An idempotency key is a unique identifier you include with your API
        call.

        If the request fails or times out, you can safely retry it using the
        same key to avoid duplicate actions.
      schema:
        type: string
        format: UUID
      example: 47bf8872-46fe-11ee-be56-0242ac120002
  requestBodies:
    CreateSubscriptionPaymentRequest:
      description: Request body to create a subscription payment.
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateSubscriptionPaymentRequest'
          examples:
            create_subscription_charge:
              $ref: '#/components/examples/create_subscription_charge'
            create_subscription_auth:
              $ref: '#/components/examples/create_subscription_auth'
  schemas:
    CreateSubscriptionPaymentResponse:
      title: CreateSubscriptionPaymentResponse
      description: The response returned is Create Subscription Auth or Charge APIs.
      type: object
      example:
        payment_id: test-paymey
        subscription_id: Demo_Subscription
        payment_amount: 1
        cf_payment_id: '12345'
        payment_method: upi
        payment_status: SUCCESS
        payment_type: AUTH
        action: custom
        channel: link
        data:
          url: >-
            https://api.cashfree.com/pg/view/gateway/tuOssT3fNV8soG97VSeHca034555-8a65-4aaf-9e67-c9893471af23
          payload: null
          content_type: null
          method: null
      properties:
        cf_payment_id:
          type: string
          description: Cashfree subscription payment reference number
        failure_details:
          type: object
          properties:
            failure_reason:
              type: string
              description: Failure reason of the payment if the payment_status is failed.
        payment_amount:
          type: number
          format: float64
          description: The charge amount of the payment.
        payment_id:
          type: string
          description: A unique ID passed by merchant for identifying the transaction.
        payment_initiated_date:
          type: string
          description: The date on which the payment was initiated.
        payment_status:
          type: string
          description: Status of the payment.
        payment_type:
          type: string
          description: Payment type. Can be AUTH or CHARGE.
          example: CHARGE
        subscription_id:
          type: string
          description: A unique ID passed by merchant for identifying the subscription.
        data:
          type: object
          description: >-
            Contains a payload for auth app links in case of AUTH. For charge,
            the payload is empty.
        payment_method:
          type: string
          description: Payment method used for the authorization.
    CreateSubscriptionPaymentRequest:
      title: CreateSubscriptionPaymentRequest
      type: object
      description: The request to be passed for the create subscription payment API.
      properties:
        subscription_id:
          type: string
          description: A unique ID passed by merchant for identifying the subscription.
        subscription_session_id:
          type: string
          description: Session ID for the subscription. Required only for Auth.
        payment_id:
          type: string
          description: >-
            A unique ID passed by merchant for identifying the subscription
            payment.
        payment_amount:
          type: number
          format: float64
          description: The charge amount of the payment. Required in case of charge.
        payment_schedule_date:
          type: string
          description: >-
            The date on which the payment is scheduled to be processed. Required
            for UPI and CARD payment modes.
        payment_remarks:
          type: string
          description: Payment remarks.
        payment_type:
          type: string
          description: Payment type. Can be AUTH or CHARGE.
        payment_method:
          type: object
          description: >-
            Payment method. Can be one of ["upi", "enach", "pnach", "card"].
            This field is not required when raising a charge. It is only
            mandatory when raising an authorization. In the case of a charge,
            this field is ignored, and the charge will be created using the same
            payment method that was used for the original authorization.
          oneOf:
            - $ref: '#/components/schemas/RequestUpi'
            - $ref: '#/components/schemas/RequestEnach'
            - $ref: '#/components/schemas/RequestPnach'
            - $ref: '#/components/schemas/RequestCard'
      required:
        - subscription_id
        - payment_id
        - payment_type
    BadRequestError:
      title: BadRequestError
      description: Invalid request received from client
      example:
        message: bad URL, please check API documentation
        code: request_failed
        type: invalid_request_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          enum:
            - invalid_request_error
    AuthenticationError:
      title: AuthenticationError
      description: Error if api keys are wrong
      example:
        message: authentication Failed
        code: request_failed
        type: authentication_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          description: authentication_error
    ApiError404:
      title: ApiError404
      description: Error when resource requested is not found
      example:
        message: something is not found
        code: somethind_not_found
        type: invalid_request_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          enum:
            - invalid_request_error
          description: invalid_request_error
    IdempotencyError:
      title: IdempotencyError
      description: >-
        Error when idempotency fails. Different request body with the same
        idempotent key
      example:
        message: something is not found
        code: request_invalid
        type: idempotency_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          enum:
            - idempotency_error
          description: idempotency_error
    RateLimitError:
      title: RateLimitError
      description: Error when rate limit is breached for your api
      example:
        message: Too many requests from IP. Check headers
        code: request_failed
        type: rate_limit_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          enum:
            - rate_limit_error
          description: rate_limit_error
    ApiError:
      title: ApiError
      description: Error at cashfree's server
      example:
        message: internal Server Error
        code: internal_error
        type: api_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          enum:
            - api_error
          description: api_error
    RequestUpi:
      title: RequestUpi
      description: payment method upi.
      type: object
      example:
        upi:
          channel: collect
          upi_id: shaneyd@okxdfcbank
      properties:
        upi:
          $ref: '#/components/schemas/SubsUPIMethod'
    RequestEnach:
      title: RequestEnach
      description: payment method enach.
      type: object
      example:
        enach:
          channel: link
          auth_mode: net_banking
          account_holder_name: Sushane Yadav
          account_number: 1234567890
          account_bank_code: ICIC
          account_type: SAVINGS
      properties:
        enach:
          $ref: '#/components/schemas/SubsEnachMethod'
    RequestPnach:
      title: RequestPnach
      description: payment method pnach.
      type: object
      example:
        pnach:
          channel: post
          account_holder_name: Sushane Yadav
          account_number: 1234567890
          account_bank_code: ICIC
          account_type: SAVINGS
          account_ifsc: ICIC0000001
          mandate_creation_date: '2024-06-14'
          mandate_start_date: '2024-06-14'
      properties:
        pnach:
          $ref: '#/components/schemas/SubsPnachMethod'
    RequestCard:
      title: RequestCard
      description: payment method card.
      type: object
      example:
        card:
          channel: link
          card_number: 4111111111111111
          card_holder_name: Sushane Yadav
          card_expiry_mm: 6
          card_expiry_yy: 28
          card_cvv: 900
          card_network: visa
          card_type: credit card
      properties:
        card:
          $ref: '#/components/schemas/SubsCardMethod'
    SubsUPIMethod:
      title: SubsUPIMethod
      description: payment method upi.
      example:
        channel: collect
        upi_id: shaneyd@okxdfcbank
      type: object
      properties:
        channel:
          type: string
          enum:
            - link
            - collect
            - qrcode
          description: >-
            Specify the channel through which the payment must be processed. Can
            be one of ["link", "collect", "qrcode"]
        upi_id:
          type: string
          description: |
            Customer UPI VPA to process payment. 
            ### Important
            This is a required parameter for channel = `collect`
    SubsEnachMethod:
      title: SubsEnachMethod
      description: payment method enach.
      example:
        channel: link
        auth_mode: net_banking
        account_holder_name: Sushane Yadav
        account_number: 1234567890
        account_bank_code: ICIC
        account_type: SAVINGS
      type: object
      properties:
        channel:
          type: string
          description: Channel. can be link
        auth_mode:
          type: string
          description: Auth mode. can be net_banking
        account_holder_name:
          type: string
          description: Account holder name
        account_number:
          type: string
          description: Account number
        account_bank_code:
          type: string
          description: Account bank code
        account_type:
          type: string
          description: Account type
    SubsPnachMethod:
      title: SubsPnachMethod
      description: payment method pnach.
      example:
        channel: post
        account_holder_name: Sushane Yadav
        account_number: 1234567890
        account_bank_code: ICIC
        account_type: SAVINGS
        account_ifsc: ICIC0000001
        mandate_creation_date: '2024-06-14'
        mandate_start_date: '2024-06-14'
      type: object
      properties:
        channel:
          type: string
          description: Channel. can be post
        account_holder_name:
          type: string
          description: Account holder name
        account_number:
          type: string
          description: Account number
        account_bank_code:
          type: string
          description: Account bank code
        account_type:
          type: string
          description: Account type
        account_ifsc:
          type: string
          description: Account IFSC
        mandate_creation_date:
          type: string
          description: Mandate creation date
        mandate_start_date:
          type: string
          description: Mandate start date
    SubsCardMethod:
      title: SubsCardMethod
      description: payment method card.
      example:
        channel: link
        card_number: 4111111111111111
        card_holder_name: Sushane Yadav
        card_expiry_mm: 6
        card_expiry_yy: 28
        card_cvv: 900
        card_network: visa
        card_type: credit card
      type: object
      properties:
        channel:
          type: string
          description: Channel. can be link
        card_number:
          type: string
          description: Card number
        card_holder_name:
          type: string
          description: Card holder name
        card_expiry_mm:
          type: string
          description: Card expiry month
        card_expiry_yy:
          type: string
          description: Card expiry year
        card_cvv:
          type: string
          description: Card CVV
        card_network:
          type: string
          description: Card network
        card_type:
          type: string
          description: Card type
  headers:
    x-api-version:
      schema:
        type: string
        format: YYYY-MM-DD
        enum:
          - '2022-09-01'
      description: >-
        This header has the version of the API. The current version is
        `2022-09-01`.
    x-ratelimit-limit:
      schema:
        type: integer
      example: 200
      description: Ratelimit set for your account for this API per minute
    x-ratelimit-remaining:
      schema:
        type: integer
      example: 2
      description: >-
        Rate limit remaning for your account for this API in the next minute.
        Uses sliding window
    x-ratelimit-retry:
      schema:
        type: integer
      example: 4
      description: |
        Contains number of seconds to wait if rate limit is breached
        - Is 0 if withing the limit
        - Is between 1 and 59 if breached
    x-ratelimit-type:
      schema:
        type: string
        enum:
          - app_id
          - ip
      example: ip
      description: >
        either ip or app_id

        - `ip` if making a call from the browser. True for api where you don't
        need `x-client-id` and `x-client-secret`

        - `app_id` for authenticated api calls i.e using `x-client-id` and
        `x-client-secret`
    x-request-id:
      schema:
        type: string
      example: some-req-id
      description: >-
        Request id for your api call. Is blank or null if no `x-request-id` is
        sent during the request
    x-idempotency-key:
      schema:
        type: string
      example: some-idem-id
      description: >-
        An idempotency key is a unique identifier you include with your API
        call. If the request fails or times out, you can safely retry it using
        the same key to avoid duplicate actions.
    x-idempotency-replayed:
      schema:
        type: string
        format: boolean
      example: 'true'
      description: |-
        In conjunction with `x-idempotency-key` this means
        - `true` if the response was replayed
        - `false` if the response has not been replayed
  responses:
    Response400:
      description: Bad request error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
      headers:
        x-api-version:
          $ref: '#/components/headers/x-api-version'
        x-ratelimit-limit:
          $ref: '#/components/headers/x-ratelimit-limit'
        x-ratelimit-remaining:
          $ref: '#/components/headers/x-ratelimit-remaining'
        x-ratelimit-retry:
          $ref: '#/components/headers/x-ratelimit-retry'
        x-ratelimit-type:
          $ref: '#/components/headers/x-ratelimit-type'
        x-request-id:
          $ref: '#/components/headers/x-request-id'
        x-idempotency-key:
          $ref: '#/components/headers/x-idempotency-key'
        x-idempotency-replayed:
          $ref: '#/components/headers/x-idempotency-replayed'
    Response401:
      description: Authentication Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthenticationError'
      headers:
        x-api-version:
          $ref: '#/components/headers/x-api-version'
        x-ratelimit-limit:
          $ref: '#/components/headers/x-ratelimit-limit'
        x-ratelimit-remaining:
          $ref: '#/components/headers/x-ratelimit-remaining'
        x-ratelimit-retry:
          $ref: '#/components/headers/x-ratelimit-retry'
        x-ratelimit-type:
          $ref: '#/components/headers/x-ratelimit-type'
        x-request-id:
          $ref: '#/components/headers/x-request-id'
        x-idempotency-key:
          $ref: '#/components/headers/x-idempotency-key'
        x-idempotency-replayed:
          $ref: '#/components/headers/x-idempotency-replayed'
    Response404:
      description: Resource Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError404'
      headers:
        x-api-version:
          $ref: '#/components/headers/x-api-version'
        x-ratelimit-limit:
          $ref: '#/components/headers/x-ratelimit-limit'
        x-ratelimit-remaining:
          $ref: '#/components/headers/x-ratelimit-remaining'
        x-ratelimit-retry:
          $ref: '#/components/headers/x-ratelimit-retry'
        x-ratelimit-type:
          $ref: '#/components/headers/x-ratelimit-type'
        x-request-id:
          $ref: '#/components/headers/x-request-id'
        x-idempotency-key:
          $ref: '#/components/headers/x-idempotency-key'
        x-idempotency-replayed:
          $ref: '#/components/headers/x-idempotency-replayed'
    Response422:
      description: Idempotency error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IdempotencyError'
      headers:
        x-api-version:
          $ref: '#/components/headers/x-api-version'
        x-ratelimit-limit:
          $ref: '#/components/headers/x-ratelimit-limit'
        x-ratelimit-remaining:
          $ref: '#/components/headers/x-ratelimit-remaining'
        x-ratelimit-retry:
          $ref: '#/components/headers/x-ratelimit-retry'
        x-ratelimit-type:
          $ref: '#/components/headers/x-ratelimit-type'
        x-request-id:
          $ref: '#/components/headers/x-request-id'
        x-idempotency-key:
          $ref: '#/components/headers/x-idempotency-key'
        x-idempotency-replayed:
          $ref: '#/components/headers/x-idempotency-replayed'
    Response429:
      description: Rate Limit Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
      headers:
        x-api-version:
          $ref: '#/components/headers/x-api-version'
        x-ratelimit-limit:
          $ref: '#/components/headers/x-ratelimit-limit'
        x-ratelimit-remaining:
          $ref: '#/components/headers/x-ratelimit-remaining'
        x-ratelimit-retry:
          $ref: '#/components/headers/x-ratelimit-retry'
        x-ratelimit-type:
          $ref: '#/components/headers/x-ratelimit-type'
        x-request-id:
          $ref: '#/components/headers/x-request-id'
        x-idempotency-key:
          $ref: '#/components/headers/x-idempotency-key'
        x-idempotency-replayed:
          $ref: '#/components/headers/x-idempotency-replayed'
    Response500:
      description: API related Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
      headers:
        x-api-version:
          $ref: '#/components/headers/x-api-version'
        x-ratelimit-limit:
          $ref: '#/components/headers/x-ratelimit-limit'
        x-ratelimit-remaining:
          $ref: '#/components/headers/x-ratelimit-remaining'
        x-ratelimit-retry:
          $ref: '#/components/headers/x-ratelimit-retry'
        x-ratelimit-type:
          $ref: '#/components/headers/x-ratelimit-type'
        x-request-id:
          $ref: '#/components/headers/x-request-id'
        x-idempotency-key:
          $ref: '#/components/headers/x-idempotency-key'
        x-idempotency-replayed:
          $ref: '#/components/headers/x-idempotency-replayed'
  examples:
    create_subscription_charge:
      description: Create Payment. Charge Subscription
      summary: Create Payment
      value:
        subscription_id: test-subscription-id
        payment_id: test-payment-id
        payment_amount: 10
        payment_schedule_date: '2024-04-18T16:40:00'
        payment_remarks: 2nd EMI payment
        payment_type: CHARGE
        payment_method:
          upi:
            upi_id: john@upi
            channel: collect
    create_subscription_auth:
      description: Create Auth.
      summary: Create Auth
      value:
        subscription_id: test-subscription-id
        subscription_session_id: sub_session_Vf5ZOcJTbGkcw4kcpayment
        payment_id: test-payment-id
        payment_type: AUTH
        payment_method:
          enach:
            channel: link
            auth_mode: net_banking
            account_holder_name: John Doe
            account_number: '1518121112'
            account_type: SAVINGS
            account_bank_code: ICIC
  securitySchemes:
    XClientID:
      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).
    XClientSecret:
      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).
    XPartnerAPIKey:
      type: apiKey
      in: header
      name: x-partner-apikey
      description: >-
        If you are partner and you are making an api call on behalf of a
        merchant
    XClientSignatureHeader:
      type: apiKey
      in: header
      name: x-client-signature
      description: >-
        Use this if you do not want to pass the secret key and instead want to
        use signature
    XPartnerMerchantID:
      type: apiKey
      in: header
      name: x-partner-merchantid
      description: >-
        If you are partner use this to specify the merchant id if you don't have
        the merchant client app id

````