Reading the origin of a card
Four things worth understanding before you trust any attribution result.
What the origin of a card really means
The origin of a bank card is the province and city of the branch that opened the account, not the place the cardholder lives and not the place the card is used. A card opened in Hangzhou keeps its Zhejiang attribution even when it is spent in another province for years.
The number of digits that identify the branch varies by bank. Most institutions encode the branch in the digits right after the six digit BIN, which is why the same bank can hand out cards pointing to different cities.
Reading a BIN prefix
The BIN is the leading block of digits assigned by the People's Bank of China to an issuing institution. It tells you which organisation issued the card and which product family it belongs to before any account detail is known.
The lookup matches the longest recorded prefix first, so a ten digit prefix is preferred over a six digit one. A more specific prefix always yields a more accurate answer.
Head office code versus branch number
The head office code, or CNAPS code, is the identifier of the institution inside the national payment clearing system. It is twelve digits long and is what you put on a wire transfer slip.
It identifies the head office of a bank, not the individual branch that opened your account. Branch level detail is what the province and city fields are for.
Why the checksum sometimes fails
Card numbers end in a digit that makes the whole number divisible by ten under the Luhn algorithm. The lookup runs that test locally against the recorded card length.
A failure usually means a digit was mistyped, or that the number was truncated. It can also mean the number is well formed but was never issued.