#quisk-api
1 messages ยท Page 1 of 1 (latest)
one second pls, my character are capped because I don't have nitro. I'll link it.
Ok this is my server code https://ctxt.io/2/AADgi7I_FQ
and this is the command I input into the terminal: curl -X POST http://localhost:4242/create-payment-intent -H "Content-Type": application/json" -d '{"paymentType":"card", "currency":"usd"}'
sorry this is the command I input, gets the same error: curl -X POST http://localhost:4242/create-payment-intent -H "Content-Type": application/json" -d '{"paymentMethodType":"card", "currency":"usd"}'
{"error":{"message":"Cannot read properties of undefined (reading 'create')"}}curl: (3) URL using bad/illegal format or missing URL
it should be stripe.paymentIntents.create in the backend code, not stripe.paymentIntent.create , you're missing the s
on that line const paymentIntent = await stripe.paymentIntent.create({ . (should be const paymentIntent = await stripe.paymentIntent.create({
There might be other problems but that's the first thing I notice overall and seems related.
so it should be intent with an s, like so: const paymentIntent = await stripe.paymentIntents.create
I still get the error.
make sure you save the file and restart the server process
I did, saved the file and re-started the server.
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Yes, I'm stuck on trying to follow a tutorial made by stripe for the last couple of days, I keep getting error the person I'm watching isn't getting, and I can't seem to be able to solve them.
could you please share your code snippet?
ok are you still having the same issue?
yes unfortunately, can't seem to solve it.
what version of the stripe-node are you using?
how do I check that, not entirely sure. I just went of by the tutorial.
this is the error I'm getting now.
{"error":{"message":"Missing required param: currency."}}curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
I think you installed the wrong package
it says that I'm missing required param currency, but I've added it.
could you please share your package.json?
Oh so now it's another issue
I thought you're still getting the same error
do you have the 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.
this is my package.json:
{
"name": "stripe-sample-demo",
"version": "1.0.0",
"description": "A Stripe demo",
"main": "server.js",
"scripts": {
"start": "node server.js",
"test": "echo "Error: no test specified" && exit 1"
},
"author": "stripe-demos",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"dotenv": "^16.0.0",
"express": "^4.17.1",
"stripe": "^8.154.0"
}
}
ok, so first thing we're now on version 10.1.0
so you might want to update your dependencies
ok let me send you ss of my logs I think it might be helpful: this is my json.package now.
{
"name": "stripe-sample-demo",
"version": "1.0.0",
"description": "A Stripe demo",
"main": "server.js",
"scripts": {
"start": "node server.js",
"test": "echo "Error: no test specified" && exit 1"
},
"author": "stripe-demos",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"dotenv": "^16.0.0",
"express": "^4.17.1",
"stripe": "^10.1.0"
}
}
ok
could you please share the request id?
I'm getting the client secret now. I fixed the currency issue, this is the full output I get now.
{"clientSecret":"pi_3LVEDnGFwRQBDdF40VlYhFKT_secret_3586dUy3mdJdcRAFsiTGYiDmu"}curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
this is the id: req_hULZu4TSbrUHQQ
I think the problem is in the way you're calling your curl
curl -X POST http://localhost:4242/create-payment-intent -H "Content-Type": application/json" -d '{"paymentMethodType":"card", "currency":"usd"}'
this is wrong
-H 'Content-Type: application/json'
this has to be changed
it's messing everything
ok this is my new command, I get the client secret but what seems to be a smaller error:
curl -X POST http://localhost:4242/create-payment-intent -H "Content-Type: application\json" -d '{"paymentMethodType":"card", "currency":"usd"}'
this is what I get:
{"clientSecret":"pi_3LVEJbGFwRQBDdF40oyyPWH7_secret_FHRGnHnKiQKUD6q2dC3TOuu7D"}curl: (3) unmatched close brace/bracket in URL position 13: currency:usd}'
you need to escape the " in your curl something like {\"paymentMethodType\"...}'
hmm, the video doesn't have that, but event when I add it I get the same error:
curl -X POST http://localhost:4242/create-payment-intent -H "Content-Type: application\json" -d '{\"paymentMethodType\":"card", "currency":"usd"}'
even*
you'd have to escape all of the "
ok let me see, I'm on windows btw, and he's on Linux. I think / on Linux is equiv to \ on windows. Because the video has application/json but I have application\json, if I copy him I'll get an html response instead of a json one.
no no
instead of using curl
could you just use something like Postman?
it would be a real upgrade I promise
ok let me download that.
ok I downloaded it. But I'm not sure how it relates to the tutorials, I'd rather follow their technique since there are other videos.
Hello ๐
Taking over as @cyan vigil needs to step away soon
hi hanzo.
I'm trying to get a json response, I'm now getting that (wasn't getting it previously) but i's accompanied by an error I can't fix.
doesn't look like its from Stripe's API though
this is the command I input:
curl -X POST http://localhost:4242/create-payment-intent -H "Content-Type: application\json" -d '{"paymentMethodType":"card", "currency":"usd"}'
and this is the error I'm getting:
{"clientSecret":"pi_3LVERXGFwRQBDdF4007YtWDR_secret_fVNnGgthRFnxiFciGfDKYYGgA"}curl: (3) unmatched close brace/bracket in URL position 13: currency:usd}'
yeah you can't really use the exact raw curl command in cmd.exe on windows. I don't think it matters really, like your actual code works
yeah, well I'm getting the client secret so you're right I guess.
you're getting the correct response. Isn't the next step to write the frontend code the web page that will be displayed in the browser and call the backend?
Yes that is correct. Do you recommend I move to Linux when working with stripe, or is windows fine?
it's fine, use whatever you as a developer are most comfortable with, it doesn't really make a difference to the code your write or how you call our API