Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kylian's avatar

best way to add role after subscription successfull

I just finished the configuration of laravel cashier with stripe, I offer 2 subscriptions (premium 1 month, premium lifetime).

I would like to assign the role to the user who pays for it, when is the best time to do it? I wanted to do it on the success page after the checkout but I noticed that you could come back to this page and the role would be re-assigned...

0 likes
2 replies
ItsClassified's avatar

Well u could always check if the role is assigned and not assign it again..? Assigning a role after a payment or anything else I would always do at the end after you confirm the payment has been made.

Example:

  • I buy something
  • You make an API call to payment API
  • I pay for it and get send back to your callback url
  • You make an API call to EMS api to get the status.
  • You validate that the payment was correct.
  • You assign the role.
  • You send me to the success page.

PS. This is just an example, u can use any payment ofcourse

kylian's avatar

I could use the webhooks checkout.success right?

Please or to participate in this conversation.