Nutlope / roomGPT

Upload a photo of your room to generate your dream room with AI.
https://www.roomgpt.io/
MIT License
9.87k stars 1.31k forks source link

Avoid creating duplicate credits #61

Closed jpmti2016 closed 1 year ago

jpmti2016 commented 1 year ago

Both events are fired ("payment_intent.succeeded", "checkout.session.completed") in a successful interaction. They behave like a state machine not exclusionary.

vercel[bot] commented 1 year ago

@jpmti2016 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Nutlope commented 1 year ago

Is there any benefit to remove that, even though both events fire? Seems fine to be tbh to be exhaustive.

jpmti2016 commented 1 year ago

As the transaction state progress, it fires different events. If you do something for both "payment_intent.succeeded", and "checkout.session.completed", it will result in the code executed 2 times for the same transaction. My understanding is that the credits should be modified when the last event is fired for the transaction.