maxmind/minfraud-api-php

withBilling() validating region as ISO 3166-2 subdivision code

apoguy opened this issue · 1 comments

I'm just getting started with this new API, and created a minFraud request that passes billing info with the withBilling() method.

When adding the region info (as entered in the payment form, valid for Stripe), it throws an exception: Uncaught MaxMind\Exception\InvalidInputException: region must be an ISO 3166-2 subdivision code.

This doesn't make much sense, as having customers from all countries makes impossible to map an entered region/state to an ISO 3166-2 code. That could be easy for US/CA and other well known countries, but for others, like mine (Uruguay) I have no database to match the entered region to an ISO 3166-2 valid code.

That matching should be done by MaxMind server side... throwing the exception only leaves me with one option, not passing region data to the request...

Is there any solution for this?

The Uruguay ISO 3166-2 codes are available here. There are also libraries, e.g., PHP ISO Codes, you can use.

Without specifying a standard format for the regions, we have no way of knowing how to interpret what is passed to us. Customer may be passing the regions as their English name, localized names, FIPS code, ISO code, local codes, etc.