#gerarda-clone-payment-method

1 messages · Page 1 of 1 (latest)

wicked berry
#

what errors are you seeing and can you share your code on cloning the payment_method?

toxic aurora
#

yeah you don't want to create a Token at all

#

as I said yesterday the docs are very confusing unfortunately

patent wyvern
#

I have two connected accounts related to the platform account, I want to do two payments with these accounts with the same payment card details. So I create the stripe elements with the first connected account and mounts it stripe = Stripe(data.publicKey, {stripeAccount: "acct_1JClrVCz5n0FQ626"});
var elements = stripe.elements(); After that I create the first payment intent and confirm it, is it in succedded status

#

after that I create a Payment method client side:
var paymentMethod;
stripe.createPaymentMethod({
type: 'card',
card: card,
billing_details: {
name: 'Jenny Rosen',
},
}).then(function(result) {
paymentMethod = result.paymentMethod;
fetch("/clone-paymentMethod", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(paymentMethod)
})
});

#

I create a new customer with the second connected account id and I cloned payment method and I created a new payment intent

#

com.stripe.exception.InvalidRequestException: No such PaymentMethod: 'pm_1JadFbCz5n0FQ626dBwg3BRX'; code: resource_missing; request-id: req_FPWJhfvhb8pNkM

#

I have the same error

toxic aurora
#

note you can't clone the payment method from one connected account to another

#

only from your platform down to a connected account. That's probably why you're getting an error

#

So I create the stripe elements with the first connected account and mounts it stripe = Stripe(data.publicKey, {stripeAccount: "acct_1JClrVCz5n0FQ626"});
that part is wrong since you're creating the PaymentMethod directly on that connected account, so you could never clone it elsewhere

patent wyvern
#

ok but I cannot do a payment with the platform account

#

I should create only a payment method with platform account, after that should I create two payment methods, two customer and two payment intent it whit the connected accounts?

toxic aurora
#

you don't have to! usually the way it works is you do like, on the frontend :

var stripePlatform = Stripe(data.publicKey);
var stripeConnectedAccount = Stripe(data.publicKey,  {stripeAccount: "acct_1JClrVCz5n0FQ626"});

...

stripePlatform.createPaymentMethod(...)

...
// send PaymentMethod to the backend and clone it and create a PaymentIntent on the connected account
stripeConnectedAccount.confirmCardPayment(client_secret)
#

a payment method with platform account, after that should I create two payment methods, two customer and two payment intent it whit the connected accounts?
yes!

#

the way you're doing this now will result in the customer's card getting charged twice in a couple of seconds by two separate merchants. The customer might have to do 3D Secure twice in a row. Their bank might decline the payments as looking like duplicates. It's messy.

patent wyvern
#

yes I know, but the client won't do it for business issues

#

so I didn't transfer money

patent wyvern
#

Hello @toxic aurora I tried to create a payment method with the platform account stripe.createPaymentMethod and I created a customer of connected account, passing the payment method from front end