Stripe create token error `The customer must have an active payment source attached`

眉间皱痕 提交于 2020-04-18 06:11:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!