#PSN-webhook

1 messages · Page 1 of 1 (latest)

subtle sigil
#

Hi there, can you send me the event ID ?

proper bloom
#

Yea

#

"request": "req_R6AHbtl3fig2Fb",

#

"id": "evt_1K1QEGDwibixiHDSI3za51Xf"

#

Uhm anything yet?

subtle sigil
#

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?

proper bloom
#

Yea it is returning 500 because "subscription": inside lines > data is coming as null,

subtle sigil
#

Ideally your server should responds with 200 upon receiving webhook event

proper bloom
#

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"

subtle sigil
#

can you show me the code snippet? and do you use the live key in production?

proper bloom
#

"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 ?

jolly hearth
#

Hello @proper bloom, I will step in but I am a bit stretched right now. Spare me some time

proper bloom
#

Sure

surreal monolith
#

Hey! Taking over from @jolly hearth – let me catch up

proper bloom
#

Cool

surreal monolith
proper bloom
#

Yea but inside that the subscription key is null

#

When using live mode

#

It’s working fine on test mode

proper bloom
surreal monolith
#

In this case you want the id field of the line item

proper bloom
#

Ok

#

Why is it coming null?

surreal monolith
#

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?

proper bloom
#

Yea

#

"id": "evt_1K1R0sSCFdGObjpQTuQcuBeQ",

surreal monolith
#

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?