#PSN-webhook
1 messages · Page 1 of 1 (latest)
Yea
"request": "req_R6AHbtl3fig2Fb",
"id": "evt_1K1QEGDwibixiHDSI3za51Xf"
Uhm anything yet?
Thanks, it seems like your server is returning 500 errors.
Can you take a look at your server log and see if you can fix the problem?
Yea it is returning 500 because "subscription": inside lines > data is coming as null,
Ideally your server should responds with 200 upon receiving webhook event
My question is while testing the subscription key returns correct value
But in live mode it returns null
proration": false,
"quantity": 1,
"subscription": null,
"subscription_item": "si_Kgnp1C7OSMbWla",
"tax_amounts": [
],
"tax_rates": [
],
"type": "subscription",
"unique_id": "il_1K1QEBDwibixiHDSGTzHxc0p",
"unique_line_item_id": "sli_1041a8DwibixiHDSe3a834e2"
Live
can you show me the code snippet? and do you use the live key in production?
"proration": false,
"quantity": 1,
"subscription": "sub_1JqBIBSCFdGObjpQ1GAJvIoT",
"subscription_item": "si_KVBfTJm7SAwdsj",
"tax_amounts": [
],
"tax_rates": [
],
"type": "subscription"
type = instance.raw_data['type']
data = instance.raw_data['data']['object']
if type == 'invoice.paid':
lines = data['lines']['data']
period_end_list = [line['period']['end'] for line in lines if line['subscription’] == data['subscription']]

Should I take the id instead? from lines> data >id?
@subtle sigil ?
Hello @proper bloom, I will step in but I am a bit stretched right now. Spare me some time
Sure
Hey! Taking over from @jolly hearth – let me catch up
Cool
Yeah, you want this field: https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yea but inside that the subscription key is null
When using live mode
It’s working fine on test mode
See this event request
In this case you want the id field of the line item
Because the line item id field in this instance is from the subscription itself
This behaviour should be consistent across test/live, if you're seeing differently then it's likely the subscriptions/invoices are configured differently
Is there a test event where this is different?
Well for starters they're events from different accounts using different API versions
API shape is likely to be different in those cases
evt_1K1R0sSCFdGObjpQTuQcuBeQ is using API version 2020-08-27 (latest)
evt_1K1QEGDwibixiHDSI3za51Xf is using API version 2015-04-07
What is the desired outcome here?