Split After Transaction API

You must specify two decimal places for each split, but ensure the sum split amounts are equal to the transaction amount.

πŸ“˜

Note:

You must specify two decimal places for each split, but ensure the sum of the percentage of all splits is equal to 100.

HTTP Method: POST

Environment

Request parameters

ParameterDescriptionSample Value
keystring This parameter must include the Merchant key that was provided by PayU.vDy3i7
commandstring The parameter must contain the name of the web service.payment_split
hashString The hash string encryption is specified in this parameter. The format of the hash is:
|sha512(key|command|var1|salt)
Where, var1 contains the fields as described in the var1 description.
Β 
var1string (JSON) This parameter is in a JSON format and fields included in the JSON format are explained the JSON request structure table.For an example, refer the Request Structure subsection.

Request structure for var1 to be included in Β payment_splitΒ API

{Β Β "type": "absolute",Β Β 
    "payuId": "xxxxxxxx", # PayuID of parent transaction which needs to be split.Β Β 
   "splitInfo": 
    {Β Β Β Β 
       "merchantKey1": 
       {
       "aggregatorSubTxnId": "30nknyhkhib",
       "aggregatorSubAmt": "8",
       "aggregatorCharges": "2" // parent merchant commission (Optional)Β Β Β Β 
       },
      "merchantKey2":
      {
Β Β Β Β Β Β  "aggregatorSubTxnId": "13u0nknou0",
Β Β Β Β Β Β  "aggregatorSubAmt": "2"
Β Β Β Β   },
   Β Β Β Β "merchantKey3":
       {
  Β Β Β Β Β Β "aggregatorSubTxnId": "13u0nknou02",
  Β Β Β Β Β Β "aggregatorSubAmt": "2",
  Β Β Β Β Β Β "aggregatorCharges": "1" // parent merchant commission (Optional)
       }
   Β Β }
}

JSON request structure

The var1 parameter is in JSON format. The fields in the JSON format are described in the following table:

FieldDescriptionExample
typeThe type of split is specified in this field. Use absolute in this field. The absolute amount is specified for each part of the split. The absolute amount is specified in the aggregatorSubAmt field of the JSON for each child or aggregator.absolute
payuidThe payment identifier provided by PayU for the transaction.403993715525003544
splitInfoThis parameter must include the list of aggregator sub transaction IDs and sub amounts as specified in the Request Structure for var1 subsection:

- aggregatorSubTxnId: The aggregator sub transaction ID is specified in this field.
- aggregatorSubAmt: The aggregator sub amount is specified in this field.
- aggregatorCharges: The aggregator charges is specified in this field.Note: The aggregatorCharges field can only be used by parent merchant to get the aggregator commission.
Refer to Request Structure for var1 subsection.

Sample request

curl -X POST "https://info.payu.in/merchant/postservice?form=2"
-H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d
β€œkey=A6lB8r&command=payment_splity&var1="type":"absolute","payuId":"403993715525003544","splitInfo":{"imAJ7I":{"aggregatorSubTxnId":"CHild101","aggregatorSubAmt":"50"},"qOoYIv":{"aggregatorSubTxnId":"Child202","aggregatorSubAmt":"50"}}}&hash=6692a8b560c51e8a4bb830206d3b8fac3678fb5b08443c7590047545beba66ec97257fec11775abbc339eabbaf1b1bf5e1c50d2c6bbf67e1a69ad597480d3691"

Sample response

  • Sample response for a successful split:

When split get saved & created

{
  "status": 1,
  "message": "Splits creation successful.",
  "splitStatus": "success",
  "splitSegments": [
    {
      "merchantKey": "imAJ7I",
      "amount": 50,
      "subvention_amount": 0,
      "txnId": "CHild101",
      "additional_charges": 0,
      "transaction_fee": 50    },
    {
      "merchantKey": "qOoYIv",
      "amount": 50,
      "subvention_amount": 0,
      "txnId": "Child202",
      "additional_charges": 0,
      "transaction_fee": 50    },
  ]
}
  • Sample response when split gets saved but are not yet created:

When split get saved but aren’t yet created)

{
  "status": 2,
  "message": "Splits saved, but not created yet",
  "splitStatus": "PENDING"
}
  • Split creation is failed:

In this sample response, the error_code and error_desc parameters display based on the failure. For the list of error_codes, refer to Error Codes & Error Messages.

{
  "status": 0,
  "error_code": "AGG-107"
  "error_desc": "Invalid split payload in payment request"
}

{
   "P41sCY":{
      "aggregatorSubTxnId":"0e7411799c9f0e96620c1",
      "aggregatorSubAmt":"3",
      "aggregatorCharges":"2"
   },
   "P41sCK":{
      "aggregatorSubTxnId":"0e7411799c9f0e96620c2",
      "aggregatorSubAmt":"5"
   }
}

πŸ“˜

Refunds for Split Transactions:

You must include the var8 parameter similar to the following JSON array format with the refund details of split where child_merchant_key_x must be substituted with the child merchant key. For more information, refer to Refund Transaction API > Other request parameters

{
   "child_merchant_key_1":{
      "amount":100,
      "aggregatorRefundAmount":40
   },
   "child_merchant_key_2":{
      "amount":20,
      "aggregatorRefundAmount":0
   }
}

Error codes & messages

Conditionerror_codeerror_message
Invalid request posted by merchant in var1AGG-107Invalid split payload in payment request
Invalid parent payuIdAGG-103This transaction is not a aggregator flow base transaction
Split already exists for requested PayUIdAGG-104Split info already exists for this transaction
Invalid Child merchant in split requesetAGG-102One or more child merchant-keys provided are invalid
If sum amount won’t match wrt parent transaction amountAGG-108Total amount provided in split doesn\'t match the transaction amount
If merchant is not Aggregator flow merchant.AGG-101This merchant is not an Aggregator flow merchant.
When transaction is locked in other processAGG-110Some exception occurred. Try after sometime.

πŸ“˜

Note:

API integration and authentication would be the same as that for general transaction flow.