Trouble with Stripe webhooks and JSON data

Hi,

I’m trying to set up webhooks to get charge.succeeded and charge.failed from stripe, and then to save the details of that charge into my database.

I’m facing 2 issues:

  1. Some of the data I need to get is (I don’t know if this is the correct term, but) embedded 1 or 2 layers down - for example, below you’ll see that within “data”, there’s “object”, and within “object” there’s “id” which has the charge number - I want to get this number, but I’m not sure how.

I found that i was able to get data from the 1st “level”, but I don’t know how to get things that are on lower levels.

For example, when I set up the Webhook API endpoint like this:

I was able to create a thing and save the id, which came out as this (which is good):

image

Any ideas how I can get to the information on lower levels, like the ch_?

  1. I’m using Stripe’s subscriptions for my app - when a charge goes through, I need to know which subscription it was in reference to, but the charge doesn’t appear to have the reference subscription (this also could be maybe because it’s stripe’s Test Webhook, and not one of my actual subscriptions) - if the webhook doesn’t include the reference subscription, any ideas on how I can get it?

Thanks in advance,

Jeff

The manual definition of parameters is very limited, you may have better luck with the automatic parameter detection. It has better handling of nested objects, but still not perfect with all situations.

Edit - removed insane suggestion

Edit 2 - I vaguely remember one of Bubble’s tutorials covers handling of Stripe webhook … it picks the event id and calls a Stripe API for the event details.

1 Like

Thank you. The automatic parameter detection did the trick! :slight_smile:

1 Like

I’ve done this too many times… :laughing: