#makasmi-webhook-invoice-paid
1 messages · Page 1 of 1 (latest)
Hi there!
So you need the PaymentIntent for this.
Can I ask why you decided on invoice.paid versus listening to payment_intent.succeeded?
It can work either way (though you may need extra requests), but just curious.
Because i didn't receive this event , i only received thoses events for the second recurring payment:
Hmm interesting. What API version are you using?
Oh ignore that
It says at the top there that your endpoint is on 2020-08-27
Was this a $0 invoice?
To make this easier actually could you provide me that invoice.payment_succeeded event?
The event ID I mean
ok
"id": "evt_1LbvX7JjSYM2P8eWZ48KB47z",
it's just an invoice test
the payment_intent.succeeded event is returned for the first recurring payement but in the second automaic payment , i didnt receive itt
Ah okay yeah so that is a $0 invoice
Which is why you don't see a payment_intent.succeeded
It is also why you won't have a PaymentIntent ID at all
ah okey so i can use both invoice.paid or payment_intent.succeeded
to get informations about the second third ... recurring payments
Yep every successful payment that isn't $0 will fire a payment_intent.succeeded event
Thanks very much
If you are just looking to ingest data about a Subscription renewing then you likely want customer.subscription.updated
Sure thing! Let me know if I can help further!
i m looking for the payment id , amount and user for next payments (from the second) to save them intto my database
so i will use payment_intent.succeeded and search the field tto differenciate between one-time payment and recurring payment
Gotcha. So the most reliable thing here is to use customer.subscription.updated. Then you retrieve the Subscription based on the event using (https://stripe.com/docs/api/subscriptions/retrieve) and expand the latest_invoice and the payment_intent.
The reason you want to use this event is it will be all-encompassing
It will fire any time the Subscription renews, so whether it is a $0 payment or not $0.
The reason this is better than invoice.payment_succeeded is that you can also use it to monitor the Subscription status.
For instance, if the Subscription does renew for 2nd payment but it fails, then you won't get a invoice.payment_succeeded and you want to know that the customer hasn't paid for the renewal successfully and handle that accordingly.
Great so i will use first customer.subscription.updated . Thanks a lot for your help and your time
Happy to help!