#Farhaan-Token

1 messages · Page 1 of 1 (latest)

sacred laurel
kindred oar
#

Actually we are not using tokens for payment. We are using it to create customers on platform account using default card.

curl --location --request POST 'https://api.stripe.com/v1/customers'
--header 'Authorization: Basic c2tfdGVzdF81MUc2Ukk4QWxudTdtVlNXbFF0YkVzMDJHRGxFMkNYdG9yV3A3MkJvcE51T2RsdG83NU9XZzRURFAyZ0NzWUN5M0UwODl5MXptWW80bTFkbG9YeDg1eWtHSDAwa1JQcHoxWVE6'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'email=MasterCard@yopmail.com'
--data-urlencode 'source=tok_1LItgsAlnu7mVSWlvVI67wsR'
--data-urlencode 'name=MasterCard'

#

So here, you see that I need token in source. So I am trying to create the token for this thing. So shall I create a token in react using stripe.createToken(), take that token and pass it to node, to stripe.tokens.create()?

sacred laurel
#

You can just pass the token created from frontend to source here, you don't need to call stripe.tokens.create() in the backend.

#

btw, you should remove the Authroization header in chat, discord is a public place so everyone can see

kindred oar
#

If I pass the token created from front-end, I get this error.

"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such token: 'tok_1LRsXRPJQbmTO8cWGTKwzu1G'",
"param": "source",
"type": "invalid_request_error"
}

Learn more about error codes and how to resolve them.

#

Hence I am confused thinking that there's something wrong with my token

sacred laurel
kindred oar
#

I actually didnt get the request ID, I just got this error in postman.

{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such token: 'tok_1LRsXRPJQbmTO8cWGTKwzu1G'",
"param": "source",
"type": "invalid_request_error"
}
}

Learn more about error codes and how to resolve them.

sacred laurel
#

You can find the request ID from Stripe Dashboard, please check the link that I sent earlier.

kindred oar
#

req_bVTdfWGlBVvgBw

sacred laurel
#

Thanks. From my end I can see that the token was created in a different account, that's why it cannot be found

#

Can you double if you are using the correct publishable key / secret key pair in your integration?

kindred oar
#

cool, thanks, I got the issue

#

Actually while creating token, I am passing cardNumberElement, in which I am also passing cardNumberElement._controller._stripeAccount

#

Is there anyway so I can remove this?

sacred laurel
#

Why are you passing the stripeAccount ?

#

Did you specify the stripeAccount when initializing Stripe.js ?

kindred oar
#

yeah that's the issue. I think I will change it. Yes I did so. Maybe I shouldn't do that

sacred laurel