#Thnks_CJ-node-webhook

1 messages · Page 1 of 1 (latest)

vital sentinel
#

hello

#

this is a ~relatively common issue with Node and its web server middleware

hollow moon
#

im not using node

#

im using ts sorry for not saying

vital sentinel
#

you're using TS with stripe-node and presumably some Node web server framework (like Express), right?

hollow moon
#

yes

vital sentinel
#

yeah so same thing, basically some middleware/framework you're using is modifying the raw Event body from the Webhook Event that is sent to you

there are different fixes depending on what framework you're using and how your code is structured

there is a large Github thread here with different answers depending: have a read through this: https://github.com/stripe/stripe-node/issues/341

and try out the approaches there like this one: https://github.com/stripe/stripe-node/blob/master/examples/webhook-signing/node-express/express.js

which sends the raw request to the /webhook endpoint and everything else is pushed on to Express

GitHub

If you use in your express app bodyParser.json() for all routes, and then have a dedicated route for stripe's webhook, then the second call to bodyParser.json({verify: ...}) as done in the ...

GitHub

Node.js library for the Stripe API. . Contribute to stripe/stripe-node development by creating an account on GitHub.

hollow moon
#

so removing

app.use(express.json());
app.use(express.urlencoded({ extended: false }));```
#

should fix it?

vital sentinel
#

I can't say

#

the answer really depends on what your code is doing, you'll have to try out the solutions in that thread

hollow moon
#

also what happened to google pay?

#

its removed the option for google pay?

#

@vital sentinel

vital sentinel
#

there are many factors for this, the Google Pay option wasn't removed, rather it can be factors like your browser not being set up for Google Pay correctly

#

so first

#

go here:

#

at the top, do you see the Google Pay button with your browser (do NOT use incognito mode!)

#

?

hollow moon
#

yes

vital sentinel
#

ok now, can you send me an example CheckoutSession ID for the "NEW" case, which does not show Google Pay button

hollow moon
#

well its one of your prebuilt pages

vital sentinel
#

ah yeah Apple and Google Pay only work when shipping address is requested on Checkout along with Tax

this is using Tax but not shipping address. It doesn't work cause Google/Apple Pay don't return a full address at the time when the customer selects a payment method so they can't be shown as options