Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 639
M4trix Dev Avatar asked Nov 11 '19 23:11

M4trix Dev


People also ask

Does Stripe charge a fee for connected accounts?

$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.

How do you get a payment intent in Stripe?

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.

What is Stripe connected account?

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.


1 Answers

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

like image 100
M4trix Dev Avatar answered Oct 10 '22 11:10

M4trix Dev