Chat on WhatsApp

How do I validate VKN and TC Kimlik No at Magento checkout?

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:

  1. Add vkn + tc_kimlik_no attributes to the customer entity (or company if you’re on Adobe Commerce B2B).
  2. Show VKN field only for B2B (Şirket / Kurumsal), TC Kimlik No only for B2C (Bireysel). Toggle via customer-group.
  3. Server-side: validate VKN against GİB sorgu API on registration; checksum-validate TC Kimlik No client-side then server-side.
  4. Pass the validated ID into the e-Fatura / e-Arşiv XML generator at order completion.
  5. Cache validations 30 days, re-validate on any company-info change.
Was this helpful?