You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Laravel Cashier together with Stripe as my payment provider and am trying to figure out what the exact correct flow should be to fulfil an order. It's for a job listing application, so in this case in my JobController I run these following steps within the store method.
Create a user record.
Create a job record with a pending state and attach it to the created 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. In the case something goes wrong, it might so happen that the user never ends up on the success page so this makes sense.
The Stripe event can be fetched from the Webhook using a StripeEventListener:
public function handle(WebhookReceived $event)
{
$session = $event->data->object
}
I am receiving an event after a user has successfully completed a checkout session so up to that part the flow is perfect.
Once the user has completed the checkout session and receive the event as confirmation I want to set their job listing to a published or live state though. I need to know at that point from the session event for which model they paid for. I need the ID of the recently created job.
I think there are 2 options here but I am not entirely sure.
Pass metadata along to the session which holds the model id so I can retrieve the model and update the state.
Save the id of the session locally in some sort of polymorphic payments table so I can connect models with sessions.
There is no documentation on how to deal with this, but I think this is an extremely common scenario. Is there anyone who ran into this who can help me out?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Laravel Cashier together with Stripe as my payment provider and am trying to figure out what the exact correct flow should be to fulfil an order. It's for a job listing application, so in this case in my
JobController
I run these following steps within thestore
method.From there on the Stripe documentation indicates you should rely on Webhook to fulfil the order rather than the success page. In the case something goes wrong, it might so happen that the user never ends up on the success page so this makes sense.
The Stripe event can be fetched from the Webhook using a StripeEventListener:
I am receiving an event after a user has successfully completed a checkout session so up to that part the flow is perfect.
Once the user has completed the checkout session and receive the event as confirmation I want to set their job listing to a
published
orlive
state though. I need to know at that point from the session event for which model they paid for. I need the ID of the recently created job.I think there are 2 options here but I am not entirely sure.
payments
table so I can connect models with sessions.There is no documentation on how to deal with this, but I think this is an extremely common scenario. Is there anyone who ran into this who can help me out?
Beta Was this translation helpful? Give feedback.
All reactions