• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refresh after webhook callbackh the p

#1
Hi all,

I'm wondering how to achieve refreshing or repaint a part of the users view after receipt of a webhook call back from Stripe.

In our specific case:

1) User logs in.  This causes session data to have login details
2) They go to a payment dialog and make a payment.  The way stripe works is we have to setup a payment intent and send it off to stripe.  Stripe is configured to call a webhook call back in our code.   Call it.  stripepayment() for simplicity.

So issue is that in steps 1 and 2 the users browser is handling the payment and that browser has the logged in session data.

The payment intent is sent to stripe and it makes a webhook call back into our site using a specific controller/function.  For this example say it is mysite/payments/stripepayment.  We get some json data telling us about the payment so we can apply it to the correct account.

Here is the desire.  When this webhook call is made I would like to cause an update to the users browser session, perhaps a page refresh so we can so that their payment was credited.  But the webhook call back comes from stripe.com, it does not have any session data related to the users browser session or any connection what so ever to the users browser session.

Yes the webhook provides some call back info that allows us to update the users account with the payment data, but what would be a good way to notifiy the user whose browser is sitting on the payment screen that this succeed?

For now simply triggering a refresh would be ok.  I've considered  after the payment intent is set simply issuing a redirect for the user back the page but I'm concerned that the payment could take a short time and my redirect would be too early.

Any idea on how to coordinate this would be appreciated.
Reply

#2
This might be what your looking for in php, but you could also do it using JavaScript.

Refresh a page using PHP

jQuery way.

How to refresh a page using jQuery
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.