stripity-stripe icon indicating copy to clipboard operation
stripity-stripe copied to clipboard

Retrieve a balance in behalf of another connected account

Open pozhega opened this issue 6 years ago • 1 comments

Hi,

I use stripity_stripe 2.2.1 to build some sort of money marketplace. One user can send certain amount to another one (charge to customer, and money transfer from platform account to connected account). At one point before payout, I need to see actual balance of the connected account. Your function, doesn't allow sending modified headers needed for this request to work out like it's specified in stripe documentation. If I don't specify the Stripe-Account header I'll always get current balance for platform account.

Same problem appears with some other requests when you need to introduce yourself as connected account, and make eg. transfer to connected account.

For mine purpose I derived a helper function from your Request module to help me solve the issue. But the question stays the same, how many other functions need this tweak and how can you solve it? I'm interested in creating a pull request but currently I'm stacked.

alias Stripe.Request

defp retrieve_balance(id) do
  []
  |> Request.new_request(%{"Stripe-Account" => id})
  |> Request.put_endpoint("balance")
  |> Request.put_method(:get)
  |> Request.make_request()
end

pozhega avatar Dec 12 '18 16:12 pozhega

@pozhega I just created a PR to add this to the documentation, but you should be able to do

Stripe.Balance.retrieve(connect_account: id)

dnsbty avatar Jan 17 '19 18:01 dnsbty

This issue has been automatically marked as "stale:discard". If this issue still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment.

github-actions[bot] avatar Oct 26 '23 01:10 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!

github-actions[bot] avatar Nov 10 '23 02:11 github-actions[bot]