#crehbichler-SetupIntent

1 messages · Page 1 of 1 (latest)

eager tiger
eager tiger
#

Hi there. the behavior is expected, as the first invoice is 0$ and eventhough there is an invoice.payment_succeeded, the payment_intent can be null. What you are doing is correct, you just need to check the content of payment_intent when received invoice.payment_suceeded to continue doing your logic

rich hill
#

So I wouldn't set the default payment method for the customer in the invoice.payment_succeeded webhook event? Is there another webhook event for that?

eager tiger
#

When you use confirmCardSetup and customer entered his card information, you should receive the setup_intent.succeeded event

rich hill
#

Okay. How do I know if this was the setupIntent from creating the subscription, and not one that was added later on?
So I know I can set the payment method of the setupIntent to default for the customer

#

Another idea would be to not rely on the webhook, but to attach + set the default payment method immediately after creating the subscription (in backend) for 0 amount payments

eager tiger
#

The distinguish the SetupIntent you would need to rely on its Id, like saving pending_setup_intent somewhere when you create such a Subscription. I would recommend to rely on webhook, as at the time the Subscription is just created, you don't know if the customer can actually authorize it or not

rich hill
#

Makes sense, thank you!