#benkass

1 messages ยท Page 1 of 1 (latest)

grim gulchBOT
median tendon
#

Hello ๐Ÿ‘‹
I believe so

hollow sigil
#

So essentially, if I use paymentSheet, I cannot pass the customer name

grim gulchBOT
hollow sigil
#

Hey RUBEUS! ๐Ÿ˜„

#

Nice to see you here

#

I got it working

#

thank you!!

wet hedge
#

Ah, that's great news!

#

So the custom flow worked out?

hollow sigil
#

I really appreciate you not giving up on it

#

yes

#

perfectly

wet hedge
#

Awesome!

hollow sigil
#

well

#

sort of

#

a few issues here and there, like the one I am getting now

wet hedge
#

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?

hollow sigil
#

yes

#

shouldn't I?

wet hedge
#

What's your expectation there? To only set those billing details on the cloned Payment Method?

hollow sigil
#

exactly

wet hedge
#

Typically the Payment Method on your platform account is the primary, and all changes should be made to it.

hollow sigil
#

at the moment if I look at the connected account dashboard it's missing the name

wet hedge
#

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.

hollow sigil
#

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,
      });
wet hedge
#

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.

hollow sigil
#

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?

wet hedge
#

Is the bottom sheet your own UI?

hollow sigil
#

yes

wet hedge
#

How are you defining "default payment method"?

hollow sigil
#

How does the payment sheet?

#

When it opens, it has a card selected

#

I think it's the first one ever added

wet hedge
#

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.

hollow sigil
#

Do customers always have invoice_settings.default_method?

wet hedge
#

The property always exists, but it can be null.

hollow sigil
#

when is it set? when they first pay for something?

wet hedge
#

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.

hollow sigil
#

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

wet hedge
#

That's probably fine, especially for the first version of what you're building. You can always enhance it later if needed.

hollow sigil
#

indeed

#

I don't suppose stripe react native has a way to get those? I think its a server call, right?

wet hedge
hollow sigil
#

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?

wet hedge
#

The last4 yes, and you can get the card brand in the API, but we don't provide the actual logos in the API.

hollow sigil
#

I wonder how they provide it via stripe-react-native....

#

If it's in the package, I can just steal it

wet hedge
#

I think the logos are built in to the library.

hollow sigil
#

checking

hollow sigil
#

I want the card to look identical to what is displayed by stripe-react-native

wet hedge
#

You would need to mimic the library's implementation then.