#acaiafa

1 messages · Page 1 of 1 (latest)

faint trenchBOT
stark pagoda
fading peak
#

The problem with invoice.paid upon activation is that I don't have the client_reference_id... I only have this in "checkout.session.completed" but these events arrive for me out of order, so how can I resolve this impasse?

stark pagoda
#

You can't as we don't guarantee event ordering

#

The recommendation would be to use some metadata on the Subscription

#

client_reference_id doesn't propogate to other objects

fading peak
#

but this is exactly the field that allows me to synchronize

stark pagoda
#

It's not available in events for recurring payments, so you're going to need to use another field

fading peak
#

so in the activation I was using checkout.session.complete validating the payment_status=paid field and for monthly renewals I would use invoice.paid

stark pagoda
#

What does client_reference_id map to?

fading peak
#

my client's unique code within my system

#

because on activation I couldn't use "checkout.session.complete validating the payment_status=paid" and on recurring invoice.paid? Wouldn't it work?

stark pagoda
#

Then what I'd recommend you do is when you recieve the checkout.session.completed event you use the client_reference_id and map the the related sub_xxx ID (from the same event) to the corresponding user in your system

#

All subsequent invoice.paid events will have the same sub_xxx ID too

fading peak
#

that's what i'm doing.

stark pagoda
#

Then I'm not sure where your issue lies

fading peak
#

when a webhook returns an error, how long after does it try again?

#

I just wanted to help confirm that this was the correct way. I explained this in my first message