If you have develop your own shopping cart and need split settlement manual integration by yourself, here are the details.

The API allows you to split the settlement for the transaction to multiple merchant instead of only 2 when using split settlement product.

Info required

To start we will need the information as below. These can be retrieve in senangPay Dashboard.

1.Go to Settings > Profile

Settings

2. Refer to Shopping Cart Integration Link section. Get your Merchant ID and Secret Key information

IntegLink

3. Then you will need to fill in the return URL. This is the URL where senangPay will redirect the buyer after the payment has been processed. If you already had set the return URL for your manual integration API, then you can skip this step.

4. Next, you need to fill the Callback URL. Callback URL is used as alternative notification to merchant shopping cart in case there is a breakdown in transaction flow. For more info on Callback URL, read here. If you already had set the Callback URL for your manual integration API, then you can skip this step.

What parameters to send to senangPay

Below are the details of the elements in the table


Item Details
detail This is the description to be displayed when making the payment. The maximum length is 500 characters. Any underscore (_) characters will be converted to space. Example Shopping_cart_id_30. Only A to Z, a to z, 1 to 0, dot, comma, dash and underscore allowed
amount The amount to charge the buyer. The format must be in 2 decimal places. Example 25.50.
order_id This is the id to be use to identify the shopping cart when senangPay redirect back the buyer after the payment was made. The maximum length is 100 characters. Example 3432D4. Only A to Z, a to z, 1 to 0 and dash allowed.
hash The is the data to ensure the data integrity passed from merchant’s shopping cart to senangPay. Refer to How to generate the secure hash section for more info.
name This is the name to populate in the payment form so that customer do not have to key in their name. This is optional and not have to be part of the hash. Customer is able to overwrite the value in payment form.
email This is the email to populate in the payment form so that customer do not have to key in their email. This is optional and not have to be part of the hash. Customer is able to overwrite the value in payment form.
phone This is the phone to populate in the payment form so that customer do not have to key in their phone. This is optional and not have to be part of the hash. Customer is able to overwrite the value in payment form.
split_settlement This is a string containing the split settlement information. The string should follow below format.

Example
Total amount: RM10
Example

  • The split_amount should be the split amount multiply by hundred, not in percentage.
  • Merchant can split the total amount to unlimited merchant account, as long as each merchant account (including owner) amount is RM 2 or more.
  • Merchant ID must be ID of active senangPay account.
  • No space or symbol allowed.
  • In the example above:

    • Merchant (transaction owner) will be allocated RM3 from the transaction.
    • Merchant 1544436524 will be allocated RM2 from the transaction.
    • Merchant 1677765432 will be allocated RM3 from the transaction.
    • Merchant 1766653212 will be allocated RM2 from the transaction.

How to send the parameters to senangPay

1. The parameters can be send either using GET or POST method.

2. The URL is https://app.senangpay.my/payment/ followed by your merchant ID.

3. Example https://app.senangpay.my/payment/14222653788472

What Parameters does the shopping cart received from senangPay


Item Details
status_id This is to indicate the status of the payment. It only has 2 values which is 1 for successful and 0 for failed.
order_id This is the order that was sent to senangPay. This is to identify the shopping cart transaction.
msg This is the message to describe the payment status. The maximum length is 100 characters. Take note that the message may contain underscore. You can replace the underscore as space when displaying the message to your customer. Example Payment_was_successful.
transaction_id This is the transaction ID used by senangPay. You can use this ID to track the transaction in senangPay. The maximum length is 100 characters. Example 14363538840
hash This is the data to ensure the data integrity passed from senangPay to the merchant’s shopping cart. Refer to section How to verify if the secure hash is correct for more info.

How senangPay send the parameters to merchant’s shopping cart

1. The parameters will be send using GET method.

2. The parameters are sent to URL as configured in the return URL. Refer to Info required section.

How to generate the secure hash

1. The secure hash is generated by using md5 on a string consisting of (according to sequence):

– Secret Key

– Detail

– Amount

– Order ID

2. For example if the values for the parameters are as below:


Item Details
Secret Key 53-784
Detail Shopping_cart_id_56
Amount 10.00
Order ID 56
Split Settlement 1544436524:200|1677765432:300|1766653212:200

3. So the string to be hash is 53-784Shopping_cart_id_5610.00561544436524:200|1677765432:300|1766653212:200 which will generate hash value as 0284ce49406276a9e85dad1e820fb24c

How to verify if the secure hash is correct

1. Merchant will need to generate the secure hash and compare the secure hash that was received from senangPay.

2. For example if the parameters received from senangPay are as below:


Item Details
status_id 1
order_id 56
transaction_id 14363538840
msg Payment_was_successful

3. So the string to be hash is 53-78415614363538840Payment_was_successful which will generate hash value as 69686562c29ad3f7955b1843a5c275ca.
4. Now you need to compare the hash value that you have generated with the hash value sent from senangPay. If the value does not match then the data may have been tampered.

Can I just add split settlement parameter in my existing manual integration API setup?

Yes. You can enable split settlement by adding the split_settlement parameter, and include the parameter in your hash.

Download sample code

For your reference, please refer to this sample code. Kindly please download from here.

http://senangpay.my/muaturun/senangpay_openapi_split_settlement_samplecode.zip 

Screen Shot 2015-04-09 at 1.17.01 PM

Related Content :

1. Callback URL
2. Return URL Parameters
3. Merchant ID & Secret Key

Screen Shot 2015-04-09 at 1.17.01 PM
Have more questions? Submit a request by clicking the green help button right side, bottom

 

Leave a Reply