𝗦𝘁𝗼𝗽 𝗖𝗵𝗮𝗿𝗴𝗲𝗯𝗮𝗰𝗸𝘀 𝗕𝗲𝗳𝗼𝗿𝗲 𝗦𝗵𝗶𝗽𝗽𝗶𝗻𝗴: 𝗜𝗣 𝘃𝘀 𝗕𝗶𝗹𝗹𝗶𝗻𝗴 𝗖𝗼𝘂𝗻𝘁𝗿𝘆
A buyer's IP country and billing country usually match. When they do not, it is a major signal for stolen card fraud.
Most checkouts ignore this. You can run this check cheaply to stop fraud before you ship a product.
Here is how to build a layered defense:
• Use IP geolocation to find the buyer's country. • Get security signals like threat scores and proxy flags in the same call. • Compare the IP country to the billing address country. • Make a decision: allow, add friction, review, or block.
Never block based on country alone. Travelers, expats, and corporate VPN users will trigger a mismatch constantly.
Use this logic instead:
- Block: Known attackers or very high threat scores (80-100).
- Review: Country mismatch combined with a VPN or proxy, or medium threat scores (45-79).
- Friction: A lone country mismatch or low-medium threat scores (20-44). Trigger 3DS here.
- Allow: Matching countries and low threat scores (0-19).
This method catches third-party fraud. It does not catch friendly fraud where the real owner disputes a charge.
Technical tips for your implementation:
- Fail soft: If the IP lookup fails, route the order to manual review. Do not block a paying customer because an API is down.
- Use X-Forwarded-For: If you use a load balancer, ensure you read the real client IP, not the proxy IP.
- Cache results: Store IP lookups in Redis for 10 minutes to save money and reduce latency.
- Use country codes: Stick to ISO alpha-2 codes (US, GB, DE) for simple comparisons.
This check is a fast, cheap signal. It works alongside AVS and 3-D Secure to protect your revenue.
Source: https://dev.to/abdullah_afzal/stop-the-chargeback-before-it-ships-ip-vs-billing-country-4ja4