#suraj-parwani_api

1 messages ยท Page 1 of 1 (latest)

ruby rivetBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1262358563716730960

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

worthy marsh
#

hi! any more details on what you're referring to exactly?

pallid parcel
#

So we have integrated checkout flow in my application. So card number, cvv name and pincode are mounted on the application. Now for the pincode validation is a mandatory field and is handled by stripe.
Customer is from India and card is from india and india has 5 digit pincode.
but stripe is throwing error for this

#

Can you help me with this?

worthy marsh
#

by pincode do you mean 3D Secure?

pallid parcel
#

Nope. postal code

worthy marsh
#

I see. then why did you say pincode isntead of postcode?

pallid parcel
#

Sorry fo that, but in india its referred as pincode ๐Ÿ˜€

worthy marsh
#

anyway, this should just work if you integrate using the recommended flow(using the PaymentElement). How have you integrated, what does your code look like?

pallid parcel
#

Yes i am using the PaymentElement

worthy marsh
#

then it will just work really, the customer picks India as the country in the country dropdown in the PaymentElement, and the postal code input will validate for Indian-specific postcode formats. If you're facing a problem with this I will need a lot more information than just "it throws error".

west flareBOT
pallid parcel
#

it says postal code should be 6 digits

shut prairie
#

My understanding (via quick search) is that the IN system uses 6 digits postal/pin codes, no?

pallid parcel
#

Yes correct..

#

one minor correction

shut prairie
#

Then I'm not sure what is unexpected?

pallid parcel
#

system is allowing 5 digits and indian postalcodes are 6 digitst

shut prairie
#

If you're trying to submit the Element without providing a ZIP/PIN code that meets the validation that it will error yes

pallid parcel
#

Let me correct the statement
user is from india
and when user is coming to my application and entering indian card, the system is throwing validation that postal code should be 5 digits

#

but indian postal codes are of 6 digits. And this validation is handled by stripe

#

Not able to find the root cause for this

worthy marsh
pallid parcel
#

This is my checkout screen

#

zip code ia mandatory here

shut prairie
#

Well that is not the Payment Element. To be clear, are you building your own Stripe integration? Or is this some kind of plugin?

pallid parcel
#

This is the custom checkout which stripe has offered.

shut prairie
#

What is 'custom checkout'? Which APIs and payment UIs are you using? Some code will be useful

pallid parcel
shut prairie
#

That's just a docs link, what actual Stripe code have you used to render that form

pallid parcel
#

Should i share the code snippet here?

shut prairie
#

I'd guess it's the Split Card Elements

shut prairie
pallid parcel
#

this.cardnumber = this.elements.create('cardNumber', {
showIcon: true,
placeholder: 'Card number',
});
this.cardnumber.addEventListener('change', this.cardHandler);
this.cardnumber.mount(this.stripecardnumber.nativeElement);

  this.cardExpiry = this.elements.create('cardExpiry');
  this.cardExpiry.mount(this.stripecardexpiry.nativeElement);

  this.cardCvc = this.elements.create('cardCvc');
  this.cardCvc.mount(this.stripecardcvc.nativeElement);

  this.cardPostal = this.elements.create('postalCode', {
    placeholder: 'ZIP',
  });
  this.cardPostal.mount(this.stripecardzip.nativeElement);

This is my sample code. which basically mounts the elements

shut prairie
#

So yes, Split Card Element. AFAIK, that postalCode Element is mostly deprecated which is why it's undocumented and likely doesn't validate postal codes that are regional specific

#

i.e. it just expects a 5 character string as that is what US zip codes are

#

This is unlikely to be fixed/changed because it's deprecated and we don't encourage usage of it. I'd recommend implementing your own ZIP code field

pallid parcel
#

but is it necessary for the making the payment ?

shut prairie
pallid parcel
#

but for other users from india then the validations are working perfectly

shut prairie
#

I don't know what that means

pallid parcel
#

Other user who are from india are trying to make purchases and entering 6 digit postal codes, works perfectly for them

shut prairie
#

As I said, the validation probably only checked for at least 5 characters

#

So both 5 and 6 postal codes input will be fine

pallid parcel
#

the validation is only working if i dont enter the zip code

#

if i enter 1 digit as well its working fine

shut prairie
#

As I said, this Element is deprecated so there are no plans to change/fix how the validation works

#

If this is important to you, then you should use Payment Element and/or your own ZIP code field

pallid parcel
#

What is an alternative for this

shut prairie
#

I just said, use Payment Element