You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm not sure if this is a "stipe-expo" issue but I suspect it might be because it relates to a token I'm trying to generate using this library. So forgive me if not ;)
I'm getting the error: Invalid token ID when creating a paymentIntent through the official "stripe" node.js library on my back end.
I can process a simple payment where my platform charges a customer card token. This works fine:
stripe.paymentIntents
.create({
amount: 100,
confirm: true,
currency: "gbp",
description: "payment",
payment_method_types: ["card"],
payment_method_data: {
type: "card",
card: {
token: customerCard.id, // token generated on the client side (see below for code)
},
},
})
If I amend my code as per the guide so that I'm trying to generate the card token on the connect account (rather than my platform stripe account), and then create the paymentIntent to create the charge on the connect account:
stripe.paymentIntents
.create({
amount: 1000,
application_fee_amount: 100, // trying to take a fee now
confirm: true,
currency: "gbp",
description: "payment",
payment_method_types: ["card"],
payment_method_data: {
type: "card",
card: {
token: customerCard.id, // token generated using the connect account id (see below for code)
},
},
}, { stripeAccount: "{{ ACTUAL_CONNECT_ACCOUNT_ID_IS_HERE }}"}) // so that we're creating the charge on the connect account
The call fails (in my try catch) with "Error: Invalid token Id: tok_abc..."
Here's how I'm generating the token:
import createStripe from "stripe-client"; // https://github.com/expo/stripe-expo
...
// init a new instance of stripe client passing the ID of the connected account to create the token on that account
const stripeClient = createStripe(
"pk_test_5...gKi",
{ stripeAccount: "{ ACTUAL_CONNECT_ACCOUNT_ID_IS_HERE }" }
);
return stripeClient.createToken({ card });
I am getting what looks to be a valid token before passing it to the back end so I'm really stuck as to the reason the token is invalid.
Can someone please help?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi, I'm not sure if this is a "stipe-expo" issue but I suspect it might be because it relates to a token I'm trying to generate using this library. So forgive me if not ;)
I'm getting the error: Invalid token ID when creating a
paymentIntent
through the official "stripe" node.js library on my back end.I can process a simple payment where my platform charges a customer card token. This works fine:
But now I want to move away from a 'simple' charge to a 'direct' charge flow using Stripe Connect, as per this guide: https://stripe.com/docs/connect/direct-charges
If I amend my code as per the guide so that I'm trying to generate the card token on the connect account (rather than my platform stripe account), and then create the paymentIntent to create the charge on the connect account:
The call fails (in my try catch) with "Error: Invalid token Id: tok_abc..."
Here's how I'm generating the token:
I am getting what looks to be a valid token before passing it to the back end so I'm really stuck as to the reason the token is invalid.
Can someone please help?
Thanks!
The text was updated successfully, but these errors were encountered: