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

# Split After Payment

> Split After Payment API splits the payments to vendors after successful payment from the customers.



## OpenAPI

````yaml /openapi/payments/v2023-08-01.yaml post /easy-split/orders/{order_id}/split
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:
  /easy-split/orders/{order_id}/split:
    post:
      tags:
        - Easy-Split
      summary: Split After Payment
      description: >-
        Split After Payment API splits the payments to vendors after successful
        payment from the customers.
      operationId: PGOrderSplitAfterPayment
      parameters:
        - $ref: '#/components/parameters/apiVersionHeader'
        - $ref: '#/components/parameters/orderIDParam'
        - $ref: '#/components/parameters/xRequestIDHeader'
        - $ref: '#/components/parameters/xIdempotencyKeyHeader'
      requestBody:
        $ref: '#/components/requestBodies/SplitAfterPaymentRequestBody'
      responses:
        '200':
          $ref: '#/components/responses/SplitAfterPaymentSuccessResponse'
        '400':
          $ref: '#/components/responses/Response400SplitAfterPayment'
        '404':
          $ref: '#/components/responses/Response404SplitAfterPayment'
        '409':
          $ref: '#/components/responses/Response409SplitAfterPayment'
      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'
    orderIDParam:
      name: order_id
      in: path
      required: true
      description: The id which uniquely identifies your order
      schema:
        type: string
      example: your-order-id
    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:
    SplitAfterPaymentRequestBody:
      description: Request Body to Create Split for an order.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SplitAfterPaymentRequest'
          examples:
            PG:
              value:
                split:
                  - vendor_id: test03
                    percentage: 10
                    tags:
                      product: Dri-Fit trouser
                      size: L
                      AWB: NIKE12334
                disable_split: true
            Auto Collect:
              value:
                split:
                  - vendorId: Vendor001
                    percentage: 10
                disable_split: true
  responses:
    SplitAfterPaymentSuccessResponse:
      description: Split After Payment Success Response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SplitAfterPaymentResponse'
          examples:
            PG:
              value:
                message: Order split created
                status: OK
            Auto Collect:
              value:
                message: Order split created
                status: OK
    Response400SplitAfterPayment:
      description: Split After Payment Failure Response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
          examples:
            Invalid vendor ID:
              value:
                message: vendor does not exist
                code: api_request_failed
                type: invalid_request_error
            Split amount greater than order amount:
              value:
                message: >-
                  Total split amount can not be greater than transaction amount
                  / eligible split balance
                code: api_request_failed
                type: invalid_request_error
            Both amount and percentage mentioned:
              value:
                message: 'Invalid Request: Both Amount and percentage are present'
                code: api_request_failed
                type: invalid_request_error
            Invalid percentage:
              value:
                message: Invalid vendor split percentage
                code: api_request_failed
                type: invalid_request_error
            Split already exist:
              value:
                message: Transaction already processed, not eligible for split
                code: api_request_failed
                type: invalid_request_error
            Transaction not synced yet:
              value:
                message: Transaction is not synced, please retry after 2 mins
                code: api_request_failed
                type: invalid_request_error
            Order not paid:
              value:
                message: Order not paid
                code: api_request_failed
                type: invalid_request_error
    Response404SplitAfterPayment:
      description: Split After Payment Failure Response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError404'
          examples:
            '404':
              value:
                message: Order not found
                code: order_not_found,
                type: invalid_request_error
    Response409SplitAfterPayment:
      description: Split After Payment Failure Response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError409'
          examples:
            '409':
              value:
                message: Transaction already processed, not eligible for split
                code: api_request_failed
                type: invalid_request_error
  schemas:
    SplitAfterPaymentRequest:
      title: SplitAfterPaymentRequest
      description: Split After Payment Request
      type: object
      properties:
        split:
          type: array
          description: Specify the vendors order split details.
          items:
            type: object
            properties:
              vendor_id:
                type: string
                description: Specify the merchant vendor ID to split the payment.
              amount:
                type: number
                description: Specify the amount to be split to the vendor.
              percentage:
                type: number
                description: Specify the percentage of amount to be split.
              tags:
                type: object
                maxProperties: 20
                description: >-
                  Custom Tags in thr form of {"key":"value"} which can be passed
                  for an order. A maximum of 10 tags can be added
                additionalProperties:
                  type: string
                  minLength: 1
                  maxLength: 255
        disable_split:
          type: boolean
          description: >-
            Specify if you want to end the split or continue creating further
            splits in future.
      required:
        - split
    SplitAfterPaymentResponse:
      title: SplitAfterPaymentResponse
      description: Split After Payment Response
      type: object
      properties:
        status:
          type: string
        message:
          type: string
    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
    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
    ApiError409:
      title: ApiError409
      description: duplicate request
      example:
        message: order with same id is already present
        code: order_already_exists
        type: invalid_request_error
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
          enum:
            - invalid_request_error
          description: invalid_request_error
  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

````