question

1zero1 avatar image
1zero1 asked mikefru published

hosted iframe - get the zipcode value

Can we get the zip code directly from the


const cardPostalCode = elements.create('CARD_POSTAL_CODE',styles); ?


This information is useful for us outside the payment and parcouring DOM inside your Ifame is prompt for future errors.

...

Also parcouring dom gives a cross origin error, which is perfect like that.


ecommerce
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1zero1 avatar image
1zero1 answered

@bryan.vargas , we are out of luck for an answer on many questions on the forum. You previously answered on one other question we posted. I am reaching to you for a follow-up on these many questions. Sorry for the many tags you'll receive

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bryanvargas avatar image
bryanvargas answered

AFAIK we don't provide back the Zip code, and personally, when I use my credit card at other places, it always prompts me for the CVV and Zip.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1zero1 avatar image
1zero1 answered bryanvargas commented

@ bryan ,

I am not sure I understand your answer, which makes me think you don't understand our question. We need to have that postal code in our saved data. The clover iFrame is integrated in a bigger form, with many fields, like the name and complete address. As of right now, because the zip code is a Clover field, we cannot get that info. Is there a way, other than asking the zip code twice to the user (once in a field outside clover, and once from the zip code iframe field) to get that zipcode?

3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bryanvargas avatar image bryanvargas ♦♦ commented ·

Please test this in sandbox and see what is available in the api request when you get the payment details. I tested this many times and did not get a ZIP code back.

0 Likes 0 ·
1zero1 avatar image 1zero1 bryanvargas ♦♦ commented ·

The question is not about the API, it's about getting the content of the field in the form itself. The iFrame have a zip code field.

Before sending anything to the server.


Can we get the zip code?


Keep in mind that we are using the clover Iframe .

Can you take the time, please, to gather information instead of asking us to test it in sandbox. There is no doc on what I am asking, and, yes, we have tried. That's why I am posting here.

0 Likes 0 ·
bryanvargas avatar image bryanvargas ♦♦ 1zero1 commented ·

Confirmed that due to security constraints, we do not pass the actual data back

0 Likes 0 ·
1zero1 avatar image
1zero1 answered

OK, that is what I thought.

I get it for the card number/cvc/expiration date, but could it be possible to add an option to pass back the zip code?


This is an official feature request .


Maybe we could access it from the clover object :

const clover = new Clover('sdfsdf');

or the mounted zipcode field :

 const elements = clover.elements();
const cardPostalCode = elements.create('CARD_POSTAL_CODE',styles);


Once again, Bryan, thank you for your time!

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mikefru avatar image
mikefru answered mikefru published

@1zero1 I struggled with the same issue, but found out that after you create the token

clover.createToken()
  .then(function(result) {
                 
    if (result.errors) {
                 
      Object.values(result.errors).forEach(function(value) {
                 
        displayError.textContent = value;
      });
    } else {
                 
      console.log("created token");
      console.log(result);

if you print the result it returns this:

{
                 
  "card": {
                 
    "exp_month": "2",
    "exp_year": "2025",
    "first6": "601111",
    "last4": "1117",
    "brand": "DISCOVER",
    "address_zip": "08002"
  },
  "token": "clv_1TSTSuxJAPgGWDEzxjdExgp3"
}


10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community