Stripe Webhook: how to test with metadata?

I’ve been struggling with this for weeks… Would love some help!
I need to test my webhook by doing something with the MetaData that is sent by Stripe.

My set up:

  1. I have a paymentintent where I send an array of product ids as metadata (1) and it’s for stripe connected accounts(2):

  2. This is an example of a webhook that stripe sends:

Now I want to test my server action that I made under Webhooks/stripe/payment_intent.succeeded
But, I can’t use the built-in image webhook testing, because this doesn’t send metadata.

Then I hoped I could simply complete the check-out with test data. But this gives me an error:

Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

I think this error is due to a mismatch of the webhook endpoint secrets.

Ideally I just want to complete the check out in test mode (public test key on client side) using stripe’s test card. And then trigger the webhook on my local or live server.

(@Fred_K any idea perhaps?)

Stripe support says I need two different endpoints and use different webhook secrets for each
https://…app/webhooks/stripe/ )


Wappler team, any chance you can support this? Right now I don’t see how I could test these events (my situation in OP)

All of these settings are per target:

Just put your test secrets in, while your development target is active in wappler. Then with your production target active, put in your live secrets.

For some reason that didn’t connect in my brain… I’ll try and see if this fixes it.

Sorry, webhooks are still a difficult concept to me and wappler’s tutorials did not help either.
All my webhooks tests fail so far.

Do you really have to use the metadata for passing the checkout ID and product IDs?

@Fred_K Ah okay, thanks anyway!

Perhaps this helps you to get a better understanding:

And yes, this is the suggested way by the Stripe engineers.

@mebeingken I realised again what I’m missing: I can divide the stripe settings per target, but there’s no setting for a separate URL in Wappler, like:
We only get this one default: /webhooks/stripe/

Am I wrong?

The domain for dev and production will be different but the path to the api and the api name will be the same.

The url you provide to Stripe under the test settings will have your dev domain and live settings gets your production domain.

If you only have localhost then you can either use the internal Wappler testing or use ngrok to redirect an external domain to local.

I’ve never used the local Wappler testing and prefer to have a “remote dev” environment that I use in later stages of development. And occasionally I use ngrok.

Thanks @mebeingken, indeed I only have a local testing environment right now. Well I actually have a staging server but have issues connecting to the database with that still.

Looks like I need to get the staging working 100% for this.
Do you perhaps have experience doing that with Node and docker? (making a staging server)

Nothing special about a staging target. It gets setup like any other target. You just need to remember that certain settings, like the database connections and server workflow settings panel are set based on the target you have active in the editor.

Yeah I’ve learned that the hard way in the last months. Since I was already aware of this, I’m guessing I don’t fully understand you.

You’re saying I don’t need a staging server?

Sorry - can you expand on this one more time?