Stripe - how to retrieve customer subscription information and update the database

Thank you I will give that a shot! Any chance you can guide me on how to setup a webhook ? :grinning:

nevermind… I will follow this: https://docs.wappler.io/t/getting-started-with-stripe-webhooks/31485

Okay so… Webhooks setup and successfully connecting. When I go through the payment checkout as we previously went through, it is successful however my database update is not working. See below. I am trying to update the subscription id in my user object. Webhooks working fine but update not happening. I have tried with static data to see and still not updating.

Okay so I know I am getting the right data because I can email myself the subscription ID. So my database update is not working for another reason.

Ok so everything is working except the webhook is not letting me identify and update a user record. Whe I email myself the user id from {identify} in the previous step, it emails me the value “False”.

Is there a known issue with tryign to get a userId from a webhook action and updating a user record?

Hi Ken,

I am pulling my hair out! haha

In the webhook action, no database queries or updates work. Is this a bug or am I doing something wrong?

You are trying to use the identity of the logged in user, but in a webhook there is nobody logged in. You need to lookup values using data from the webhook itself.

Im such an idiot! haha… fixed and working. Thank you!

There are many ways to do all this. You can also include the checkout session id in the URL you redirect to after purchasing through the portal. That way you can retrieve the session and get everything from there.

Hi there @daves88

I worked out a lot of subscription stuff with my son Leo a few weeks ago… he wrote it all up so you may find this useful!

Best wishes,
Antony.

Thank you Antony! Great to see dad and son coding together !

1 Like