#rohrig

1 messages · Page 1 of 1 (latest)

acoustic starBOT
surreal turret
#

👋 Thanks for reaching out
Yes what is your ask ?

brave torrent
#

I add meta data to each phase of a subscription schedule.

#

When an invoice is created, the metadata reflects the current phase in which the invoice was created. all good

#

but some time lapses between the invoice.created event and the invoice.payment_succeeded event... .

#

the metadata for the invoice.payment_succeeded reflect the current phase, not the phase in which the invoice was created.

#

I need a way to know the metadata from the invoice.created event, without having to save it, if possible.

#

So, it would be nice to either:

#

be able to retrieve the invoice.created event by the invoice_id

#

or

#

somehow automatically save the metadata to every invoice event

surreal turret
brave torrent
#

that has the metadata from the current phase, not the phase in which the invoice was created

#

I can provide some event Id's if that would help for you to see yourself

surreal turret
#

once you receive the eventId, you should have the related invoice Id to it. You can make an API call in order to fetch its details.

brave torrent
#

My problem is not retrieving the invoice

#

please re-read the chat once more

surreal turret
#

the metadata for the invoice.payment_succeeded reflect the current phase, not the phase in which the invoice was created.
You mean that the invoiceId you are getting in that event is for a phase and the metadata are for another pahse ?

#

Could you please share an eventId, what metadata are you expecting to have?

brave torrent
#

invoice.created evt_1MD5pzAKCSJdfo77NHMVBb2H

invoice.payment_succeeded evt_1MD5siAKCSJdfo77oqeqEfkZ

#

brb

#

check the phase_id in the lines metadata

surreal turret
#

thanks for sharing let me check

brave torrent
#

are you able to view the events?

surreal turret
#

Yes checking...

#

Sorry for my late reply. The subscription metadatas are managed by your integration. You did an update on the subscription between those two events and changed the metadata phase_id 's value from 718to 720 of the first item.
https://dashboard.stripe.com/test/logs/req_PF48pCaoqZ4GMW
That value of the metadata in the webhook event raw, is taken from the Subscription level. That's why later on the invoice.payment_succeeded you are having the new value.

#

What you can do is to postpone the subscription Update untill you make sure that the invoice is paid and all related events are treated. Then you do the update of the metadatas to the new values

brave torrent
#

Thanks, I understand that.

So, it would be nice to either:
be able to retrieve the invoice.created event by the invoice_id
or
somehow automatically save the metadata to every invoice event

are either of these possible?

proud heath
#

You can't list Events by a related object id. So you'd store this logic/mapping on your end instead.
I'm not sure I grasp the second part

brave torrent
#

I'd like to have whatever metadata is set during the invoice creation to be accessible on all subsequent invoice events. Does that make sense?

#

how do I "list Events by a related object id?"

proud heath
#

you can't I said it was not possible

#

The metadata of a Subscription are not copied to the Invoice, so that won't happen either.

brave torrent
#

ah shit

#

sorry

#

that would be nice

proud heath
#

There's a "hack"

#

the line item of an Invoice will have the Subscription's metadata

#

so you could look at that

brave torrent
#

Those are the metadata I'm looking at, which don't match from one event to another, (see above)

#

invoice.created evt_1MD5pzAKCSJdfo77NHMVBb2H

invoice.payment_succeeded evt_1MD5siAKCSJdfo77oqeqEfkZ

proud heath
#

because they reflect the metadata at the time of Event creation, which is what my colleague explained.

I'd like to have whatever metadata is set during the invoice creation to be accessible on all subsequent invoice events
that's the part I didn't grasp earlier "subsequent invoice events". So yeah that is just not possible today.
My advice is to write code that listens to invoice.created and then sets the right metadata at that point

brave torrent
#

I was trying to avoid that, but if that's the only way I guess I'll have to. thanks