#srujan-paymentelement-react

1 messages · Page 1 of 1 (latest)

cerulean glacierBOT
orchid bay
#

srujan-paymentelement-react

magic dragon
#

The event handler for card element gives me brand

orchid bay
#

Hey @magic dragon let me check but I don't think PaymentElement gives you the card brand

magic dragon
#

Ty koopa.

#

It does show the brand in the input display but is this exposed at all?

orchid bay
#

yeah we don't surface it anywhere. There shouldn't be any need for this in the PaymentElement usually

magic dragon
#

We have a custom payment flow that I need to send the brand for use with another API. I could use an algorithm but figured it'd be easier to use stripe

#

why is brand surfaced on cardElement and not payment element?

orchid bay
#

I don't understand what "use an algorithm" could mean. Can you try and explain exactly what you are doing with this and when? All in one clear message please!

magic dragon
#

Sorry, I meant there is an easy algorithm we can use to determine major credit card brands. It's called the Luhn Algorithm. https://en.wikipedia.org/wiki/Luhn_algorithm But I figured it'd be easier to use Stripe's api if this info was exposed on the Payment Element

orchid bay
#

but you can't do that, you don't have access to the card number. If you did, it wouldn't be PCI compliant. So what you are trying to do is impossible. You can not get the card brand as the number is being typed

magic dragon
#

Oh right you're right

#

Dang. So there is no way to get the brand then?

#

i guess i'm confused as to why it isn't exposed on payment element when it's a value i can get from card element

#

Because payment element is basically the same thing but with other payment method types

orchid bay
#

Because they are completely different UI flows. There's no reason to need the card brand in the PaymentElement flow that we can think of so it's not exposed.

magic dragon
#

Hmm...I guess I need it for my use case but a backend refactor might be in order

#

Sometimes I wish I had permission to change backend myself haha...have to get someone else to do it

#

Is there any way to get that info from payment intent?

#

looks like no =/

orchid bay
#

It lives on the Charge that represents the payment attempt

magic dragon
#

is there a way to retrieve a charge from the frontend?

orchid bay
#

no, it's all server-side. None of this is possible client-side. But again I don't get why you need this client-side

magic dragon
#

you're right, I should do this server-side. It's just that things move slowly b/t teams so I was trying to finish up my ticket. But I'll have to get backend team to refactor.

#

Quick question out of curiosity though, what do people generally use card brand for on the CardElement?

#

Also appreciate your help a lot