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//myapp.com
--> proceeds to payment (transaction is marked 'PAYMENT-INITIATED' in database)
-----> user is redirected to https://paymentG.com --> enters CC, Cvv etc (payment is processed)
-----> user is redirected from paymentGateway back to to https//myapp.com
--> 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//myapp.com (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 (myapp.com --to-- payment gateway --back-to-- myapp.com) cannot be done without.