#rays-checkout-quickstart
1 messages · Page 1 of 1 (latest)
@plush night I can try and help if you have a concrete question
Yes, I'm just trying to recreate the prebuilt checkout page and it won't work. I literally copied and pasted it and installed stripe in the console as well
Just don't understand what I'm missing since i was under the impression it was as simple as copy and paste
I'm sorry but I'm still going to need a lot more details from you to help you. This Discord server is for developers asking questions about their own code. I need you to explain what you are doing, where it's failing, etc.
I made a checkout.html file and the button that's supposed to take the user to the payment screen doesn't work. I changed the API key to the one on my account and changed the domain to the local server i'm running off vscode. when the click the button it returns back "this page isn't working"
const express = require('express');
const app = express();
app.use(express.static('public'));
const YOUR_DOMAIN = 'http://127.0.0.1:5500';
app.post('/create-checkout-session', async (req, res) => {
const session = await stripe.checkout.sessions.create({
line_items: [
{
price: 'price_1MincuKkGpyFNMs8Is0Q4JIF',
quantity: 1,
},
],
mode: 'payment',
success_url: `${YOUR_DOMAIN}/success.html`,
cancel_url: `${YOUR_DOMAIN}/cancel.html`,
});
res.redirect(303, session.url);
});
app.listen(4242, () => console.log('Running on port 4242'));```
First of all that code uses your Publishable API key so it will never work. If you look at the logs on your server, it should clearly tell you why it's failing because of this
rays-checkout-quickstart
This is also just the server-side code, without any explanation of what else you did, what happens client-side, if yoy get any error, etc. As the developer, this is important that you take the time to clearly add logs to all parts of the code to debug this (or hire a freelancer to help you set all of this up)
I literally just copied and pasted it
how are there bugs if i pasted it from your logs
I mean you started by putting the wrong key? 😅
also it's a client/server, there are multiple parts that are crucial here to grasp as the developer
it always had the secret key and i changed it becuase i dont know if im supposed to show you
you hardcoded the YOUR_DOMAIN, is that correct?
Again to help you I do really need actionable information about what is or isn't working
i didn't hard come your domain again it came from this
const stripe = require('stripe')('sk_test_51MinZZKkGpyFNMs8UqRPdZ9H3TDMUJzxcf6ExJeBG0BicLZwzluiaA0yf5mep2zEyCjTcwTq0hPJxsZCSmAPoZYY004oxg2qiA');
const express = require('express');
const app = express();
app.use(express.static('public'));
const YOUR_DOMAIN = 'http://localhost:4242';
app.post('/create-checkout-session', async (req, res) => {
const session = await stripe.checkout.sessions.create({
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: 'price_1MincuKkGpyFNMs8Is0Q4JIF',
quantity: 1,
},
],
mode: 'payment',
success_url: `${YOUR_DOMAIN}/success.html`,
cancel_url: `${YOUR_DOMAIN}/cancel.html`,
});
res.redirect(303, session.url);
});
app.listen(4242, () => console.log('Running on port 4242'));```
I mean you're just pasting code again (and now leaked your API key and you need to roll it asap)
I'm sorry, I want to help you but I am a developer, I'm talking to you as a developer yourself. I'm expecting you to understand the code you copy-pasted and add clear logs to it to figure out waht is happening and where it's failing. You control the client and the server, you can narrow down which step is failing