Payment Gateway Service
eGov Payment Gateway acts as a liaison between eGov apps and external payment gateways facilitating payments, reconciliation of payments and look up of transactions' status'.
Pre-requisites
Before you proceed with the documentation, make sure the following pre-requisites are met -
Java 8
Kafka server is up and running
egov-persister service is running and has pg service persister config path added in it
PSQL server is running and database is created to store transaction data.
Key Functionalities
Create or initiate a transaction, to make a payment against a bill.
Make payment for multiple bill details [multi module] for a single consumer code at once.
Transaction to be initiated with a call to the transaction/_create API, various validations are carried out to ensure sanctity of the request.
The response includes a generated transaction id and a redirect URL to the payment gateway itself.
Various validations are carried out to verify the authenticity of the request and the status is updated accordingly. If the transaction is successful, a receipt is generated for the same.
Payment Flow
Reconciliation
Reconciliation is carried out by two jobs scheduled via a Quartz clustered scheduler.
Early Reconciliation job is set to run every 15 minutes [configurable via app properties], and is aimed at reconciling transactions which were created 15 - 30 minutes ago and are in PENDING state.
Daily Reconciliation job is set to run once per day, and is aimed at reconciling all transactions that are in PENDING state, except for ones which were created 30 minutes ago.
Extensions
Axis, Phonepe and Paytm payment gateways are implemented.
Additional gateways can be added by implementing the Gateway interface. No changes required to the core packages.
Configurable Properties
Following are the properties in application.properties file in egov-pg-service has to be added and set with default value after integrating with new payment gateway. In the below table properties for AXIS bank payment gateway is shown, same releveant propert needs to be add for other payment gateway.
Property | Remarks |
---|---|
| Bollean lag to set the payment gateway active/inactive |
| Currency representation for merchant, default(INR) |
| Payment merchant Id |
| Secret key for payment merchant |
| User name to access the payment merchant for transaction |
| Password of the user tp access payment merchant |
| Access code |
| Pay command |
| commans status |
| Url for making payment |
| URL to get the status of the transaction |
Deployment Details
Deploy latest version of egov-pg-service
Add pg service persister yaml path in persister configuration
Integration
Integration Scope
The egov-pg-service acts as a communication/contact between eGov apps and external payment gateways.
Integration Benefits
Record of every transaction against a bill.
Record of payment for multiple bill details for a single consumer code at once.
Steps to Integration
To integrate, host of egov-pg-service should be overwritten in helm chart
/pg-service/transaction/v1/_create should be added in the module to initiates a new payment transaction, on successful validation
/pg-service/transaction/v1/_update should be added as the update endpoint to updates an existing payment transaction. This endpoint isused only by payment gateways to update status of payments. It verifies the authenticity of the request with the payment gateway and orward all query params received from payment gateway
/pg-service/transaction/v1/_search should be added as the search endpoint for retrieving the current status of a payment in our system.
Reference Docs
Doc Links
API List
Title | Link |
---|---|
/pg-service/transaction/v1/_create | |
/pg-service/transaction/v1/_update | |
/pg-service/transaction/v1/_search | |
/pg-service/gateway/v1/_search |
(Note: All the API’s are in the same postman collection therefore same link is added in each row)