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
Test Environment | https://test.payu.in/merchant/postservice.php?form=2 |
Production Environment | https://info.payu.in/merchant/postservice.php?form=2 |
Request parameters
Parameter | Description | Sample Value |
---|---|---|
key | string This parameter must include the Merchant key that was provided by PayU. | vDy3i7 |
command | string The parameter must contain the name of the web service. | payment_split |
hash | String 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. | Β |
var1 | string (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:
Field | Description | Example |
---|---|---|
type | The 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 |
payuid | The payment identifier provided by PayU for the transaction. | 403993715525003544 |
splitInfo | This 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
Condition | error_code | error_message |
---|---|---|
Invalid request posted by merchant in var1 | AGG-107 | Invalid split payload in payment request |
Invalid parent payuId | AGG-103 | This transaction is not a aggregator flow base transaction |
Split already exists for requested PayUId | AGG-104 | Split info already exists for this transaction |
Invalid Child merchant in split requeset | AGG-102 | One or more child merchant-keys provided are invalid |
If sum amount wonβt match wrt parent transaction amount | AGG-108 | Total amount provided in split doesn\'t match the transaction amount |
If merchant is not Aggregator flow merchant. | AGG-101 | This merchant is not an Aggregator flow merchant. |
When transaction is locked in other process | AGG-110 | Some exception occurred. Try after sometime. |
Note:
API integration and authentication would be the same as that for general transaction flow.