Stripe Ruby API: How to fetch the Connect Gross Volume - stripe-payments

In my Stripe Dashboard there's "Connect gross volume" that lists the volume that has gone through all Stripe Connect accounts associated with my account. I would like to fetch this volume through the API, but cannot find a way to do so.
I've tried listing all reporting types but none seem to match (also accessible here https://stripe.com/docs/reports/report-types):
Stripe::Reporting::ReportType.list()
Is there another way to access it?

You can try running the Balance Report for each of Connected Account then combine the results, or easier, call List PaymentIntent API, using Stripe Account header then combine the results.

Related

Stripe Connect - Multiple accounts

I am collecting a payment using Stripe, and want to keep a portion, and send the rest onto another account from another organisation.
Stripe have told me that I have to connect an account. I have done this, Stripe gives me a link which the other organisation pastes into their browser, and all works. I can create a transfer linked to a payment intent.
But, when the link is pasted into the other organistions browser, this message is shown.
______ will be able to see your account data (such as all payment and payout history), including any data created by other business you've connected. They'll also be able to create new payments and take other actions for you.
This seems crazy - I just want to pay them some money, not ask them for full access.
Am I missing a trick?
Stripe Connect is a product/tool that allows accounts to work together to provide goods and services to end customers. There are a few different approaches to how this is configured based on your use case as well as whether you would be acting as the Platform (the one in control) or the Connect Account.
You should review the different Connect Account Types and determine what best matches your use case. Some questions to consider are as follows:
Who is interfacing with the end-customer (you or the other account)?
Who is providing the product/service?
Is this other account providing a service to you in exchange for a cut of the revenue?
On what account should the transactions and customers be stored?
It sounds like, based on the warning message, you were creating the other account to be the Platform and you would be Connect Account. In that cases the other account could make API calls on your behalf using your account token. This would be normal if the other account is providing a service to you like funneling customers to you in some way. A good way to quickly review what approach makes the most sense for your use case is to review the Funds Flow diagrams for the different types of Charges
Direct Charges
Destination Charges
Separate Charges and Transfers

When receiving a `payout.created` Stripe webhook, what is the easiest way to determine which Stripe Connect Custom account it is for?

(Stripe api version: 2020-08-27)
I am working on setting up Stripe to create payouts automatically each week to our Stripe Connect accounts with earnings.
I want my own api to listen for the payout.created Stripe webhook, so I can record and track the event data in my local database. However, I don't see any easy way to tell which Stripe Connect account the newly created payout is for, by looking at the object's properties (API reference).
I was going to try and make the determination by looking at the $payout->destination property, which would give me the bank account the payout was for. I could then retrieve that bank account and see which user it relates to. However, in order to retrieve a bank account, I have to already know the customer id, and I don't have that info. I'm not even dealing with a customer here, I'm dealing with a service provider that has earnings that we need to pay. The bank account is not the same thing as the stripe connect account.
How do I deal with this? Seems weird that it would be so difficult to figure out who the payout is for.

Stripe Charges API - How to make test destination charge without Connect?

Two parts to this question:
I only see docs about making Destination Charges when you're using Stripe Connect and Custom Accounts. Is it possible to do it without Connect?
If it's possible to make a destination charge with just regular (Standard?) Stripe Accounts, am I able to test it out without needing two accounts that are live?
Thanks in advance!
Destination Charges are charges made by a Connect Platform on behalf of a connected account (whether that connected account is a Standard, Express, or Custom account). There is no reason to make a Destination Charge without Connect (and indeed, no way that you could).

Best way to split a Stripe charge across two bank accounts?

So when I run a charge, I'd like to be able to have 15% go to a secondary bank account of mine. What's the preferred way to do this now?
I found a great article on exactly this, using recipients and transfers (https://unicornfree.com/2013/using-stripe-to-divvy-up-revenue), but that's been deprecated and replaced with Managed Accounts. But those docs don't offer a clear way to do what I need.
Anyone seen a working example out there?
It sounds like you're trying to setup a "marketplace" type scenario, in which you would use the Stripe Connect platform and have the application_fee parameter in your request which to collect your 15%.
In that scenario, you create a charge request for $100 from customer A, you can specify an application_fee of 1500 (stripe requires the value in cents) in the API call. Documentation on this can be found here.
The result is that the $85 goes to your recipient, and $15 goes into your personal stripe account, and can be transferred to the bank account of your choosing. On hidden "gotcha" to this is that the stripe processing fee will be taken out of your application fee that you charge, so you won't be getting a true 15% from the transaction.
Note, you will need to have a connected or managed account registered through your connect account in order to properly setup the transaction. A general overview on the pros/cons of connected vs managed can be found here.

How to check if customer is subscribed using curl and Stripe

In Stripe, to get the list of customers who are subscribed using the curl API offered by the online payment system Stripe, one only needs to call:
curl https://api.stripe.com/v1/customers -u sk_test_key:
This returns a list of customers in JSON format. You can run the code yourself as it uses the test data from Stripe.
What if I only want to check if a given customer is subscribed? for example customer ID cus_5uR2Kp7ukpBSBc
First, it's probably not a great idea to put your test keys on SE. It can't be escalated to full control over your account, but anybody could come by and delete all your test customers for giggles (for example). You should probably roll your test keys at this point.
To your actual question, to find any active subscriptions on that customer, you can look at the subscriptions property on the customer response (https://stripe.com/docs/api#customer_object). If you're only interested in the subscriptions, and not the rest of the customer, you can use the list subscriptions endpoint (https://stripe.com/docs/api#list_subscriptions).
Either of these will list all subscriptions on the account, so if you're looking for a subscription to a particular plan, you'll need to iterate through and search for that plan id.

Resources