Split by Percentage After Transaction Integration
Use this integration to split a completed transaction by percentage using the payment_split API.
In this mode, define type as percentage and distribute split values in aggregatorSubAmt.
Prerequisites
Before you start, ensure the following:
- Your parent merchant account is activated for Split Settlements.
- Child merchants have completed onboarding process and are marked Completed/Active .
- You have your parent merchant
keyandsalt, along with the child merchant(s) key. - You have server-side logic to generate hash and process webhooks/You have the
payuIdof the already completed parent transaction.
Verify the payment status to confirm the transaction is successful before initiating the split
Prepare the var1 JSON payload with the required split details and partner-specific parameters
Generate a secure hash for the API request to ensure data integrity and authentication
Make the API call to the payment_split endpoint to execute the split on the verified transaction
Step 1: Verify the Payment
After completing the payment using the Collect Payment (_payment) API, perform this step to verify the payment.
Reference: Refer to any of the following API Reference pages for the sample request/response for collecting payments using the Collection (_payment) API:
Upon receiving the response, PayU recommends performing a reconciliation step to validate all transaction details. You can verify your payments using either of the following methods:
Upon receiving the response, PayU recommends you performing a reconciliation step to validate all transaction details.
You can verify your payments using either of the following methods:
Configure the webhooks to monitor the status of payments.
Webhooks enable a server to communicate with another server by sending an HTTP callback or message.
These callbacks are triggered by specific events or instances and operate at the server-to-server (S2S) level.
Know how to manage Webhooks for Payments.
Step 2: Prepare var1 JSON payload
Set type as percentage and ensure total percentage is 100.
{
"type": "percentage",
"payuId": "403993715525003544",
"splitInfo": {
"merchantKey1": {
"aggregatorSubTxnId": "subtxn-per-after-001",
"aggregatorSubAmt": "53.33",
"aggregatorCharges": "13.33"
},
"merchantKey2": {
"aggregatorSubTxnId": "subtxn-per-after-002",
"aggregatorSubAmt": "46.67"
}
}
}Important: Ensure total percentage across split entries equals
100.00.
Step 3: Generate hash
Use:
sha512(key|command|var1|salt)Where:
command=payment_splitvar1= compact JSON string from Step 1
Step 4: Call payment_split API
Environment endpoints:
- Test:
https://test.payu.in/merchant/postservice.php?form=2 - Production:
https://info.payu.in/merchant/postservice.php?form=2
Sample request:
curl -X POST "https://test.payu.in/merchant/postservice.php?form=2" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=vDy3i7" \
-d "command=payment_split" \
-d 'var1={"type":"percentage","payuId":"403993715525003544","splitInfo":{"merchantKey1":{"aggregatorSubTxnId":"subtxn-per-after-001","aggregatorSubAmt":"53.33","aggregatorCharges":"13.33"},"merchantKey2":{"aggregatorSubTxnId":"subtxn-per-after-002","aggregatorSubAmt":"46.67"}}}' \
-d "hash=<generated_hash>"Sample success response:
{
"status": 1,
"message": "Splits creation successful.",
"splitStatus": "success",
"splitSegments": [
{
"merchantKey": "merchantKey1",
"amount": 53.33,
"subvention_amount": 0,
"txnId": "subtxn-per-after-001",
"additional_charges": 0,
"transaction_fee": 53.33
},
{
"merchantKey": "merchantKey2",
"amount": 46.67,
"subvention_amount": 0,
"txnId": "subtxn-per-after-002",
"additional_charges": 0,
"transaction_fee": 46.67
}
]
}Updated about 1 hour ago
