Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views3 pages

Payment Gateway Checkout Integration Guide

This guide provides instructions for integrating with a payment gateway, detailing the process of redirecting users to a checkout page and receiving payment notifications. Users must construct a checkout URL with required parameters, including homeUrl and notifyUrl, which contains the userId. After payment processing, a notification with payment details is sent to the notifyUrl, which must validate the userId to ensure proper association with the transaction.

Uploaded by

awwwcutie47
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Payment Gateway Checkout Integration Guide

This guide provides instructions for integrating with a payment gateway, detailing the process of redirecting users to a checkout page and receiving payment notifications. Users must construct a checkout URL with required parameters, including homeUrl and notifyUrl, which contains the userId. After payment processing, a notification with payment details is sent to the notifyUrl, which must validate the userId to ensure proper association with the transaction.

Uploaded by

awwwcutie47
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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;
}

You might also like