#mathiasm8
1 messages ยท Page 1 of 1 (latest)
If you're creating Invoices directly on your connected accounts (using the Stripe-Account header) then unfortunately there isn't really a great way to search across all invoices easily through the API.
I'm not sure if I'm creating invoices directly on my connected account. I don't think so. When browsing the Stripe dashboard and selected the connect pane. I have one customer (my connected account) If I open that account, then it has multiple customers. Each of those have subscriptions and invoices related to my connected account.
Do you have an example invoice I can take a look at? I can double check it and tell you if it's on the connected account or not
It'd be better if you could send over the Invoice ID - should looking somethign like in_123
Ahh here you go: in_1Ne2UPQWLKN1dqImXZdliFpH
Yeah it looks like that invoice is directly on the connected account, not on the platform
Okay, is that the wrong way to do it. I use Stripe session checkout when signing up for a subscription and I thought I needed to use the Stripe account header to bind that user to my connected account?
Or let me ask in another way. How would I be able to show a users invoices? A user on my platform is a user to a connected account.
So backing up here a bit - it looks like currently you'r using custom connect accounts. Typically with custom connect accounts you'd want to use destination charges (where the request are still being made on the platform, but you can transfer some portion of the funds to the connected account)
With destination charges you're also able to set the connected account as the merchant of record if you need to by setting on_behalf_of
Yes I'm using custom connected accounts. By following the guide an using the on_behalf_of, would it then be possible for an end-user on my platform to see all his/hers invoices across possible multiple connected accounts, if they are a customer of more than one connected account?
Yup! Since all the invoicecs would be on the platform account it would work
Okay. One final question (i think) ๐ what API endpoint should I then call? This returns no users: const customer = await stripe.customers.search({
query: 'email:''+userdata.email+''',
});
Oh and the on_belhalf_of value, should that be the account_id?
Oh and the on_belhalf_of value, should that be the account_id?
Yup!
For the Search API issue - what specifically are you trying to do? Are you just trying to get all customers matching a specific email?
I need to head out, but codename_duchess should be able to answer any followups you have
Thanks for the help so far. The endgoal is to fetch all invoices for a specific customer. That specific customer can be customer to more than one connected account.
Hello taking over here
You want to fetch all invoices across several connect accounts from a specific email?
Yes ๐
Or actually connected accounts customers ๐
Let me explain my platform short.
I'm building a SaaS platform where gym owners can create a gyms (connected accounts) and those gyms can have members. When a member signs in to my platform, they should be able to see their invoices across all gyms they might be a member of.
You should just be able to call this endpoint: https://stripe.com/docs/api/invoices/list#list_invoices-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you're using destination charges all the invoices will live on the platform
And I'm using destination charges if I use the on_behalf_of?
Or should I use the:
transfer_data: {
destination: '{{CONNECTED_ACCOUNT_ID}}',
},
I'm actually not sure about the difference
Ahh I should set both of them
And this would also work for stripe.checkout.sessions.create with subscriptions?
If you're using custom accounts, you should do destination charges
Please read https://stripe.com/docs/connect/destination-charges to understand what you're building first though
Yes it works for that too
Great I think I finally got it. One last thing, if I set application fees on a subscription. That would work for all future billings as well, right?
Yeah
Great, thanks for sublime support!