#Thesingh - invalid stripe version
1 messages · Page 1 of 1 (latest)
Yes
Am in many threads. Ok ready
Can you share more details about the error?
Including any request IDS
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: "2020-08-27",
});
this is what the apiversion I am using ,that i got from my stripe dashboard
..getting error as I said above
When I try to create a session
Try setting it like this: const stripe = require('stripe')('sk_123', { apiVersion: '2020-08-27', });
Interesting. Ok one moment
but i am using es6
Looking
IE6?
That's not a supported browser: https://stripe.com/docs/js/appendix/supported_browsers
ES6 module in js
Ok. Asking a colleague
What version of stripe-node are you using? Older versions need to use api_version instead of apiVersion
Ok now that error got cleared ...thank you..now facing another issue
import { stripe } from '../server.js';
import Stripe from 'stripe';
import asyncHandler from 'express-async-handler'
import Order from '../models/orderModel.js';
import { response } from 'express';
export const createStripeCheckoutSession=asyncHandler(async(req,res,next) => {
//get currently ordered products
const order = await Order.findById(req.params.id)
console.log(req.body.line_items)
const line_items=req.body
// console.log(req.body.body.line_items)
const url = http://localhost:3000;
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
success_url: ${url}/success?session_id={CHECKOUT_SESSION_ID},
cancel_url: ${url}/failed,
// customer_email:req.user.email,
customer_email:'rajasinghplkm@gmail.com',
client_reference_id:req.params.id,
line_items:[
{
name:'asdf',
description:'qwerty',
images:['https://images.unsplash.com/photo-1612817288484-6f916006741a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80'],
amount:'700',
currency:'inr',
quantity: 1,
}
]
});
response.status(200).json({
status: 'success',
session
})
})
when I call this function...I am getting below error
TypeError: Cannot read properties of undefined (reading 'get')\n
Hello 👋
Stepping in for @hollow glade here
Which function are you calling? Sorry the code is too abstract.