Split by Percentage During Transaction

You can split during a transaction made using _payment API by percentage, where you must ensure that the sum of percentage of all splits is equal to 100.

πŸ“˜

Note:

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

HTTP Method: POST

Environment

Request parameters

ParameterDescription
key
mandatory
StringMerchant key provided by PayU during onboarding.
txnid
mandatory
StringThe transaction ID is a reference number for a specific order that is generated by the merchant.
amount mandatoryStringThe payment amount for the transaction.
productinfo mandatoryStringA brief description of the product.
firstname mandatoryString The first name of the customer.
email
mandatory
StringThe email address of the customer.
phone
mandatory
StringThe phone number of the customer.
pg
mandatory
String The pg parameter determines which payment tabs will be displayed on the PayU page. For cards, 'CC' will be the value.
bankcode mandatoryString Each payment option is identified with a unique bank code at PayU. The merchant must post this parameter with the corresponding payment option’s bank code value in it. For more information, refer to Card Type Codes and Supported Banks for Cards.
ccnum
mandatory for cards
String Use 13-19 digit card number for credit/debit cards (15 digits for AMEX, 13-19 for Maestro) and validate with LUHN algorithm. Refer to Card Number Formats and display error message on invalid input.
ccname mandatory for cardsString This parameter must contain the name on card – as entered by the customer for the transaction.
ccvv
mandatory for cards
String Use 3-digit CVV number for credit/debit cards and 4-digit security code (4DBC/CID) for AMEX cards. Validate with BIN API.
ccexpmon mandatoryfor cardsString This parameter must contain the card’s expiry month – as entered by the user for the transaction. It must always be in 2 digits or in MM format. For months 1-9, this parameter must be appended with 0 – like 01, 02…09. For months 10-12, this parameter must not be appended – It should be 10,11 and 12 respectively.
ccexpyr
mandatory for cards
String This parameter must contain the card’s expiry year – as entered by the customer for the transaction. It must be of four digits.
furl
mandatory
StringThe success URL, which is the page PayU will redirect to if the transaction is successful.
surl
mandatory
StringThe Failure URL, which is the page PayU will redirect to if the transaction is failed.
splitRequest
mandatory for Split Settlements
JSON This parameter must include the split payment details in a JSON format. For more information, refer to splitRequest JSON fields description sub-section.
hash
mandatory
StringIt is the hash calculated by the merchant. The hash calculation logic is: sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT|splitRequest
address1
optional
String The first line of the billing address.
For Fraud Detection: This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information.
address2
optional
String The second line of the billing address.
city
optional
String The city where your customer resides as part of the billing address.
state
optional
String The state where your customer resides as part of the billing address,
country
optional
String The country where your customer resides.
zipcode
optional
String Billing address zip code.
Character Limit-20
udf1
optional
String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5.
udf2
optional
String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5.
udf3
optional
String User-defined fields (udf) are used to store any information corresponding to a particular transaction.
udf4
optional
String User-defined fields (udf) are used to store any information corresponding to a particular transaction.
udf5
optional
String User-defined fields (udf) are used to store any information corresponding to a particular transaction.

splitRequest JSON fields description

The following fields are included in theΒ splitRequest parameter in a JSON format to specify the split by percentage details. The fields in the JSON format are described in the following table:

FieldDescriptionExample
type
mandatory
string Specify the percentage type of split in this field. The percentage of the amount is specified for each part of the split. The percentage of the amount is specified in the aggregatorSubAmt field of the JSON for each child or aggregator.percentage
splitInfo
mandatory
JSON This parameter must include the list of aggregator sub transaction IDs and sub amounts as follows:

- aggregatorSubTxnId: The transaction ID of the aggregator is posted in this parameter. This field is mandatory and applicable only for child merchants.
- aggregatorSubAmt: The transaction amount or percentage split for the aggregator is posted in this parameter. This field is mandatory.
- aggregatorCharges (optional): The transaction amount or percentage split for aggregator charges is posted in this parameter. This field is optional.
Note: Only the parent aggregators can have the aggregatorCharges field as part of their JSON to collect charges.
Refer the JSON request structure of splitInfo subsection.

