API for Recurring Payment

If you have your own system and wish to integrate to senangPay for recurring payment you will need to first add your product into senangPay. The product need to be created first in order for auditing purposes.

Below are the details and steps required.
137x22xspace.png.pagespeed.ic.IoAxAisfVW

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.

ShoppingCart

3. Then you will need to fill in the Recurring Return URL. This is the URL where senangPay will redirect the buyer after the payment has been processed.

4. Next, you need to fill the Recurring Callback URL. Recurring 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

CallbackURL

137x22xspace.png.pagespeed.ic.IoAxAisfVW
Get the Recurring ID

Recurring id is the unique id to identify your recurring product. To obtain the recurring id, you must first create a recurring product in senangPay dashboard.

1. Go to Product > Create New

GetRecID

2. Create a recurring product. You can learn more on how to create a recurring product here at these links.

a. Instalment Product
b. Subscription Product

3. Once the recurring product has been created, view the product details page, scroll down to Payment Frequency Setting section. The Recurring Id is located under Recurring Type.

RecType

137x22xspace.png.pagespeed.ic.IoAxAisfVW
What parameters to send to senangPay

Below are the details of the elements in the table:


Item Detail
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.
recurring_id This is the id to be use to identify the which recurring product/item senangPay need to process.
hash This 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.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
How to send the parameters to senangPay

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

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

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

137x22xspace.png.pagespeed.ic.IoAxAisfVW
What Parameters does the shopping cart received from senangPay

Below are the details of the elements in the table:


Item Detail
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 transaction generated from your application.
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.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
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 Recurring Return URL. Refer to Info required section.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
How to generate the secure hash

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

– Secret Key

– Recurring ID

– Order ID

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


Item Detail
Secret Key 53-784
Recurring ID 155243673654
Order ID 56

3. So the string to be hash is 53-78415524367365456 which will generate hash value as 50c1200b541147356be1c5095bfddb8cc8a222a9171005ad5bd3b2db28277a14

137x22xspace.png.pagespeed.ic.IoAxAisfVW
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 Detail
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 0ebfcaab4be7463a67d605aad312a03cd6b41df4e3560c2a192b84baab15d127

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.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
Download sample code

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

Download Now

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

API for Recurring Payment

If you have your own system and wish to integrate to senangPay for recurring payment you will need to first add your product into senangPay. The product need to be created first in order for auditing purposes.

Below are the details and steps required.
137x22xspace.png.pagespeed.ic.IoAxAisfVW

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.

ShoppingCart

3. Then you will need to fill in the Recurring Return URL. This is the URL where senangPay will redirect the buyer after the payment has been processed.

4. Next, you need to fill the Recurring Callback URL. Recurring 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

CallbackURL

137x22xspace.png.pagespeed.ic.IoAxAisfVW
Get the Recurring ID

Recurring id is the unique id to identify your recurring product. To obtain the recurring id, you must first create a recurring product in senangPay dashboard.

1. Go to Product > Create New

GetRecID

2. Create a recurring product. You can learn more on how to create a recurring product here at these links.

a. Instalment Product
b. Subscription Product

3. Once the recurring product has been created, view the product details page, scroll down to Payment Frequency Setting section. The Recurring Id is located under Recurring Type.

RecType

137x22xspace.png.pagespeed.ic.IoAxAisfVW
What parameters to send to senangPay

Below are the details of the elements in the table:


Item Detail
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.
recurring_id This is the id to be use to identify the which recurring product/item senangPay need to process.
hash This 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.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
How to send the parameters to senangPay

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

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

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

137x22xspace.png.pagespeed.ic.IoAxAisfVW
What Parameters does the shopping cart received from senangPay

Below are the details of the elements in the table:


Item Detail
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 transaction generated from your application.
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.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
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 Recurring Return URL. Refer to Info required section.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
How to generate the secure hash

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

– Secret Key

– Recurring ID

– Order ID

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


Item Detail
Secret Key 53-784
Recurring ID 155243673654
Order ID 56

3. So the string to be hash is 53-78415524367365456 which will generate hash value as 50c1200b541147356be1c5095bfddb8cc8a222a9171005ad5bd3b2db28277a14

137x22xspace.png.pagespeed.ic.IoAxAisfVW
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 Detail
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 0ebfcaab4be7463a67d605aad312a03cd6b41df4e3560c2a192b84baab15d127

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.

137x22xspace.png.pagespeed.ic.IoAxAisfVW
Download sample code

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

Download Now

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