#quisk-api

1 messages ยท Page 1 of 1 (latest)

split fossil
#

hi! can you share exactly the code you're using and other context?

gilded jetty
#

one second pls, my character are capped because I don't have nitro. I'll link it.

#

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

split fossil
#

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.

gilded jetty
#

so it should be intent with an s, like so: const paymentIntent = await stripe.paymentIntents.create

#

I still get the error.

split fossil
#

make sure you save the file and restart the server process

gilded jetty
#

I did, saved the file and re-started the server.

cyan vigil
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

gilded jetty
#

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.

cyan vigil
#

could you please share your code snippet?

gilded jetty
#

I added the s to paymentIntent

cyan vigil
#

ok are you still having the same issue?

gilded jetty
#

yes unfortunately, can't seem to solve it.

cyan vigil
#

what version of the stripe-node are you using?

gilded jetty
#

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

cyan vigil
#

I think you installed the wrong package

gilded jetty
#

it says that I'm missing required param currency, but I've added it.

cyan vigil
#

could you please share your package.json?

#

Oh so now it's another issue

#

I thought you're still getting the same error

gilded jetty
#

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"
}
}

cyan vigil
#

ok, so first thing we're now on version 10.1.0

#

so you might want to update your dependencies

gilded jetty
#

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

cyan vigil
#

could you please share the request id?

gilded jetty
#

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

cyan vigil
#

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

gilded jetty
#

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}'

cyan vigil
#

you need to escape the " in your curl something like {\"paymentMethodType\"...}'

gilded jetty
#

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*

cyan vigil
#

you'd have to escape all of the "

gilded jetty
#

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.

cyan vigil
#

no no

#

instead of using curl

#

could you just use something like Postman?

#

it would be a real upgrade I promise

gilded jetty
#

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.

lament geyser
#

Hello ๐Ÿ‘‹
Taking over as @cyan vigil needs to step away soon

gilded jetty
#

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.

lament geyser
#

doesn't look like its from Stripe's API though

gilded jetty
#

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}'

split fossil
#

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

gilded jetty
#

yeah, well I'm getting the client secret so you're right I guess.

split fossil
#

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?

gilded jetty
#

Yes that is correct. Do you recommend I move to Linux when working with stripe, or is windows fine?

split fossil
#

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