fireship-io / fireship.io

Build and ship your app faster https://fireship.io
3.52k stars 1.31k forks source link

courses/stripe-js/checkout-server/ #820

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Stripe Checkout on the Server

Create a checkout session on the server

https://fireship.io/courses/stripe-js/checkout-server/

mattmascolo commented 2 years ago

I'm having trouble testing the checkout session on: Stripe Checkout on the Server (https://fireship.io/courses/stripe-js/checkout-server/)

Could anyone assist me with this error: TypeError: Cannot read property 'line_items' of undefined at exports.app.post.runAsync

mattmascolo commented 2 years ago
Screen Shot 2022-06-23 at 12 29 14 PM
mattmascolo commented 2 years ago

Solved!! This was caused because Express handles incoming body elements as a string. Which prevented me from executing the createStripeCheckoutSession(body.line_items)

Because body.line_items was not an object :)