Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to query a Stripe managed account's balance?

I've gone through the docs and haven't been able to spot a way to query balance info for Stripe managed accounts. Here's the use case: a 3rd party sets up a managed account through my Stripe Connect enabled platform; I create some charge objects on their account after a few customers buy goods/services (so their balance is now positive); now they want a payout BUT I want to query their balance before issuing the transfer to ensure they're not asking for more than is in their account.

Surely I'm missing something obvious. Thanks in advance.

like image 1000
maxhs Avatar asked Sep 18 '15 15:09

maxhs


2 Answers

So for Ruby, based on Ywain's answer, I figured that instead of doing what's documented:

Stripe.api_key = CONNECTED_STRIPE_ACCOUNT_SK
Stripe::Balance.retrieve

a better way, that is not documented, is to do:

Stripe::Balance.retrieve(stripe_account: CONNECTED_STRIPE_ACCOUNT_ID)

as long as the current api_key is your platform account with the managed accounts option enabled.

like image 129
pierrea Avatar answered Oct 13 '22 07:10

pierrea


PHP

\Stripe\Balance::retrieve([
    'stripe_account' => CONNECTED_STRIPE_ACCOUNT_ID
]);

Python

stripe.Balance.retrieve(
  stripe_account=CONNECTED_STRIPE_ACCOUNT_ID
)

Ruby

Stripe::Balance.retrieve(
  :stripe_account => CONNECTED_STRIPE_ACCOUNT_ID
)

Node

stripe.balance.retrieve({
  stripe_account: CONNECTED_STRIPE_ACCOUNT_ID
}, function(err, charge) {});
like image 32
Rob Avatar answered Oct 13 '22 07:10

Rob