#adrien_thierry - metadata
1 messages · Page 1 of 1 (latest)
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
ok thx, i will try it
so, how to use the field "metadata" in the product and payment link pages ?
Where exactly are you setting it? Can you send me the snippet of code here?
also, I don't have the checkout_session.succeeded event in the webhook events list
Can you send me the snippet of code where you set this metadata?
Or are you setting it via the Dashboard?
in the dashboard
i created the product and the payment link in the dashboard
with metadata
and i get the stripe answer in my webhook
Do you have the ID from a payment intent that you have had confirmed here? (pi_123)
pi_3KW06cG1Fds6O5ah1TgDCYR7
Apologies, I got the event name wrong. You will want to look at checkout.session.completed https://dashboard.stripe.com/test/events/evt_1KW06fG1Fds6O5aheR7l6g3i
That event has the Checkout Session which is what you are setting metadata on
ok perfect, thank you, i will check this
when there is a renewal event for a subscription, the checkout.sessions.completed is called again ?
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
i just want to renew a user key/license
It sounds like you want to set your metadata in the subsbcription_data.metadata field as well https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
the subscription id will remain the same when renewal happens ?
ok perfect
so after the renewal, i should receive a new checkout.sessions.completed ?
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
This may help clarify https://stripe.com/docs/billing/subscriptions/overview#subscription-events
the invoice_created means that the customer paid ?
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
ok perfect, and in the invoice paid there is also the subscription id, right ?
Correct, the Invoice will have a Subscription ID https://stripe.com/docs/api/invoices/object#invoice_object-subscription