#benkass
1 messages ยท Page 1 of 1 (latest)
Hello ๐
I believe so
So essentially, if I use paymentSheet, I cannot pass the customer name
Awesome!
For the issue above, what's your use case exactly? It seems like you're simultaniously trying to clone and set billing details on a Payment Method?
What's your expectation there? To only set those billing details on the cloned Payment Method?
exactly
Typically the Payment Method on your platform account is the primary, and all changes should be made to it.
at the moment if I look at the connected account dashboard it's missing the name
Then, separately, you clone as needed for each direct charge.
So in this case step one would be to update the billing details on the platform's Payment method, then step two would be to separately clone it to the connected account.
gotcha. Will look into it. thnx
So something like this?
// Update the payment sheet's PM with billing_details
await stripe.paymentMethods.update(payment_method, {
billing_details: {
name
}
})
// Clone the Payment Method to a connected account
const clonedPaymentMethod = await stripe.paymentMethods.create({
customer,
payment_method,
}, {
stripeAccount: connected_account_id,
});
Yep.
The key thing to understand is that the Payment Method on your platform is the primary copy. You clone it every single time you create a direct charge, and those clones are used only once. That way every clone you make, for every charge, always has the most up-to-date info from the primary copy on your platform, because it's always a fresh clone every time.
roger that
At the moment, when a user clicks "Pay by card", I show a bottom sheet that asks them to select a payment method and automatically show the paymentsheet. It works, but I feel the UX could be improved if I can make a call to stripe to fetch the default payment method for the customer, just like the payment sheet does, and then they can click the "change method" button which will bring up the payment sheet. Is it possible?
Is the bottom sheet your own UI?
yes
How are you defining "default payment method"?
How does the payment sheet?
When it opens, it has a card selected
I think it's the first one ever added
We used to have the concept of a default_source on Customers, but that's now deprecated. There is no wholesale replacement for that (meaning Customers don't have a global default anymore). The closest thing is invoice_settings.default_payment_method, which sets the default for Invoice/Subscription payments. Some people use that as the global default in their own code, others set a default in metadata, and there are other approaches as well.
The PaymentSheet I believe uses a combination of logic to determine the default, which takes into account the legacy default_source, and it probably look at the most recently added/updated Payment Method. I don't know the specifics, I would need to look at the implementation to find out.
If I were building an integration, I would use invoice_settings.default_payment_method and would set/show it as the default throughout.
Do customers always have invoice_settings.default_method?
when is it set? when they first pay for something?
You would set it on your server using your secret key.
You can set it whenever you want based on your own logic, payment flow, etc.
Oh I see. for the moment it's not worth the development. We can consider it later
Considering most of our customers will only have one PM on their record, perhaps I can just get all their PMs and the first one would be displayed by default
That's probably fine, especially for the first version of what you're building. You can always enhance it later if needed.
indeed
I don't suppose stripe react native has a way to get those? I think its a server call, right?
There's fetchPaymentMethods on the CustomerAdapter: https://stripe.dev/stripe-react-native/api-reference/interfaces/CustomerAdapter.html#fetchPaymentMethods
yeah on it
ok cool thnx
I'm using the react native returned last4 and the card image logo. Is there a way to get the logo in a similar way with this api call?
The last4 yes, and you can get the card brand in the API, but we don't provide the actual logos in the API.
I wonder how they provide it via stripe-react-native....
If it's in the package, I can just steal it
I think the logos are built in to the library.
checking
I want the card to look identical to what is displayed by stripe-react-native
You would need to mimic the library's implementation then.