Sample JSON for splitRequest

πŸ“˜

Notes:

  • Description of fields: Refer to splitRequest JSON fields description field.
  • Before peruse the following sample code, remove the white spaces as some editors may introduce junk characters.
{
  "type": "percentage",
  "splitInfo": {
    "merchantKey1": {
      "aggregatorSubTxnId": "30nknyhkhib",
      "aggregatorSubAmt": "53.33", // %age wrt to total payable amount
      "aggregatorCharges": "13.33" // parent merchant commission (Optional) | %age wrt to total payable amount
    },
    "merchantKey2": {
      "aggregatorSubTxnId": "13u0nknou0", //%age wrt to total payable amount
      "aggregatorSubAmt": "13.33" // %age wrt to total payable amount
    },
    "merchantKey3": {
      "aggregatorSubTxnId": "13u0nknou0",
      "aggregatorSubAmt": "13.33", // %age wrt to total payable amount
      "aggregatorCharges": "6.68" // parent merchant commission (Optional) | %age wrt to total payable amount
    }
  }
}

JSON request structure of splitInfo

The sample JSON structure for the splitInfo field:

πŸ“˜

Note:

Before peruse the following sample code, remove the white spaces as some editors may introduce junk characters.

{
   "type":"absolute",
   "splitInfo":{
      "P****Y":{
         "aggregatorSubTxnId":"9a70ea0155268**1001ba",
         "aggregatorSubAmt":"50",
         "aggregatorCharges":"20"
      },
      "P***K":{
         "aggregatorSubTxnId":"9a70ea0155268**1001bb",
         "aggregatorSubAmt":"30"
      }
   }
}

Hashing request

Added as extra parameter in the calculation of hash in case of providing Split Request at time of payment. This parameter will be at the end of the hash pattern. and required while sending Split Request at time of payment.

You need to generate a string using certain parameters and apply the SHA-512 algorithm to this string. For more information on hashing, refer to Generate Hash.

πŸ“˜

Note:

Ensure that you use pipe (|) character between these parameters as mentioned in the following code block.

The parameter order is in the following code block:

sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT|splitRequest)

Where, splitRequest will be at the end of the hash pattern string.

Example:

hash('sha512', 'Ax4j7J|payment-txnid-1|10|Product Info|Payu-Admin|[email protected]|||||||||||t5atu4TyCvrJDPxAYrmfJfzd90kbXMfL|{"type":"absolute","splitInfo":{"P41sCY":{"aggregatorSubTxnId":"0e7411799c9f0e96620c11","aggregatorSubAmt":"3","aggregatorCharges":"2"},"P41sCK":{"aggregatorSubTxnId":"0e7411799c9f0e96620c22","aggregatorSubAmt":"5"}}}'));

Check the response from PayU

Hash validation logic for payment response (Reverse hashing)

Use the following algorithm for reverse hashing the response from PayU:

sha512(SALT|status|splitInfo||||||udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid|key)

Sample response

TDR model

The formatted response for the above sample request is similar to the following:

