What is the exact flow to fulfil a Stripe checkout order?
I'm using Laravel Cashier together with Stripe as my payment provider and am trying to figure out what the exact flow should be to fulfil an order. It's for a job listing application, so in this case in my JobController I run these steps within the store method.
- Create a user.
- Create the job with a pending state and attach it to that user.
- Redirect the user to a Stripe checkout using the
$user->checkout()method.
From there on the Stripe documentation indicates you should rely on Webhook to fulfil the order rather than the success page which seems like the smart thing to do. The Stripe event can be fetched from the Webhook using:
$session = $event->data->object
However I don't think you can access this and save this locally before actually going into the checkout since it is generated there. What am I suppose to do to actually update the pending state of the job to set it as published/live? How can I tell from the webhook event which job should have it's status updated? Do I pass in the id as metadata somewhere?
Please or to participate in this conversation.