#Egon

1 messages · Page 1 of 1 (latest)

sharp stoneBOT
bold burrow
#

Hi there, checkout.session.completed event is fired when your customer has completed the checkout session, it doesn't necessary mean that the payment is succeeded.

I'd suggest you to listen to invoice.paid event instead

lethal lark
#

I would like to enable the subscription for the user once checkout has completed (regardless of the payment succeeding). Then on failure, I would like to disable it.

bold burrow
#

Then you'll run into issue that you just described.

lethal lark
#

My question is in case of the payment failing, how soon the invoice.payment_failed is sent to avoid the situation described above.

bold burrow
#

The problem here is that your system needs time to provision the subscription and unable to handle the invoice.payment_failed event which may occurs after checkout.session.completed, and that's why I suggest you to only provision subscription when invoice.paid event occurs, which is mutually inclusive with invoice.payment_failed.

lethal lark
#

The question is which is generally faster, my system only needs about +- 1 second to provision the subscription.

bold burrow
#

I'd strongly suggest you to listen to invoice.paid so that you can avoid this problem, and don't need to spend extra effort to fix the problem.

lethal lark
#

Fair, although I don't think my customers will be happy if they have to wait for the subscription to become active.

bold burrow
#

Alternatively you can implement an event queue in your system, so that it can still process the invoice.payment_failed event after finishing the provision task.

lethal lark
#

Yeah, that's a good idea. Will probably end up doing that. Thanks for your time!