Array
(
    [mihpayid] => 41**45678912383977
    [mode] => CC
    [status] => success
    [unmappedstatus] => captured
    [key] => Ax4j7J
    [txnid] => 9a70ea0155268101001b
    [amount] => 100.00
    [cardCategory] => domestic
    [discount] => 0.00
    [net_amount_debit] => 100
    [addedon] => 2021-12-22 19:02:15
    [productinfo] => Product Info
    [firstname] => Payu-Admin
    [lastname] => 
    [address1] => 
    [address2] => 
    [city] => 
    [state] => 
    [country] => 
    [zipcode] => 
    [email] => [email protected]
    [phone] => 1234567890
    [udf1] => 
    [udf2] => 
    [udf3] => 
    [udf4] => 
    [udf5] => 
    [udf6] => 
    [udf7] => 
    [udf8] => 
    [udf9] => 
    [udf10] => 
    [hash] => 6e700275583072c0361bac771a4166a4be5334112d59e40181c5668895c477a047c7be250068186fd26ca72928d7e168f92bb96003a7fffbf4933bb818f4c48a
    [field1] => 5582299554914671900181
    [field2] => 113476
    [field3] => 100.00
    [field4] => 41**45678912383977
    [field5] => 100
    [field6] => 02
    [field7] => AUTHPOSITIVE
    [field8] => 
    [field9] => Transaction is Successful
    [payment_source] => payu
    [PG_TYPE] => AxisCYBER
    [bank_ref_num] => 5582299554914671900181
    [bankcode] => CC
    [error] => E000
    [error_Message] => No Error
    [name_on_card] => Test User
    [cardnum] => 512345XXXXXX2346
    [cardhash] => This field is no longer supported in postback params.
    [splitInfo] => {"splitStatus":"success","splitSegments":[{"merchantKey":"P41sCY","amount":50,"subvention_amount":0,"txnId":"9a70ea0155268101001ba"},{"merchantKey":"P41sCK","amount":30,"subvention_amount":0,"txnId":"9a70ea0155268101001bb"},{"merchantKey":"sd3fsmr","amount":20,"subvention_amount":0,"txnId":"9a70ea0155268101001b"}]}
)

Convenience fee model

The formatted response for the above sample request is similar to the following:

Array
(
    [mihpayid] => 41**45678912383977
    [mode] => CC
    [status] => success
    [unmappedstatus] => captured
    [key] => Ax4j7J
    [txnid] => 9a70ea0155268101001b
    [amount] => 110.00
    [cardCategory] => domestic
    [discount] => 0.00
    [net_amount_debit] => 110
    [addedon] => 2021-12-22 19:02:15
    [productinfo] => Product Info
    [firstname] => Payu-Admin
    [lastname] => 
    [address1] => 
    [address2] => 
    [city] => 
    [state] => 
    [country] => 
    [zipcode] => 
    [email] => [email protected]
    [phone] => 1234567890
    [udf1] => 
    [udf2] => 
    [udf3] => 
    [udf4] => 
    [udf5] => 
    [udf6] => 
    [udf7] => 
    [udf8] => 
    [udf9] => 
    [udf10] => 
    [hash] => 6e700275583072c0361bac771a4166a4be5334112d59e40181c5668895c477a047c7be250068186fd26ca72928d7e168f92bb96003a7fffbf4933bb818f4c48a
    [field1] => 5582299554914671900181
    [field2] => 113476
    [field3] => 110.00
    [field4] => 41**45678912383977
    [field5] => 100
    [field6] => 02
    [field7] => AUTHPOSITIVE
    [field8] => 
    [field9] => Transaction is Successful
    [payment_source] => payu
    [PG_TYPE] => AxisCYBER
    [bank_ref_num] => 5582299554914671900181
    [bankcode] => CC
    [error] => E000
    [error_Message] => No Error
    [name_on_card] => Test User
    [cardnum] => 512345XXXXXX2346
    [cardhash] => This field is no longer supported in postback params.
    [splitInfo] => {"splitStatus":"success","splitSegments":[
				{"merchantKey":"P41sCY","amount":50,"subvention_amount":0,"txnId":"9a70ea0155268101001ba, β€œdiscount":0,"additionalCharges":0,”transaction_fee":0”},
				{"merchantKey":"P41sCK","amount":30,"subvention_amount":0,"txnId":"9a70ea0155268101001bb, β€œdiscount”:0,"additionalCharges":0,"transaction_fee":0"}
				,{"merchantKey":"sd3fsmr","amount":20,"subvention_amount":0,"txnId":"9a70ea0155268101001b, β€œdiscount”:0,"additionalCharges":10,"transaction_fee":0"}
				]
   			}
)