Payment Gateway

An online payment gateway (PG) is a bridge between the user’s bank account and the portal where the user wants to transfer his money. It is a software that authorizes the user to do an online transaction through modes of payment like a credit card, debit card, net banking, UPI, or the many online wallets that are available these days.

It is a third party that transfers money securely from the bank account to the merchant’s payment portal. It works behind the scenes to handle online transactions safely and securely.

Different payment gateways available in market

  1. PayPal
  2. Amazon Pay
  3. PayU
  4. CCAvenue
  5. RazorPay
  6. PayTM
  7. Citrus

How Payment Gateway works

A payment gateway focuses to secure the sensitive information given by the user throughout the process. It does so by encrypting the credit card or bank details given by the user

Step 1: A customer places the order and then presses the Submit button, or its alternative button, on the website.

Step 2: The website or the booking/e-commerce platform takes the user to a payment gateway where he enters all the relevant information about the bank or the card. The Payment Gateway then takes the user directly to the page of the bank or a 3D secure page, asking for the transaction to be authorized.

Step 3: Once authorized, the bank checks whether the customer has a sufficient amount in the account to complete the transaction.

Step 4: Accordingly, The payment gateway sends a response to the merchant. If the response from the bank is a “No’”, then the merchant sends an error message to the customer, telling them about the relevant issue. If the response  from the bank is a “Yes”, then the merchant seeks the transaction from the bank

Step 5: The bank settles the amount with the payment gateway, which successively settles the amount with the merchant.

Step 6: The customer gets a confirmation message of the order being placed, once the above process is completed.

Note: The transaction of the amount involves sensitive information about a user’s bank and card details. Therefore, it is imperative to make sure that this information stays safe.

PayPal Payment Gateway Integration

PayPal is one of the renowned payment gateways and known for its highly secure network system. PayPal has provided easy to follow guidelines to integrate its product with a variety of mobile and web applications.

The integration guidelines are generally provided by the Payment Gateway itself. For example below are the steps provided by PayPal in its developer’s documentation.

Note: Before integrating the PayPal gateway, developers must set up a development environment to get OAuth 2.0 client ID and secret credentials for its environments. These credentials are used to get access tokens that authorize REST API calls.

1. Installing NuGet Package manager for PayPal

Next step is to install Nuget package manager for paypal

2. Configuration

In order to use this SDK, the application needs to be configured. SDK will attempt to look for settings specific to Pay-pal in the application’s web.config file.

<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
<!-- PayPal SDK settings -->
<add name="mode" value="sandbox" />
<add name="clientId" value="__CLIENT_ID__" />
<add name="clientSecret" value="__CLIENT_SECRET__" />

3. Authentication with PayPal

Before making calls to the Rest API, developers have to generate an OAuth access token to be used with API calls.

using PayPal.Api;

// Get a reference to the config

var config = ConfigManager.Instance.GetProperties();

// Use OAuthTokenCredential to request an access token from PayPal

var accessToken = new OAuthTokenCredential(config).GetAccessToken();

4. Configuring APIContext Object

This object helps developers to customize the calls made to PayPal

var apiContext = new APIContext(accessToken);

This object can be further setup to add specific http headers and custom configuration settings.

// Initialize the apiContext's configuration with the default configuration for this application.

apiContext.Config = ConfigManager.Instance.GetProperties();

// Define any custom configuration settings for calls that will use this object.

apiContext.Config["connectionTimeout"] = "1000"; 

// Define any HTTP headers to be used in HTTP requests made with this APIContext object

if(apiContext.HTTPHeaders == null)


  apiContext.HTTPHeaders = new Dictionary<string, string>();


apiContext.HTTPHeaders["some-header-name"] = "some-value";

5. SDK Call

Once the APIContext object is ready, developers can make a call to the API. Below is an example of how to get the details of a specific PayPal payment.

var payment = Payment.Get(apiContext, "PAY-0XL713371A312273YKE2GCNI");

Advantage of Payment Gateway

1.Security: Payment gateways use industry-standard encryption and protect sensitive data thus protecting both merchants and consumers from fraud.

2.Faster transaction processing: A payment gateway is much faster than manual processing, and customers can make the payment without the inconvenience of long waits or lines.

3.Large customer base: Payment gateways enable customers from around the world to have access to your portal and can expand your customer base exponentially.


This article explains one of the most important components i.e. Payment Gateway for online businesses, How it works, Integration with benefits of using a Payment gateway for business.

At Neova we have the technical expertise to integrate Payment gateways into any online business web applications.


Senior Software Engineer