简体   繁体   English

Stripe later payment direct fee, create token error, The customer must have an active payment source attached

[英]Stripe later payment direct charges, create token error, The customer must have an active payment source attached

I am trying to make a Stripe later payment direct charge on a connected account in Node.js.我正在尝试对 Node.js 中的连接帐户进行 Stripe 稍后付款直接收费。 This is all in test mode using the paymentMethods API.这一切都在使用 paymentMethods API 的测试模式下。

I create a customer and attach a payment method with stripe.setupIntents.create() and am able to make later payments to my stripe account/the platform without any issues.我创建了一个客户并使用 stripe.setupIntents.create() 附加了一种付款方式,并且能够在以后向我的 Stripe 帐户/平台付款而没有任何问题。 However I would like to make a direct payment to a connected account using stripe.paymentIntents.create().但是,我想使用 stripe.paymentIntents.create() 直接向连接的帐户付款。

Following this guide, https://stripe.com/docs/connect/cloning-saved-payment-methods , I am under the impression I can clone a payment method used for my platform and use it to make a direct payment for a connected account.遵循本指南https://stripe.com/docs/connect/cloning-saved-payment-methods ,我的印象是我可以克隆用于我的平台的付款方式,并使用它直接支付连接帐户。 I attempt to create a token for the customer but receive the error "The customer must have an active payment source attached."我尝试为客户创建令牌,但收到错误消息“客户必须附加有效的付款来源”。 despite the customer having an active default payment method that works for my platform, 'pm_1HFjvsLIOnOaY98HTxPugN5i'.尽管客户拥有适用于我的平台的有效默认付款方式“pm_1HFjvsLIOnOaY98HTxPugN5i”。

const token = await stripe.tokens.create({customer: 'cus_HpOf9y6TJ5XYlA'}, { stripeAccount: 'acct_1HDuHbBwYBNGN1ir'}

I am further confused by this guide https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods , is this just an alternative method to accomplish essentially the same thing?我对本指南https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods感到更加困惑,这只是完成基本相同事情的另一种方法吗? Or do I need to create a new payment method onto the connected account, but wouldn't that defeat the purpose of creating a token?或者我是否需要在已连接的帐户上创建新的付款方式,但这不会违背创建令牌的目的吗?

Great question, In the API call you shared, you're passing only the customer parameter.很好的问题,在您共享的 API 调用中,您只传递了customer参数。 Cloning a Payment Method requires passing both customer and payment_method like so:克隆支付方式需要同时传递customerpayment_method ,如下所示:

const paymentMethod = await stripe.paymentMethods.create({
  customer: 'cus_HpOf9y6TJ5XYlA',
  payment_method: 'pm_1HFjvsLIOnOaY98HTxPugN5i',
}, {
  stripeAccount: 'acct_1HDuHbBwYBNGN1ir',
});

With Payment Methods there's no concept of a "default source" for a customer—When creating a charge or sharing a payment method you must always specify both the customer ID and payment method ID.使用付款方式时,客户没有“默认来源”的概念 - 创建费用或共享付款方式时,您必须始终指定客户 ID 和付款方式 ID。 The exception to this is Subscriptions, which will look at the invoice_settings.default_payment_method property on the customer and use that for subscription and invoice payments.例外情况是订阅,它将查看客户的invoice_settings.default_payment_method属性并将其用于订阅和发票付款。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Stripe 从基于代币的费用迁移到基于支付意图的费用 - Stripe migrating from token based to payment intent based charges 无法向没有活动卡的客户收费 - Stripe Payment - Cannot charge a customer that has no active card - Stripe Payment 向 Stripe 提交付款请求时出现“无此类令牌”错误 - 'No such token' error upon submitting payment request to Stripe Stripe 检索客户的付款历史记录 - Stripe retrieve payment history of a customer 节点条纹支付网关创建支付意图错误 - Node Stripe Payment Gateway Create Payment Intent Error React Stripe付款创建客户和订单/送货地址等 - React Stripe Payment Create Customer and Order / Shipping Address etc 在angularJS / NodeJS中使用条带支付方法Stripe.charges.create({})时,“未捕获的TypeError:无法读取未定义的属性'create'” - “Uncaught TypeError: Cannot read property 'create' of undefined” while using stripe payment method Stripe.charges.create({}) in angularJS/NodeJS 将客户详细信息附加到 Stripe Payment Intent - Attach customer details to Stripe Payment Intent 条纹:必须提供来源或客户 - Stripe: Must provide source or customer StripeCardError:无法向没有活动卡的客户收费。 尝试使用 Stripe 付款 - StripeCardError: Cannot charge a customer that has no active card. Trying to make a payment using Stripe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM