Need to refresh the tab if the user moves from one tab to another tab

Hello All,

Traditional web development - OS11

When the end user opens the duplicate tab during the payment time, my application is allowing the end user to pay twice even though the payment in the first tab is successful.

Once the payment is successful in the first tab, I want the specific page to refresh automatically in the another tabs to prevent the end user to proceed to pay for the second time.  That is, once the payment is successfully made in one tab, the "pay" button should not be visible for the end user in the other tabs.

But the "pay" button should be visible, if the first attempt of payment is failed.

Any help would be greatly appreciated. Thanks!

Regards,

Madhavan

paybutton.PNG

Hi Madhavan,

Firstly, you will need to know the payment result (if it's successful or not) and check that value to determine the Enabled property of the Pay button. Its default value would be False, and when the payment is successful, would be turned to True.

I can think of 2 ways to refresh that value:

  • You can use JavaScript timeout to Ajax-refresh that button every X seconds. Frankly this is not the best way as it would refresh a part of the screen unnecessarily very frequently
  • Or better, you can have a push mechanism which would let a certain page know that there is a change in a status, and you would disable the button by checking that new status. But that would require some new coding and using a library like Firebase.


I would actually suggest that you check the status of the payment right before you proceed with the actual payment operation. So if it is already paid, you would not continue with the operation and show the user a warning message like "Payment already done". 

The Pay button would not be disabled in that case, but it's more important to always check the payment status in backend before proceeding, anyway.

Hi Ozan,

Your idea of checking the payment status before proceeding with the payment process works. 


Thanks!


Regards,

Madhavan

Hi,

I hope you are doing well.

Set button property to "Ajax submit" and try once.

I hope this will work.

Kind Regards,

Ajit Kurane.

Hi Ajit,

I did as you mentioned and also I have made condition to check the status of the payment during the payment process.


Thanks!


Regards,

Madhavan

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.