#anup_66
1 messages · Page 1 of 1 (latest)
Hi there, did you pass a token in as a source in this line of code?
stripe.paymentIntents.create({
** source:req.body.tokenId,**
Sir is it possible for you to join a gmeet i can show you the full code
I can only support through chats
ok i am sending the code
import axios from "axios";
const BASE_URL ="http://localhost:5000/api/"
const TOKEN ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzNzZhMTMwYjAxOTIzYzE5ZTA3YTZhMyIsImlzQWRtaW4iOnRydWUsImlhdCI6MTY2ODg1NTQ1NSwiZXhwIjoxNjY5MTE0NjU1fQ.CeQsUB2d3XtJSh4r0VW9m9l7wAPjAtHch7svqlMFJ7I";
// const user = JSON.parse(localStorage.getItem("persist:root"))?.user;
// const currentUser = user && JSON.parse(user).currentUser;
// const TOKEN = currentUser?.accessToken;
export const publicRequest = axios.create({
baseURL: BASE_URL,
});
export const userRequest = axios.create({
baseURL: BASE_URL,
header: { token: Bearer ${TOKEN} },
});
const router = require("express").Router();
const stripe = require('stripe')('sk_test_***');
// const stripe = require('stripe')('STRIPE_SECRET_KEY_MY');
// const Stripe = require('stripe');
// const stripe = Stripe('sk_test_***')
// const KEY = "sk_test_***"
// const stripe = require("stripe")(KEY);
// const KEY = process.env.STRIPE_SECRET_KEY_MY
// const stripe = require("stripe")(KEY);
router.post("/payment", (req, res) => {
stripe.paymentIntents.create(
{
source: req.body.tokenId,
amount: req.body.amount,
currency: "usd",
},
(stripeErr, stripeRes) => {
if (stripeErr) {
// console.log(KEY);
res.status(500).json(stripeErr);
} else {
res.status(200).json(stripeRes);
}
}
);
});
module.exports = router;
sir are you seeing..>
i going through this tutorial
E-commerce app from scratch. MERN Stack e-commerce project for beginners. React, Node.js Full-Stack shopping app course using Redux, Stripe, and JWT. React shopping cart tutorial.
You are watching the 3rd part.
Watch part 1 (React Design): https://youtu.be/c1xTDSIXit8
Watch part 2 (Node.js API): https://youtu.be/rMiRZ1iRC0A
Watch React admin da...
01:20 hr at this length
Is req.body.tokenId a token or source? can you do a console.log() and print it out?
Hey! Taking over for my colleague. Let me catch up.
Could you please delete your private test key from your previous shared code ?
And can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
You need to hare the requestId req_123 that triggered this error on your side:
the stripe is giving this error: A token may not be passed in as a Source. You can convert your token into a Source using /v1/sources with card[token]=MYTOKEN.
May I ask you why you are using a legacy source API:
https://stripe.com/docs/sources
This is deprecated and you need to migrate to PaymentIntent API:
https://stripe.com/docs/payments/payment-methods/transitioning
Could you please copy past the Id ?
req_bjnNh62XJtMJ5A
https://meet.google.com/ytx-siqd-ywd sir please can you join it will be great for me sir please
ok sir no issues.
sir i think i am writing the wrong code. Can you correct
E-commerce app from scratch. MERN Stack e-commerce project for beginners. React, Node.js Full-Stack shopping app course using Redux, Stripe, and JWT. React shopping cart tutorial.
You are watching the 3rd part.
Watch part 1 (React Design): https://youtu.be/c1xTDSIXit8
Watch part 2 (Node.js API): https://youtu.be/rMiRZ1iRC0A
Watch React admin da...
Sir can you see this at 1.20hr
It looks like this video is using a legacy API (source APIs)
Regarding your issue
you need to create a source from the generated token:
https://stripe.com/docs/api/sources/create#create_source-token
A token may not be passed in as a Source. You can convert your token into a Source using /v1/sources with card[token]=tok_1M6VrmSGXwg0GuHLJ7klR7gp.
Something like this
then you pass it to the PaymentIntent API
but again this API is a deprecated and you need to migrate to the new PaymentMethod APIs:
https://stripe.com/docs/payments/payment-methods/transitioning
How to implement that.
You can start by following this sample guide, in order to understand the new APIs
https://stripe.com/docs/payments/quickstart?lang=node
Feel free to choose the programming languages that you want
thank you for helping sir
Np!
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
sir i am now getting this data in console
E-commerce app from scratch. MERN Stack e-commerce project for beginners. React, Node.js Full-Stack shopping app course using Redux, Stripe, and JWT. React shopping cart tutorial.
You are watching the 3rd part.
Watch part 1 (React Design): https://youtu.be/c1xTDSIXit8
Watch part 2 (Node.js API): https://youtu.be/rMiRZ1iRC0A
Watch React admin da...
as in this video is done
at 1.20 hr
Ok, what's the question?
sir could please watch the video at 1:20 to 1:22
Can you summarise the issue please?
i am not get the data of orders which stripe is providing
I wouldn't recommend following this video/tutorial. It's using deprecated, old code
What success page? What code are you calling? Is there an error? What's happening instead?