Skip to content Skip to sidebar Skip to footer

Stripe.js - Resolve Cannot Read Property 'stripeToken' Of Undefined

I'm building my first basic Express app using Stripe's Checkout. The app renders correctly but when I submit the form, I get an error on both stripeToken and stripeEmail. I'm not s

Solution 1:

The issue was that the Stripe docs example did not include bodyParser.

req.Body just returns an object from the form submission. Without bodyParser, there's no way to get those two strings.

Add this to app.js and you're golden:

const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());

Post a Comment for "Stripe.js - Resolve Cannot Read Property 'stripeToken' Of Undefined"