I would like to create a Stripe PaymentIntent with a direct charge to a connected account
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....
EDIT: The code is correct and I found out that the issue is with Stripe because they requires some sort of further authentication. From Stripe documentation
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....
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.
I will work on it and see how to do it
$2 per active user per month An account is active in any month payouts are sent to their bank account or debit card. $2 per active user per month An account is active in any month payouts are sent to their bank account or debit card. Available when using Connect Onboarding.
Passing the client secret to the client side confirmCardPayment or stripe. handleCardAction) to complete the payment. To use the client secret, you must obtain it from the PaymentIntent on your server and pass it to the client side. You can use different approaches to get the client secret to the client side.
When using Connect, you must create an account (known as a connected account) for each user that receives money on your platform. You create these accounts every time a user signs up for your platform.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With