Square Payment How to validate postal code. Currently Postal Code is not validating by api

Hello,
Can you please let know how to implement postal code verification as currently create payment api not validating postal code of card.

PS:
Also I have tried payment with wrong future Expiry Date, other details are correct though Payment Got Success.
Please let me know if there is any issue in payment api or any thing which have to handle.

In the CreatePayment response, under card_details there are avs_status and cvv_status fields so you can see if they were accepted, rejected, or not checked. If you’re wanting to prevent a bad postal code, then you should implement autocomplete: false and check the response, and then decide whether or not to complete the payment using CompletePayment. We use a variety of factors to determine whether or not a payment is allowed to happen or not, and postal code is not always a good factor so it can be bypassed if we believe it’s legitimate.

Just to confirm in regards to the incorrect expiration, is this in production or sandbox? Sandbox doesn’t matter what you put, to be clear.

Regarding Expiration date, we checked with Production (NOT Sendbox) and even Amex credit card was charged successfully with the amount even thouh Expiry date entered was wrong!

So our simple query remain the same, how we can validate the Expiry date in any scenario? Good if you can explain with an example code and reference link, so we get the clarity on how exactly we can do that.

Postal code verification:
Sorry but though you explained how we can verify it:
“…If you’re wanting to prevent a bad postal code, then you should implement autocomplete: false and check the response, and then decide whether or not to complete the payment using CompletePayment…”,
it is not very clear to us, so good if you explain it further with sample code example and reference links if any, which exactly guide us how we can do that.

There’s no way to validate the expiration date at this time, but if you have the payment_id I can take a closer look as I don’t think we should be allowing incorrect expirations.

As for the postal code, basically what I was suggesting is:

  1. Call CreatePayment and set the optional field autocomplete to false.
  2. In the response, check card_detailsavs_status to see if it’s AVS_ACCEPTED.
  3. If it’s AVS_REJECTED you can then call CancelPayment to cancel the payment if you want.
  4. If it’s AVS_ACCEPTED, you can then call CompletePayment instead to finish the payment.

Payment Id is vDmG53EO8E5zXmV7VPpQxH6UU1IZY when we use wrong expire date

I checked in with some folks, and they confirmed that it is possible for a payment to go through even if the expiration is incorrect, based on other variables and factors around the payment and the card itself. Apologies for the confusion!

Is there any way to validate expiry date ?

No, we do not provide the success/failure value for expiration date at this time.