Difficulty in reading browser opened tabs url using scripting (javascript/jquery)

I am facing difficulty in reading the browser opened tabs using javascript/jquery.

In Website: We have implemented the third party payment gateway where user made payment but in few cases instead of making payment directly user kept the opened the payment gateway page and again opened the same website and move to payment gateway page and then try to make payment in both opened browser tabs that causing discrepancy in amount.

Kindly please suggest -

  1. how we can check duplicate browser opened URLs.
  2. Or, Is there any way to avoid this problem.

Thanks,
Anil

You can’t.

When user proceeds to payment gateway you can store status of the payment in the session (like status=0). Also, check if there is already status=0 set for current session. If yes, either don’t allow it to continue (like “you have already started payment proccess”) or dismiss previous order.

Some abstract PHP code to illustrate the idea:

function beginPayment(){

    if (isset($_SESSION['order_id'])) {
        //payment has been already started
        goToPaymentGateway($_SESSION['order_id']);
    } else {
        //create new order for payment
        $order_id = createNewOrder();
        $_SESSION['order_id'] = $order_id;
        goToPaymentGateway($order_id);
    }

}

function paymentReceived(){
    //unset order_id in session when payment proccess is finished
    unset($_SESSION['order_id']);
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.