#Dheeraj Kumawat-redirecttocheckout

1 messages · Page 1 of 1 (latest)

normal fjord
#

Hey there! Are you creating a Checkout Session? Or just passing parameters to redirectToCheckout?

barren drum
#

passing parameter to redirectToCheckout

#

stripe.redirectToCheckout({
lineItems:[
{
price: "",
quantity:1,
},
],
mode:"payment",
successUrl:currentAddress,
cancelUrl: currentAddress,
billingAddressCollection: "required"
})
.then(function(result){

      });
#

like this

normal fjord
barren drum
#

const stripe = require('stripe')('sk_test_51JRYycEyVrenzoaUuOW55bEq0sNjCb1Z7mo26EyUm25GYSnvEyNY3vZOl5hAg638d0ZKMLFTscEIjXL1ME1NXiRI00LMeYdKtl');

const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
line_items: [
{price: 'price_H5ggYwtDq4fbrJ', quantity: 2},
],
mode: 'payment',
});

#

in session also their is no option to provide dynamic amount

normal fjord
barren drum
#

its also using price key

#

after the session what to do?

#

i am new to this so need some step guidance for this

normal fjord
#

But generally you'd redirect your customer to the url field returned in the Checkout Session object

barren drum
#

i have a html and javascript based application. How to do this in that?

barren drum
normal fjord
#

Well you can't use dynamic price data without a server (be that Node or PHP) to create a Checkout Session

#

So if you only have HTML and client JS to work with, it's not possible