问题
I'm trying to clone the customers stored payment information and use in the connected account by creating a token like this:
exports.createToken = functions.https.onRequest(async (req, res) => {
var customerId = req.body.customer_id
var accountId = req.body.account_id
console.log(req.id)
stripe.tokens.create(
{ customer: customerId },
{ stripeAccount: accountId }, // id of the connected account
function(err, token) {
// callback
console.log("token:", token)
console.log("error:", err)
}
);
})
But I keep getting this error Error: The customer must have an active payment source attached.
but if I navigate to the customer's section with the stripe dashboard it shows that the customer has 1 card added under the Cards section. Do I need to link the customer's account to the connected account? I'm using the IOS SDK to save the card details after following this documentation. I should note that both the Customer Id
and the Account Id
are valid and return server side. I don't understand why I can't create a token and then charge the connected accounts card stored in the Customers tab.
来源:https://stackoverflow.com/questions/61244065/stripe-create-token-error-the-customer-must-have-an-active-payment-source-attac