Open chrisulloa opened 12 months ago
Hey @chrisulloa thank you for the detailed report on this 👍 I'll look further into this as soon as possible.
This plugin is now being maintained in the Packages Directory of the Payload Monorepo. This repo will soon be archived and all open issues will be closed. This issue, however, will be transferred over. Please refer to this open discussion for more details.
Circling back on this, this should now be possible through the context
property on hooks: https://payloadcms.com/docs/hooks/context. Should be able to simply thread some key through context which indicates to subsequent hooks that the event was initiated by Stripe, in order to ultimately skip the follow-up deletion that is made.
When I delete a product from Stripe, the following error crashes my application:
After some investigation it appears that the afterDelete
deleteFromStripe
collection hook errors out here after a 404 response from Stripe https://github.com/payloadcms/plugin-stripe/blob/main/src/hooks/deleteFromStripe.ts#L37Looking at the webhook events after I delete a product in Stripe -> product.deleted (deletes product in payload) -> deleteFromStripe collection hook attempts to delete product already deleted in Stripe
stripe.retrieve throws an error caused by 404 rather than returning null. expected behavior is for the else block to be called and the afterDelete hook to terminate without error.
Stripe 10.2.0 @payloadcms/plugin-stripe 0.0.14 payload 1.6.32