File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes General Computing and the fly likes Payment Gateway - dual verification check Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Payment Gateway - dual verification check" Watch "Payment Gateway - dual verification check" New topic

Payment Gateway - dual verification check

Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 78

Not sure, if i am posting to the correct forum ... (Dear Moderator, please advise the correct one)

My environment: Struts + Spring + Hibernate application running on Jboss 5.1 GA with Oracle as backend.
Operating Sys: Windows
JDK: ver 1.7

My application is a B2C app, where in end users, add something to their cart and proceed to payment.

App is integrated with a Payment gateway, where in the happy flow is as

User --> browses-to -> https//
--> adds-to-his-cart
--> proceeds to payment (transaction is marked 'PAYMENT-INITIATED' in database)
-----> user is redirected to
--> enters CC, Cvv etc (payment is processed)

-----> user is redirected from paymentGateway back to to https//
--> myapp, processes the incoming details from PG and shows user confirmation/ thank you page.
(and transaction is marked 'PAYMENT-SUCCESS' or 'PAYMENT-FAILED' in database))

But in practice, it so happens, due to varied reasons, user leaves https// (for payment), but never returns (could be network failure/ or simply user closed his browser)

So the status of the transaction on my application side, remains 'PAYMENT-INITIATED'; indefinitely.

Later support team gets calls from user, money has got debited from their account/ CC but they have received no acknowledgement from my B2C system.

What can be done for such transactions ?

For one, we have a cron job; which runs every hour, queries the payment-gateway about the state of these 'PAYMENT-INITIATED' transactions.
1. If payment gateway, reports that money has truly been debited; we mark the transaction as 'REFUNDABLE' and refund the money.
else mark it as FAILURE (if gateway reports it as so) or simply ABANDONED.

Is there a better way to handle this ?
Note; I cannot accept credit card/ Cvv info on my web-site and then call payment gateway;
so the synchronous round trip ( --to-- payment gateway --back-to-- cannot be done without.

thank you.
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

This has some good explanation on how it typically works.

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: Payment Gateway - dual verification check
It's not a secret anymore!