#kautuva-clone-source
1 messages · Page 1 of 1 (latest)
const tokenRequest = {
customer: stripeCustId,
card: chosenSource
}
const opts = { stripeAccount: stripe_account_id }
await stripe.tokens.create(tokenRequest,opts)
chosensource here is cloned source on connect account
stripeCustId is id of customer on connect account
stripe_acct_id is the account id of the connected account
req_id:
req_kbi1ex3VxOL3yE
stripeCustId -> is this a platform customer or connect account customer?
connect
The ID of the customer in your platform account -> the API is expecting the platform customer, not connect account customer
when I use the token to create the charge it'll charge which customer if I use platform customer id to create the token?
connect customer or platform customer?
also, I'm not cloning customer, only the source
creating two customers separatly
I want the token to create a charge on my connect customer
Ok, so the purpose of this source cloning is to clone your platform customers' payment information across multiple connected accounts for reuse.
That's why the API is expect you to pass the platform customer ID when creating the token
Before you making charge to the customer on connect account, you have to create a new customer with source = token.id, and then charge on the newly created customer.
I already have my connect customer
I created it normally without any cloning
I just want to use my cloned source with that customer
Now, how do I do that?
This is the reason why I created the second customer without passing any source id
I attached the clone separately
Now I just want to charge that customer
So if the cloned source is attached to the customer on connect....can I just charge it?
Yes, you can charge the customer on connect. But first you need to fix the source cloning problem.
I've already cloned my source and attached it to the customer I created on connect account
So you have fixed the stripe.tokens.create problem that you mentioned earlier?
No, that is the problem. If I'm passing the platform_customer_acct_id and the cloned_source while creating the token how do I charge the connect_customer_account?
Let do it step-by-step, I believe you read this doc https://stripe.com/docs/connect/cloning-customers-across-accounts, which step are you in now?
I'm using below instead since I was advised against using the above
https://stripe.com/docs/sources/connect#cloning-card-sources
Can you send me the link?
Got it, so you want to know how to make a direct charge, am I right?
Cool, it's very similar to the way how you create customer on connect account
it's like creating a normal paymentIntent, just need to add in the stripeAccount header in the request.
You can specify the cloned customer ID, as well as the cloned payment method ID in the payment intent creation request
I can't create a charge? Why are we creating a payment Intent?
I thought you were following this guide https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods ?
Just to clarify, are you cloning a payment method or source?
If you want to make direct charge with Charge API, it's the same thing, just pass in the connect account ID in the stripeAccount header and you are good to go
OK. I'm using this:
https://stripe.com/docs/sources/connect#cloning-card-sources
OK, btw Source and Charge are the old APIs. I'd recommend to use Payment Intent and Payment Method if possible
Yes, we'll be migrating to that too
But we already have a ton of existing customers with sources
while creating the charge which source id should I pass as parameter? the original source ( on platform ) or cloned source ( on connect ? )
I want the charge on connect
and the cloned source is attached to customer on connect
doesn't seem to work if I pass the cloned source id in the id parameter
it probably expects a token
req_blZPMpNC2YcZPR
it says I've not passed a source at all
You didn't pass a source or customer, as the error says
you should pass the cloned source or customer.
I am passing the cloned source
const stripeResponse = await stripe.charges.create(
{
amount: adjustedAmount,
currency: plan_record.currency,
source: source.id,
description: Charge for customer id ${plan_record.fk_customer},
metadata: {
orderId: plan_record.fk_orders,
...plan_record.additional_info,
},
statement_descriptor: brandCharge
},
{
idempotencyKey: transaction_key,
stripeAccount: stripe_account_id
}
);
this should work?
I don't see customer or source in iar_blZPMpNC2YcZPR
if source is the cloned source?
Yup, it should work, can you try?
Cool! I'm so happy to hear that!
My shift is ending soon, do you need me to keep this thread open?
OK, I will archive it then, feel free to come back if you have any questions