How do I validate VKN and TC Kimlik No at Magento checkout?
Categories:
Magento Developer Türkiye
Two Turkish identifiers, two different validators:
- VKN (Vergi Kimlik Numarası), 10-digit corporate tax ID for Turkish A.Ş. / Ltd. Şti. / sole-trader businesses. Used on B2B invoices + e-Fatura. Validated via GİB (Revenue Admin) sorgu API, free public endpoint that returns company name, address, and active status.
- TC Kimlik No, 11-digit citizen ID for Turkish individuals. Required on e-Arşiv (B2C) invoices when the customer is Turkish. Has a deterministic checksum (algorithm published by MERNİS); no API call needed for format validation, but full identity verification requires the MERNİS sorgu API (paid).
Magento integration steps:
- Add
vkn+tc_kimlik_noattributes to thecustomerentity (orcompanyif you’re on Adobe Commerce B2B). - Show VKN field only for B2B (Şirket / Kurumsal), TC Kimlik No only for B2C (Bireysel). Toggle via customer-group.
- Server-side: validate VKN against GİB sorgu API on registration; checksum-validate TC Kimlik No client-side then server-side.
- Pass the validated ID into the e-Fatura / e-Arşiv XML generator at order completion.
- Cache validations 30 days, re-validate on any company-info change.
Was this helpful?