#Monimolimnion
1 messages ยท Page 1 of 1 (latest)
hi
i'll bombard you with some code to set the scene
client side I have made a wrapper for Stripe for my checkout screen
instead would you mind explaining what the issue is?
I would if I knew what it was... essentially I hit my server endpoint that should create a new checkout session, but nothing happens
no errors
const session = await stripe.checkout.sessions.create({
mode: "payment",
payment_method_types: ['card'],
line_items: lineItems,
success_url: `http://localhost:5173/checkout/success`,
cancel_url: 'http://localhost:5173/checkout/details'
});
console.log(session)
await goto(307, session.url)
the session does not log
is this node.js code?
I believe so
do you have a request ID? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
I have @stripe/stripe-js and stripe installed
ah hah!
400 errors abound
what's up with this?
"line_items": {
"0": {
"description": "My Event",
"quantity": "1",
"id": "1"
,
"amount": "222000.00"
},
"1": {
"description": "Delegate",
"quantity": "1",
"id": "6b284965-09b6-47ac-b4c7-7fe75f972ac9",
"amount": "222000.00"
},
the error is that it doesn't like the "id": "1" , but it's fine with the UUID in the second line item
you can't put id and amount
please look at the docs https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
great, got that working, thanks
the session is created successfully, but now my app won't redirect to the checkout page ๐ค
Hi ๐ jumping in as my teammate needed to step away. Can you share more details? Are you seeing errors being thrown?
no
I'm logging the session and it's creating fine now, with a nice URL that I can navigate to manually
in my server endpoint I'm running goto(session.url)
but I'm probably using it wrong
Sorry, I'm not familiar with that framework and can't provide guidance on how to use it specifically.
ok