#Ajith-webhook
1 messages · Page 1 of 1 (latest)
hello there! Can you share more about your use case? and what you've setup / tried thus far?
At the start, I create a checkout session to start the subscription process with these values.
Please note the metadata, that is important for me
I need to get them when any of the invoice event is invoked in the webhook
How can i retrive the metadata in the webhook
have you set up / deployed a webhook to listen for the events? https://stripe.com/docs/webhooks/quickstart
yes
alright, so when you receive the invoice event, it will contain line_items. A line_item with type=subscription will reflect the metadata of the subscription that caused the line item to be created. [0]
[0] https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-metadata
Will i get the metadata inside subscription_data or the outer metadata which i gave as params at the start of creating a checkout session above/
And is there any extra code needed to be written to retrieve the invoice event?
Currently my webhook looks like this
It is nodeja
nodejs*
this is an example from an invoice.payment_succeeded event
...
"lines": {
"object": "list",
"data": [
{
"id": "il_1KZ8jVJQtHgRImA7Fgh9E7zO",
"object": "line_item",
"amount": 2000,
"currency": "usd",
"description": "1 × Customer Portal Test (at $20.00 / month)",
"discount_amounts": [
],
"discountable": true,
"discounts": [
],
"livemode": false,
"metadata": {
"key": "value"
},
"period": {
"end": 1648969552,
"start": 1646291152
},
"plan": {
"id": "price_...
...
you can see
"metadata": {
"key": "value"
},
i'd suggest you create a Checkout Session, complete it, then you'll be able to see how the events look like in the Stripe Dashboard
Okay