Payment Gateway Checkout Integration Guide
This guide explains how to integrate with our payment gateway to process payments. The
process involves redirecting users to our checkout page and receiving a notification with
payment details, including the userId provided in the notifyUrl.
1. Redirect to Checkout Page
To initiate a payment, redirect your user to our checkout page URL with the required
parameters.
Checkout URL Format:
http://localhost:8080/checkout?
homeUrl=<YOUR_HOME_URL>¬ifyUrl=<YOUR_NOTIFY_URL_WITH_USERID>
Parameters:
● homeUrl (required): The URL where the user will be redirected after completing or
canceling the payment.
Example: https://example.com
● notifyUrl (required): The URL where our system will send a notification with payment
details after the transaction is processed. This URL must include the userId of your user
as a query parameter.
Example: https://example.com/notify?userId=123
Example Checkout URL:
http://localhost:8080/checkout?homeUrl=https://example.com¬ifyUrl=https://example.com/
notify?userId=123
Steps:
1. Construct the checkout URL with your homeUrl and notifyUrl. Ensure the notifyUrl
includes the userId query parameter (e.g., ?userId=123).
2. Redirect the user to the constructed URL.
3. The user will complete the payment on our checkout page.
4. After completion, the user is redirected back to your homeUrl.
2. Receive Payment Notification
Once the payment is processed, our system will send a POST request to the notifyUrl you
provided (including the userId query parameter) with the following JSON payload:
Notification Payload:
{
"amount": 40,
"userId": 123
}
Payload Fields:
● amount: The transaction amount (e.g., 40 for $40).
● userId: The same userId that was provided in the notifyUrl query parameter (e.g., 123).
Important Requirement:
● The notifyUrl must include the userId as a query parameter (e.g.,
https://example.com/notify?userId=123).
● Our system will extract the userId from the notifyUrl and include it in the notification
payload to ensure you can associate the payment with the correct user.
● Your notifyUrl endpoint should validate that the userId in the payload matches the userId
in the query parameter and corresponds to a valid user in your system.
Example Notification Request:
POST https://example.com/notify?userId=123
Content-Type: application/json
{
"amount": 40,
"userId": 123
}
POST /notify?userId=<USER_ID>
Content-Type: application/json
// Receive payload
{
"amount": 40,
"userId": 123
}
// Validate and process
if (queryParam.userId === payload.userId && payload.userId exists in your system) {
updateUserPaymentStatus(payload.userId, payload.amount);
return 200 OK;
} else {
return 400 Bad Request;
}