In my Laravel 8 app I’m using Stripe-provided payment links from my Stripe account to provide a purchase widget in my app’s pricing blade and process payment through Stripe’s checkout page. This all works fine, and I can use Spatie’s laravel-stripe-webhooks to catch the webhooks generated and process the payload in the job.
The issue I’m having is that I need to update the user account with his/her Stripe customer ID and other info from their purchase and the payload doesn’t know/indicate who my user is so that I can update the correct user account. I can’t feed this to the job as it can’t see any session variables I set on the front end (when the user clicks the payment widget), they don’t persist across the checkout process and return to my app. The Stripe-provided payment link doesn’t allow for the passing of data, such as a user ID, in metadata, like I could do if I programmatically started a checkout intent session. Since my user is authenticated when they make the purchase I thought I could simply read Auth::user()
in the job, but that doesn’t work either (not quite sure why).
This must be a fairly common issue with a similar use case, so I’m hoping someone has a solution I can’t see that gets me from here to there.