alia
alia

Reputation: 300

How to get payout data in Stripe Connect?

I'm adding Stripe Connect to my app to send payments to the users,I need to create a payment dashboard where each user can see all the payments that were sent to them( like payment history). I've read here https://stripe.com/docs/api/payouts/create that I can retrieve list of all payouts or individual payout(by submitting payout id), but I can't find information on how to get payout data per user. For example, if I have user John Doe, I want to get all the payout information for John only with 1 API call, is it possible in Stripe Connect?

Upvotes: 4

Views: 1364

Answers (3)

Bello Damilola
Bello Damilola

Reputation: 341

You can get payout data for a stripe connect account using:

const stripe = require('stripe')('API_KEY');

const payouts = await stripe.payouts.list({
  limit: 10,
}, { stripeAccount: 'Connect Account Id' });

Upvotes: 0

alex
alex

Reputation: 2774

If you want to retrieve the list of payments on the connected account, you should retrieve the list of Charges using the stripeAccount header.

You can also make use of the auto-pagination built into Stripe SDKs to loop through the list.

Example

for await (const charge of stripe.charges.list({stripeAccount: 'connected_account_id'})) {
    // Do something with charge
    console.log(charge);
  }

You may want to reach out to Stripe to check if you're eligible to use this beta where you can embed a payments dashboard component into your site : https://stripe.com/docs/connect/get-started-connect-embedded-uis

Upvotes: 0

Quintoche
Quintoche

Reputation: 50

If I understand goodly your question, you want to retrieve connected accounts' payouts.

You have to know that payout api using is when you move money on your account. In the other hand, if you want to move money to any connected account you need to use transfert api.

Code

You need to know user connect account

const stripe = require('stripe')('API_KEY');

const transfers = await stripe.transfers.list({
  destination: 'acct_id.....',
});

Upvotes: -1

Related Questions