API for Recurring Payment

If you have your own system and wish to integrate it to senangPay for recurring payments you will need to first add your product into senangPay. The product needs to be created first for auditing purposes. Recurring payments is not available for merchants who subscribe with senangPay x Stripe Package.

To start, we will need the information as below. These can be retrieved from the senangPay Dashboard.

1. Go to Menu > Settings > Profile

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

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

4. Next, you need to fill in the Recurring Callback URL. Recurring Callback URL is used as an alternative notification to the merchant shopping cart in case here is a breakdown in the transaction flow. For more info on Callback URL, read here.

Getting the Recurring ID

The Recurring ID is a unique identifier for your recurring product. To obtain it, you'll need to first create a recurring product in the senangPay dashboard.

Here’s a step-by-step guide:

1. Create a New Product

  • Navigate to Menu > Product > Create New in your senangPay dashboard.

2. Set Up the Recurring Product:

3. Find the Recurring ID:

  • After creating the recurring product, go to the product details page.

  • Scroll down to the Payment Frequency Setting section.

  • Locate the Recurring ID under the Recurring Type heading.

Parameters to send to senangPay

Below are the details of the elements in the table:

ItemDetail

order_id

Identifies the shopping cart when redirecting after payment. Max 100 characters.

  • Allowed: A-Z, a-z, 0-9, and dash ( - )

  • Example: 3432D4.

recurring_id

Identifies which recurring product/item senangPay processes.

hash

Ensures data integrity between the merchant’s cart and senangPay. Refer to the ‘How to generate the secure hash’ section for details.

name

Adds the customer's name automatically. It's optional and can be edited.

email

Populates the customer's email for them. Optional and can be modified.

phone

Inserts the customer's phone number. Optional and adjustable by the customer.

** The "Test it" option is available when using Firefox or Safari to test the API

Handles 'Return' & 'Callback' from senangPay

1. The parameters will be sent using GET method.

2. The parameters are sent to URL as configured in the Recurring Return URL. Refer to ‘Information Required’ section

Below are the details of the elements in the table:

ItemDetail

status_id

Indicates payment status

  • 1 for success

  • 0 for failure

  • 3 for pending (first recurring payment only)

order_id

Identifies the order sent to senangPay, linking the transaction to your application.

msg

Describes the payment status. Max 100 characters. Replace underscores with spaces when displaying to customers.

  • Example: "Payment_was_successful."

transaction_id

senangPay's unique transaction ID. Max 100 characters.

  • Example: 14363538840.

Use it to track transactions in senangPay.

hash

Ensures data integrity from senangPay to your shopping cart. See the ‘How to verify the secure hash’ section for details.

3. Callback : The parameter will be send by POST method.

Last updated