#xiaogangliu-cloning
1 messages · Page 1 of 1 (latest)
@silver stream as the error indicates you must be doing something wrong(like you're using the wrong API key or authentication), hard to say.
What's the exact code you've written and which call gives that error?
const iPaymentMethod = await iStripe.paymentMethods.create({
customer: fCustomer.id,
payment_method: fPaymentMethod.id
},{
stripeAccount: iId
});
i clone the payment method from another customer
from another customer
you mean, from a customer on your platform account right?
can you share what the value of ild is so I can understand better what you're doing?
fId = 'req_hWbIXQjkXvruGt';
const fPKey = 'pk_test_51HPktwFYFYqYTqZyYHSNch7anG6s9BYWC589NVBafvzgv6V1VVNLS1ZUe2CW5MC2pkeCNUxB2mXs9vzSrMw13MMy00iA4IrxVB';
const fSKey = 'sk_test_51HPktwFYFYqYTqZyAr7Hpwmh4jMnWj5uwrXjPNQIAZExHKw8zQFCo03Z2QGEwHXDn4b0ZWSL2U0sNHbHLUGnUBVy00cQfZPVup';
iId = 'req_cLwPVRsyi86hVf';
const iPKey = 'pk_test_51HPkv0J5YgkW7Mz28vLVhS0eSy3Bo2vi0TJlUJl0SdLdDvp2jASp6tw2Ymbt2AfYAOespe0swZBO5Kjwaz3ufjSI00g06yjnOi';
const iSKey = 'sk_test_51HPkv0J5YgkW7Mz2BBpiVy0Oqh3EfufcCSf02RoYQUyUvJBsNnPADxIOap45LnVWvmdW71FW9BzkLrtbF9hGQHsH00cxS5lHLj';
fStripe = require('stripe')(fSKey);
iStripe = require('stripe')(iSKey);
const fPaymentMethod = await fStripe.paymentMethods.create({
type: 'card',
card: {
number: '4242424242424242',
exp_month: 9,
exp_year: 2022,
cvc: '314',
},
});
const fCustomer = await fStripe.customers.create({
payment_method: fPaymentMethod.id
});
const fPaymentIntent = await fStripe.paymentIntents.create({
amount: 2000,
currency: 'usd',
payment_method_types: ['card'],
customer: fCustomer.id,
payment_method: fPaymentMethod.id
});
let res = await fStripe.paymentIntents.confirm(fPaymentIntent.id);
// expect(res.status).to.equal('succeeded');
const iPaymentMethod = await iStripe.paymentMethods.create({
customer: fCustomer.id,
payment_method: fPaymentMethod.id
},{
stripeAccount: iId
});
hmm why are you passing a req_xxx request ID 😅
that makes no sense unfortunately, I think you're quite lost.
you don't seem to be using Connect at all and I'm really not sure what you're trying to actually do. You can't create a customer on the "f" account and then just copy it to the "i" account by using a different API key, those two accounts are completely unrelated.
you need to start with https://stripe.com/docs/connect/ and then maybe look into https://stripe.com/docs/connect/direct-charges and then finally https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods when you have a good grasp on the fundamentals!
also I'd recommend rolling those API keys(https://stripe.com/docs/keys#rolling-keys) since this is a public server
i want to clone the customer of f account to i account,
for customers of f may be charged by i account
so I does not to make them type card number again
cool!
then you can do that but you have to be using Connect, where 'f' is the platform and 'i' is the connected account.
Right now you don't seem to be using Connect at all right? So you should start from the links I shared above to understand what the product is and how it works.
thanks!
hello, here is our demanding:
We have customer in UK, Norway and European countries,but our current account is European, so when we charge UK customers there is an extra fee for the rate exchange.
To reduce this unnecessary fee we want to charge UK customers by UK account and Norway customers by Norway account in their own country, meantime when UK customers travel to Europe
we want to charge them by European account not UK account.
Do you have some suggestions?
@unborn sentinel
yep you can do that, you'd ask the customer where they're from(or look at card.country on the PaymentMethod object) and then you can clone the PaymentMethod to a local account and charge there. Assuming you have all the Stripe accounts and legal entities you need and have connected them using Connect
I user connected account to charge, what the fee in the red box of the picture for?is for currency transfer or something else?
That is stripe processing fee
thank you
np
you can take a look at this
thanks
hello, I have a question, can I clone the user created in connected account to the platform account. How to do that? @unborn sentinel
no you cannot