#davila7

1 messages · Page 1 of 1 (latest)

solemn plinthBOT
uneven shell
#

Hello, are you asking about what webhook event to listen to or something else?

split heron
#

Yes, I have the webhook ready for regular payments, but I don't know if it work for subscriptions payments confirmation too

uneven shell
#

What event are you listening to there?

split heron
#

checkout.session.completed

uneven shell
#

So for subscriptions that will also be triggered but only for the first payment

#

For subscription payments in general you can listen to invoice.paid

#

That will trigger for the first payment and every recurring one. You can check the Invoice's billing_reason field to tell the difference, it will be set to something like subscription_start for the first payment and subscription_cycle for all others

split heron
#

ok, and I can get the $event->data->object->client_reference_id; ?

#

for every recurring one ?

uneven shell
#

Client reference ID only exists on the Checkout Session so it won't be available on the other events

#

So you will likely want to set that ID as metadata on the subscription and check the webhook for that

#

Or you can save what reference ID goes to what subscription in your own database

split heron
#

ok great!

#

thanks