#adrien_thierry - metadata

1 messages · Page 1 of 1 (latest)

halcyon forge
#

Metadata will only be on the objects you set it on, it is not automatically copied between related objects. So you will want to look at the checkout_session.succeeded event to see the metadata you set here

#

You can then use that to set the metadata on the payment intent if you would like

sterile tulip
#

ok thx, i will try it

#

so, how to use the field "metadata" in the product and payment link pages ?

halcyon forge
#

Where exactly are you setting it? Can you send me the snippet of code here?

sterile tulip
#

also, I don't have the checkout_session.succeeded event in the webhook events list

halcyon forge
#

Can you send me the snippet of code where you set this metadata?

#

Or are you setting it via the Dashboard?

sterile tulip
#

i created the product and the payment link in the dashboard

#

with metadata

#

and i get the stripe answer in my webhook

halcyon forge
#

Do you have the ID from a payment intent that you have had confirmed here? (pi_123)

sterile tulip
#

pi_3KW06cG1Fds6O5ah1TgDCYR7

halcyon forge
#

That event has the Checkout Session which is what you are setting metadata on

sterile tulip
#

ok perfect, thank you, i will check this

#

when there is a renewal event for a subscription, the checkout.sessions.completed is called again ?

halcyon forge
#

No, that event is only called once when the user initially makes their purchase. There will be seperate events for the subscription cycle renewing

#

What are you trying to do when the cycle renews?

#

That can help decide what event you will want to listen to

sterile tulip
#

i just want to renew a user key/license

halcyon forge
#

Checkout Sessions will not automatically set data on the subscription

#

Then you can listen to the invoice.created event and check the Invoice's subscription for the metadata that you set

sterile tulip
#

the subscription id will remain the same when renewal happens ?

halcyon forge
#

invoice.created will be called every time the subscription renews

#

Yes

sterile tulip
#

ok perfect

#

so after the renewal, i should receive a new checkout.sessions.completed ?

halcyon forge
#

No, you will only receive that the very first time the user makes their payment

#

Or puts in their credit card info.

#

When the subscription cycle renews, you will get an invoice.created event and the Invoice will have a billing_reason of subscription_cycle

sterile tulip
#

the invoice_created means that the customer paid ?

halcyon forge
#

In that case, you want to listen to invoice.paid

#

invoice.created is only when the renewal is about to happen and the invoice is created

sterile tulip
#

ok perfect, and in the invoice paid there is also the subscription id, right ?

halcyon forge