#kaustuva-source
1 messages · Page 1 of 1 (latest)
Hi there, you can get the sources from the connected accounts, just make sure that you are passing the correct customer ID and stripAccount in the API call.
So the API call above would work?
The documentation doesn't say if we're allowed to pass the account id
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Adding a stripeAccount header allows you to make API calls to connected account, also see https://stripe.com/docs/connect/authentication
Hi.
https://dashboard.stripe.com/test/logs/req_gNMOJrbjhdTM2N
Here it says no such customer but there's a link to the customer in the dashboard itself. How does that happen?
I mean the customer does exist
Does this customer live in this connected account or platform account?
Connect account
can you share with me the customer ID and the connected account ID?
thanks, and can you give me the request ID as well?
req_gNMOJrbjhdTM2N
Are you making the request with your platform secret key or connect account's secret key?
It seems like you are using the connect account's secret key, can you double check and make sure you are using the platform account's key?
I'm using the platform account key
just checked
The request was on the connect account
@ionic wadi that's the problem
for that call you want the Customer on the platform account. That param is for the customer whom you are copying the Source from (so the one on the platform).
I want to attach the source to the customer in platform and then attach the clone of the source to the customer in the connect
yep I know
so from our thread yesterday, you are on step 3, which is cloning the Source from the platform the connected account
and for that you make that API call from the request IDs you shared, using the ID of the Customer on the platform account. That will give you a Source on the connected account, and then you can separately attach that Source to a new Customer on the connected account in a new API call.
// Create source on platform
await stripe.customers.createSource(stripe_platform_id, { source: source_id });
// Create source on connect
await stripe.sources.create({
customer: stripe_connect_id,//this_must_change?
usage: 'reusable',
original_source: source_id,
}, {
stripeAccount: stripe_connect_account_id,
});
instead, for the source on connect, I'll use the platform_id for the customer ID, but the connect_account for stripe id.
Then In another step I'll have to attach it to the customer on connect?
I don't know what your variables are so it's hard for me to tell you
stripe_connect_id should the Customer ID on the platform that the original_source is currently attached to
stripe_connect_account_id is the ID acct_xxx of the connected account
so I guess yes, stripe_platform_id is your platform Customer
So this is what I'm trying to do:
- Check if the source is present on platfrom customer by listing the sources
- If source is present don't attach
- Check if any clones of the source are attached the customer on connect account
- If not present, clone source and attach to customer on connect acct
- If present, don't attach, proceed with charge creation on connect account.
How would I check point 3?
Why I need to do this....some customers already have sources attached to their platform accounts....but not on their connect account. Post cloning, we'll have users who have the clone already attached on their platform account, so we don't want to reclone the original source and attach again.
personally the way I would build this would be to not save cards on the connected account at all — I would keep the platform as the 'master' customer where all the cards live and are maintained, and just clone the card and charge it ad-hoc when a payment is needed on the connected account. Because yes, it gets incredibly complicated to keep things in sync across the platform and N connected accounts.