#kaustuva-source

1 messages · Page 1 of 1 (latest)

strong hearth
#

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.

ionic wadi
#

So the API call above would work?

#

The documentation doesn't say if we're allowed to pass the account id

strong hearth
ionic wadi
#

I mean the customer does exist

strong hearth
#

Does this customer live in this connected account or platform account?

ionic wadi
#

Connect account

strong hearth
#

can you share with me the customer ID and the connected account ID?

ionic wadi
#

Yes

#

cus_KwTYld94QmiIoH
acct_18NGoVFUtwYrZPVC

strong hearth
#

thanks, and can you give me the request ID as well?

ionic wadi
#

req_gNMOJrbjhdTM2N

strong hearth
#

Are you making the request with your platform secret key or connect account's secret key?

ionic wadi
#

I'm using the same key

#

the test key

strong hearth
#

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?

ionic wadi
#

I'm using the platform account key

#

just checked

#

The request was on the connect account

craggy oar
#

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).

ionic wadi
#

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

craggy oar
#

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.

ionic wadi
#

// 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?

craggy oar
#

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

ionic wadi
#

So this is what I'm trying to do:

  1. Check if the source is present on platfrom customer by listing the sources
  2. If source is present don't attach
  3. Check if any clones of the source are attached the customer on connect account
  4. If not present, clone source and attach to customer on connect acct
  5. 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.

craggy oar
#

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.