#anup_66

1 messages · Page 1 of 1 (latest)

stray plumeBOT
azure widget
#

Hi there, did you pass a token in as a source in this line of code?
stripe.paymentIntents.create({
** source:req.body.tokenId,**

autumn spade
#

Sir is it possible for you to join a gmeet i can show you the full code

azure widget
#

I can only support through chats

autumn spade
#

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...

▶ Play video
#

01:20 hr at this length

azure widget
#

Is req.body.tokenId a token or source? can you do a console.log() and print it out?

autumn spade
#

it is the token

true trout
#

Hey! Taking over for my colleague. Let me catch up.

#

Could you please delete your private test key from your previous shared code ?

autumn spade
true trout
#

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.
autumn spade
true trout
true trout
autumn spade
#

req_bjnNh62XJtMJ5A

#

https://meet.google.com/ytx-siqd-ywd sir please can you join it will be great for me sir please

true trout
#

Nope I can't do one-to-one call

#

Sorry

#

let me check your requestId

autumn spade
#

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...

▶ Play video
#

Sir can you see this at 1.20hr

true trout
#

It looks like this video is using a legacy API (source APIs)

#

Regarding your issue

#

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

autumn spade
#

How to implement that.

true trout
#

Feel free to choose the programming languages that you want

autumn spade
#

thank you for helping sir

true trout
#

Np!

calm glade
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

autumn spade
#

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...

▶ Play video
#

as in this video is done

#

at 1.20 hr

calm glade
#

Ok, what's the question?

autumn spade
#

sir could please watch the video at 1:20 to 1:22

calm glade
#

Can you summarise the issue please?

autumn spade
autumn spade
calm glade
#

I wouldn't recommend following this video/tutorial. It's using deprecated, old code

autumn spade
#

sir can you see the sreensort

#

i am not get the success page

calm glade
#

What success page? What code are you calling? Is there an error? What's happening instead?

autumn spade
#

thanksss.....

#

i resolved the issue