sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

Leading 0's In Zip Codes Being Eaten

Open paujur opened this issue 8 years ago • 6 comments

Hey guys. It looks like you guys convert a zip code string that we give you into an int. Problem is that zip codes can start with a 0. And because you guys convert the string to an int, the 0 is getting dropped.

Because of this, some of our users are unable to make payments; their card gets declined for having the wrong address.

paujur avatar Oct 08 '18 17:10 paujur

Hi @paujur ,

Thanks for bringing this to our attention.

From our investigation, it seems that a dependency lxml automatically considers a number as an integer.

A solution for your problem is to use the .text property which will convert this integer into a string so that the zip code can be displayed properly.

Do let us know if you have any further issues with this.

gnongsie avatar Oct 23 '18 05:10 gnongsie

Hi @gnongsie,

Are you suggesting we edit our code or edit this library for the time being? I don't think the issue can/should be resolved on our end. It should be your code that needs to use .text on that field. So it's either this library or in your backend which submits the (wrong) zipcode when pulling the stored payment profile.

Since our code uses a string and the authorize.net dashboard shows the leading zero properly, it seems like it's your backend misinterpreting the string as an integer.

paujur avatar Oct 29 '18 14:10 paujur

Hi @paujur ,

Forgive me for not being clear.

What I'm trying to tell you is that we have investigated your problem, providing "00628" as the zip code for the transaction. I have checked this in Charge a Credit Card sample code. And I am able to create a transaction without any issues. I can also verify that by using the Get Transaction Details API.

I may be wrong in understanding which API you are using. But I see no issues with the SDK in this flow.

Perhaps, if you can provide me more information about the particular flow that you are using, I can troubleshoot this further.

Regards, Gabriel

gnongsie avatar Oct 30 '18 12:10 gnongsie

Hi @gnongsie,

So we're finding the issue when using payment profiles, not when submitting addresses directly when creating the transaction. We're also not seeing the issue when creating payment profiles, so it has to be something internal to your side.

Best, Paul

paujur avatar Nov 01 '18 22:11 paujur

Hi @paujur ,

So I've tested out your scenario. Here are the steps I followed:

  • I created a new customer profile with a payment profile where the BillTo zip code is provided as "00628".
  • I tried fetching this new payment profile using the sample code. This gave me the zip code as "628" if I call it directly.
  • If I use .text property as I mentioned in the comment above, that gives me the zip code as "00628".
  • I tried creating a transaction by charging this payment profile. The transaction was approved.
  • Fetching the transaction details again posed the same issue with the zip code.

In all this, I see no issue on our end regarding the zip code. It's only in the application code (sample code or some other application) that we need to fetch the zip code using the .text property.

Kindly review my steps and let me know if I missed anything.

gnongsie avatar Nov 05 '18 09:11 gnongsie

Based on @gnongsie instructions above closing this issue. Please feel free to re-open if any further support needed.

chsriniv9 avatar Nov 28 '18 08:11 chsriniv9