[英]How to make a payment Intent to charge a connected account in Stripe
I would like to create a Stripe PaymentIntent with a direct charge to a connected account我想创建一个 Stripe PaymentIntent,直接向连接的账户收费
Here is what I wrote这是我写的
stripe.paymentIntents.create(
{
amount: 2000,
currency: 'gbp',
payment_method: 'pm_xxxx',
}, {
stripe_account: 'acct_1F2xxxxxxxxxx'
},
function(err, paymentIntent) {
// asynchronously called
// do something here
}
);
What am I doing wrong??我究竟做错了什么??
The following code (without the connected account) works fine以下代码(没有连接的帐户)工作正常
stripe.paymentIntents.create(
{
amount: 2000,
currency: 'gbp',
payment_method: 'pm_xxxx',
},
function(err, paymentIntent) {
// asynchronously called
// do something here
}
);
I suspect that is culprit because the console error says something about PaymentMethod....我怀疑这是罪魁祸首,因为控制台错误说明了 PaymentMethod....
EDIT : The code is correct and I found out that the issue is with Stripe because they requires some sort of further authentication.编辑:代码是正确的,我发现问题出在 Stripe 上,因为它们需要某种进一步的身份验证。 From Stripe documentation
来自 Stripe 文档
If you opt for direct charges, you will need to make sure that the connected account is onboarded on the payment method you intend to use.
如果您选择直接收费,您需要确保连接的帐户已启用您打算使用的付款方式。 Direct charges require creating PaymentMethods on connected accounts....
直接收费需要在关联账户上创建 PaymentMethods....
If you're creating PaymentMethods from the server, you can make use of authentication using the Stripe-Account header with any of our supported libraries.
如果您从服务器创建 PaymentMethods,则可以使用 Stripe-Account header 和我们支持的任何库进行身份验证。
I will work on it and see how to do it我会努力的,看看怎么做
I have found this https://medium.com/flutter-community/build-a-marketplace-in-your-flutter-app-and-accept-payments-using-stripe-and-firebase-72f3f7228625 which describes how to charge a connected account.我发现这个https://medium.com/flutter-community/build-a-marketplace-in-your-flutter-app-and-accept-payments-using-stripe-and-firebase-72f3f7228625描述了如何收费关联帐户。
Basically you need to clone your payment methods in the server and then create your payment intent基本上你需要在服务器中克隆你的支付方式,然后创建你的支付意图
Stripe docs for cloning payment methods: https://stripe.com/docs/connect/cloning-saved-payment-methods用于克隆支付方式的 Stripe 文档: https://stripe.com/docs/connect/cloning-saved-payment-methods
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.