Merchant — Payment Gateway Integration Principles

Shashank Anand
Globant
Published in
5 min readJun 9, 2021

This article would help to understand the principles of Payment Gateway Integration basics. The design approach can be extended to any platform limited to capabilities and solutions provided by a payment gateway.`
Though there are many other entities involved in a payment integration but below are the ones which at a high level is required and are present irrespective of any platform or approach we choose :

Merchant
1. Web/Front-End platform: For the customer to make an order and manage their orders
2. Merchant Server: For customer order, booking, payment record, authentication, and other order related management
Payment Gateway
1. Web/Front-End: For the customer to input their payment card information. Embedded form(Browser) in the example below
2. Payment Gateway Server: For processing & payment validation

Merchant Payment Gateway Integration

Merchant Server

Merchant Server plays a vital role, for security reasons related to payments, and in order to avoid fraudulent operations, the payment gateway relies on a merchant server that must be always provided by the merchant.

This merchant server responds to several needs:

  1. Validate the transactions that must be transmitted to the payment gateway corresponding to the purchases on the merchant website and that the amount and currency of the transaction matches.
  2. Securely store communication keys with the payment gateway
  3. Receive instant notifications from the payment gateway upon each payment event (accepted, rejected, failed, canceled, etc.).

Payment Gateway

Once a customer initiates payment for an order, the transaction data is passed to the payment gateway via an encrypted SSL channel. Payment gateway further uses the transaction information for payment processing. If any of the data is needed to be stored by a payment gateway, it is settled in a specific type of secured storage. Usually, gateways don’t store actual credit card numbers, but rather save tokens.

A customer order payment processing through payment gateway and card/bank authorization
Customer Card Payment Processing
  1. Payment processor - The information goes to payment processors. These are the companies that provide payment processing services as third-party players. Payment processors are connected both with a merchant’s account and a payment gateway, transferring data back and forth. At that stage, a payment processor is passing the transaction to a card network (Visa, Mastercard, American Express, etc.).
  2. Card Processor - The role of a card network(Visa/Mastercard/Amex) is to verify the transaction data and pass it to the issuer bank (the bank that produced the cardholder’s credit/debit card).
  3. Issuer bank - The issuer bank also accepts or denies the authorization request. In response, a bank sends a code back to the payment processor, which contains the transaction status or error details.

Security Best Practices

Integration of a merchant with a payment gateway could bring many security vulnerabilities to the platform. There could be heavy impacts if the design, approach, solution, and implementation are not reviewed and analyzed for any potential security outcomes. All need to be carefully handled for any kind of leaks and damages it could lead to.

  1. Storage & retrieval of sensitive customer information,
  2. Legal requirements, protection of customer data,
  3. Customer rights, preference & choices,
  4. Transparency of financial data movement from one platform to another
Merchant Payment Integration Security
  1. Secure Data Sharing & Validation - The data communication between merchant & payment gateway needs to be very secure. For most of the payment gateway integration, the request data sent from merchant to gateway contains a unique validation code for each order. This unique validation code is generated with encryption algorithms(like DES, AES, etc..) that take all the order & payment-related inputs and an additional secret hash key. This secret hash key is shared with all the parties where it is required for validating the transaction.
  2. Secure Communication - Most often, the merchant and payment gateway would maintain secure websites at their own end. But when we have payment gateway integration with the merchant, we will have multiple relays & hops in between the merchant and payment gateway. If the communication channel is not secure enough, we may have data & other losses in transportation from one server to the other. Ensuring proper handshake between servers and having required protocols, certificates, SSL, or TLS layer would help to minimize any sort of losses and security risks.
  3. Securing Customer Data - Adequate measures and steps need to be taken care of in securing sensitive customer data. There should be zero tolerance over customer data leaks. Often, the application & design takes care of securing this over data sharing networks using the right SSL, TLS, protocol, or correct signed certificates. But at the same time, there are various other areas like code, logs, cache, API traces, and other back-end server scripts we need to secure.

Bird’s Eye on Transaction

Finally, once the integration of merchant & payment gateway is live, this is the time it needs additional supervision and tracking

Monitoring the Customer Payment Transaction
  1. Monitoring - Tools & Dashboards would play a wise role in identifying any probable issue customers would face on the platform while they are making an order and payment. Alerts on errors and potential journeys for any breakout should be set up to act in time.
  2. Analytics - Tools & Dashboards to surface the trends and customer orientation helps businesses to understand the value and investment on the product, as well it helps them recognize their customer behavior and patterns which eventually guides them to mature the product.

Conclusion

All this information on merchant & payment gateway integration would a kick-starter for you when you are looking for a solution and design of such integration.

We all know choosing the right payment partner is crucial, but how to choose them is important. And when we look for the right metrics of security, authentication, data exchange mechanism, processing time, communication, and flexibility of payment, this article would help you understand all the basics and help you in choosing the right partner.

--

--

Shashank Anand
Globant
Writer for

Technology Enthusiast. Building solutions for next Generation.