N
Nuxt8mo ago
isakwang

importing stripe in API

Hello Im looking at how to integrate stripe into Nuxt and have to create a server route to deal with creating sessions. When importing the package im getting an error that they can´t find the package, but it is on npm. Any obvius solutions? Error: [worker reload] [worker init] Cannot find package '@stripe/stripe-js' import {loadStripe} from '@stripe/stripe-js'; export default defineEventHandler(async (event) => { const stripe = await loadStripe(process.env.STRIPE_SECRET_KEY); const session = await stripe.checkout.session.create({ success_url: '/response/success', line_items: [ { price: 'price_1PEZkcP1SGiKSfI8iw0DBc1q', quantity: 3 }, ], mode: 'payment' }) return session }) Relevant docs https://docs.stripe.com/api/checkout/sessions/create https://docs.stripe.com/libraries/stripejs-esmodule#web-stripejs-esmodule https://docs.stripe.com/checkout/quickstart
Create a Session | Stripe API Reference
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ES Module Stripe.js SDK
Set up the ES Module Stripe.js client-side SDK in your web application.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server