#_nerder
1 messages ยท Page 1 of 1 (latest)
Hi ๐
You should see one PM on the Platform account that you then clone to the Connected Account and attach to a customer.
Are you following this doc? https://stripe.com/docs/connect/cloning-customers-across-accounts
nope, i'm using payment methods not tokens
i'm doing this
this is the customer with the attached payment method inside the platform account: https://dashboard.stripe.com/test/customers/cus_Oo5UUhY5BPcT7P
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
and this is the customer in the connected account after confirming the payment intent from the subscription creation: https://dashboard.stripe.com/acct_1FuM5ALAVB3C1lDI/test/customers/cus_Oo95SnumAvkIaB
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I can't use dashboard links. They only go to your dashboard for you
ah ok, sorry
this is the customer inside the PLATFORM: cus_Oo5UUhY5BPcT7P
this is the customer inside the CONNECTED ACCOUNT: cus_Oo95SnumAvkIaB
not sure if you can see them right now
Okay I can take a look at those
I see one Payment Method attached to the customer, 10 minutes ago
But two attached payment methods
Weird
Oh wait
The CA customer was created with a PM here : https://dashboard.stripe.com/test/logs/req_48WwDhlILWx1iR
I don't really get where the other one is coming from
But a different payment method ID was added to the Customer here: https://dashboard.stripe.com/test/logs/req_aQOw1MddYdt4sZ
Ok, i might know why is this happening
It looks like both requests came from your Node.js server so I'd double check
Okay cool
No luck
I really have no clue from where the other payment method is coming from
since it gets attached after the subscription is created
Well both API calls were triggered from the Node.js server-side integration.
might be a webhook
One was a Customer create API call: https://stripe.com/docs/api/customers/create
The other was an Update: https://stripe.com/docs/api/customers/update
You can check your code for all the places where these two calls occur
Ok, i spot something i'll test it
๐
I have a weird feeling that the second payment method is a temporary payment method which is created by stripe to clone
Hello! I'm taking over and catching up...
So you're seeing three total? One on the platform and two on the connected account?
yes
but i don't have any other places in my codebase where i update the customer to attach a payment method
the only suspect I have is for when i confirm the payment intent in the frontend
this is the code i have in the backend
async cloneIntoGym(gym: Gym, account: Account, customer: Customer, profileId: string): Promise<Customer> {
this.logger.log(`Cloning customer with id [${customer.id}] inside account [${gym.accountId.value}]`);
const clonedPaymentMethod = await this.stripe.paymentMethods.create(
{
customer: customer.id,
payment_method: customer.paymentMethodId,
},
{
stripeAccount: gym.accountId.value,
},
);
const customerInGym = await this.stripe.customers.create(
{
email: account.primaryEmail,
payment_method: clonedPaymentMethod.id,
metadata: {
uid: account.uid,
profileId,
},
},
{
stripeAccount: gym.accountId.value,
},
);
return Customer.of({ id: customerInGym.id, paymentMethodId: clonedPaymentMethod.id });
}
And i've tested that if I don't complete the payment intent of the subscription only one payment method is created
Can you give me the three Payment Method IDs so I can take a look?
yes gimme a sec
From the PLATFORM: pm_1O0XPwHTyY8xD8aG74Ahlg3r
From the CA:
pm_1O0XQ6LAVB3C1lDIxNO73dlp (this one is the correctly cloned)
pm_1O0XQ8LAVB3C1lDID6c4sDdP (this is the unexpected one)
what's very sus to me is that the expiry date is right 1 year from now
Looking, hang on...
Damn, i've spotted it
Looks like one is being created client-side, one is being created server-side.
this was my frontend code in Flutter:
Future<void> confirmPayment({
required User profile,
required String clientSecret,
required String paymentMethodId,
String? onBehalfOf,
}) async {
_setupConnectedAccount(onBehalfOf);
await _stripe.confirmPayment(
paymentIntentClientSecret: clientSecret,
data: const PaymentMethodParams.cardFromMethodId(
paymentMethodData: PaymentMethodDataCardFromMethod(
paymentMethodId: 'pm_card_visa',
),
));
}
i forgot to pass the payment method down
Ah, yep.
No, that's a special test mode Payment Method ID that always works.
No worries!
Have a look here for other test Payment Methods: https://stripe.com/docs/testing?testing-method=payment-methods#cards