#Tomato-stripe-fees
1 messages · Page 1 of 1 (latest)
When you create the Payment Method using the Card Element (https://stripe.com/docs/payments/accept-card-payments?platform=web&ui=elements#set-up-stripe-elements), the billing zipcode will be attached. You can use that to look up the country if needed.
Sorry don't understand. Do u suggest me to add zip code field?
Zipcode is required for card payments. The Card Element is from stripe.js and is used to collect card details. The Card Element collects zipcode automatically.
I think we use this one (without zip code)
And if so - how could we grab zip code value with stripe.js?
It is sent back when the payment method is confirmed
Back to where
Could u please give a link to stripe.js API doc. How could i get country or zip code
You have the doc that would show you that. There is no doc that shows exactly how to get the zipcode, as it is returned when the payment method is confirmed. I would recommend following that guide to build an integration that accepts a card payment first then come back here if you have more questions
We already have app that successfully accept payments
Could u please write instruction what i need to do to know card country
I see change event
But how with it -get zip code?
It is on the Payment Method. You retrieve it via this field after the payment method is created: https://stripe.com/docs/api/payment_methods/object#payment_method_object-billing_details-address-postal_code
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
We use only
<PaymentElement
onReady={() => {
setLoading(false)
}}
/>
So we use "card" Payment Method
Maybe i need to say that we use custom payments with stripe.js
When in the payment flow do you need zipcode?
That's not helpful
I asked:
When in the payment flow do you need zipcode?
Why can't you simply retrieve the Payment Method after it is created?
We don't need it at all
Don't need what?
We don't use Payment Method at all too
Zip code
Okay, but country is also on the Payment Method
So what's the problem with retrieving the Payment Method after it is created?
I don't understand how to retrieveing Payment Method
So i need Payment Method Id. How could i get it from "PaymentElement" form?
You can't. The payment element is used to create a payment method. You have to create the payment method for there to be a payment method id.
ok, the method is not suitable for us
we don't need to create payment method
how else we can get payment card country?
My first message
"Hello. I need to calculate Stripe fee, before payment. I see that i need to know country of payment card to understand which price to use"
Yes, but how are you calculating fees before a payment is created?
What use is the country to you?
With formulas
2.9% for not Europe cards
So i need get card country to understand which fee to apply
So, you will need to create the Payment Method, in order to know what country the customer's fees are going to be tied to. The fees are dependent on the Payment Method's billing_details. If you don't have a Payment Method, you don't know what country the payment fees are going to come from.
Does stripe generate billing_details by card number?
I know that it is possible to know card country by its first 8 numbers
In the PaymentElement, there is no way to get the Payment Method billing_details until after the payment is completed. You will need to use the Card Element in order to get the country details from the Payment Method before the actual payment is complete: https://stripe.com/docs/payments/card-element
No
The customer enters their billing zipcode or their full billing address when the Payment Method is created
That's where that data comes from
The Payment Element does everything at once, so there's no way to extract that info before the payment is made