[{"data":1,"prerenderedAt":343},["ShallowReactive",2],{"seite-\u002Fen\u002Fratgeber\u002Fuid-nummer-pruefen\u002F":3},{"id":4,"title":5,"body":6,"description":335,"extension":336,"meta":337,"navigation":142,"path":338,"robots":339,"seo":340,"stem":341,"__hash__":342},"seiten_en\u002Fratgeber\u002Fuid-nummer-pruefen.md","Validate a Swiss UID number in WooCommerce, a guide for Swiss shops",{"type":7,"value":8,"toc":325},"minimark",[9,14,18,23,28,39,42,46,49,65,68,72,75,87,90,93,97,105,113,219,222,226,234,238,241,258,261,265,274,300,303,307,315,321],[10,11,13],"h1",{"id":12},"validate-a-swiss-uid-number-in-woocommerce","Validate a Swiss UID number in WooCommerce",[15,16,17],"p",{},"Anyone selling to businesses in Switzerland asks for the business identification number, the\nUID, in the checkout or in the quote form. Whether the number entered is correct and whether the\ncompany still exists can be checked in three steps: format, check digit and entry in the federal\nUID register. This guide shows all three, by hand and in a WooCommerce shop.",[19,20],"produkt-ablauf",{":schritte":21,"titel":22},"[{\"ort\":\"Checkout or form\",\"text\":\"Customer enters their UID\"},{\"ort\":\"Your shop\",\"text\":\"Format and check digit, no network request\",\"eigen\":true},{\"ort\":\"Federal UID register\",\"text\":\"Does the company exist, is it active?\"},{\"ort\":\"Checkout\",\"text\":\"Order accepted or rejected with a message\"}]","How the UID check works: entry in the checkout, format and check digit locally, status in the UID register, then the order is accepted or rejected",[24,25,27],"h2",{"id":26},"what-a-swiss-uid-is","What a Swiss UID is",[15,29,30,31,38],{},"The UID is the single number under which a company is known to Swiss authorities. It is assigned\nby the Federal Statistical Office (FSO) and listed in the ",[32,33,37],"a",{"href":34,"rel":35},"https:\u002F\u002Fwww.uid.admin.ch\u002F",[36],"nofollow","UID register",".\nWhen an authority reports a new company, it receives its UID there. The register also knows\ncompanies that are not in the commercial register, such as many sole proprietorships and\nassociations.",[15,40,41],{},"The number consists of the prefix \"CHE\" and nine digits, written CHE-123.456.789. The last digit\nis a check digit. If a company is registered for VAT, its invoices show the same number followed\nby \"MWST\", in French \"TVA\", in Italian \"IVA\".",[24,43,45],{"id":44},"step-1-check-the-format","Step 1: check the format",[15,47,48],{},"Customers type the UID in many ways. A check should accept all of them that mean the same number\nand then store it in one form:",[50,51,52,56,59,62],"ul",{},[53,54,55],"li",{},"with dots and hyphen: CHE-353.272.857",[53,57,58],{},"without separators: CHE353272857",[53,60,61],{},"with spaces: CHE 353 272 857",[53,63,64],{},"with the VAT suffix: CHE-353.272.857 MWST",[15,66,67],{},"So the prefix CHE is allowed, followed by exactly nine digits, with at most dots, hyphens or\nspaces between them, and optionally MWST, TVA or IVA at the end. It is always stored as\nCHE-353.272.857, so the same company does not end up in the system twice under different\nspellings.",[24,69,71],{"id":70},"step-2-calculate-the-check-digit","Step 2: calculate the check digit",[15,73,74],{},"The ninth digit follows from the first eight, using the modulo 11 method. That way the check\ncatches most typing errors without asking the register:",[76,77,78,81,84],"ol",{},[53,79,80],{},"Multiply the first eight digits by the weights 5, 4, 3, 2, 7, 6, 5, 4 and add them up.",[53,82,83],{},"Divide the sum by 11 and take the remainder.",[53,85,86],{},"The check digit is 11 minus this remainder. If that gives 11, the check digit is 0. If it\ngives 10, the number is not a valid UID.",[15,88,89],{},"An example with the digits 1 2 3 4 5 6 7 8: 1·5 + 2·4 + 3·3 + 4·2 + 5·7 + 6·6 + 7·5 + 8·4 gives\n168. 168 divided by 11 leaves a remainder of 3, so the check digit is 11 − 3 = 8. The number\nCHE-123.456.788 therefore has a valid format. CHE-123.456.789, often used as a sample, does not.",[15,91,92],{},"A correct check digit does not yet mean the company exists. Only the register can tell.",[24,94,96],{"id":95},"step-3-look-it-up-in-the-uid-register","Step 3: look it up in the UID register",[15,98,99,100,104],{},"By hand, this works on ",[32,101,103],{"href":34,"rel":102},[36],"uid.admin.ch",": enter the UID or company name,\nand the register shows name, legal form, address, status and the entry in the VAT register.",[15,106,107,108,112],{},"For a shop there is the FSO's UID web service. Its \"PublicServices\" can be used publicly without\na login, in a limited form, and free of charge. The web service speaks SOAP, and the data follows\nthe eCH-0108 standard. Looking up a single number is called ",[109,110,111],"code",{},"GetByUID",":",[114,115,120],"pre",{"className":116,"code":117,"language":118,"meta":119,"style":119},"language-html shiki shiki-themes github-light github-dark","POST https:\u002F\u002Fwww.uid-wse.admin.ch\u002FV5.0\u002FPublicServices.svc\nSOAPAction: \"http:\u002F\u002Fwww.uid.admin.ch\u002Fxmlns\u002Fuid-wse\u002FIPublicServices\u002FGetByUID\"\n\n\u003Cuid:GetByUID>\n  \u003Cuid:uid>\n    \u003Cech:uidOrganisationIdCategorie>CHE\u003C\u002Fech:uidOrganisationIdCategorie>\n    \u003Cech:uidOrganisationId>353272857\u003C\u002Fech:uidOrganisationId>\n  \u003C\u002Fuid:uid>\n\u003C\u002Fuid:GetByUID>\n","html","",[109,121,122,131,137,144,157,168,184,199,209],{"__ignoreMap":119},[123,124,127],"span",{"class":125,"line":126},"line",1,[123,128,130],{"class":129},"sVt8B","POST https:\u002F\u002Fwww.uid-wse.admin.ch\u002FV5.0\u002FPublicServices.svc\n",[123,132,134],{"class":125,"line":133},2,[123,135,136],{"class":129},"SOAPAction: \"http:\u002F\u002Fwww.uid.admin.ch\u002Fxmlns\u002Fuid-wse\u002FIPublicServices\u002FGetByUID\"\n",[123,138,140],{"class":125,"line":139},3,[123,141,143],{"emptyLinePlaceholder":142},true,"\n",[123,145,147,150,154],{"class":125,"line":146},4,[123,148,149],{"class":129},"\u003C",[123,151,153],{"class":152},"s7hpK","uid:GetByUID",[123,155,156],{"class":129},">\n",[123,158,160,163,166],{"class":125,"line":159},5,[123,161,162],{"class":129},"  \u003C",[123,164,165],{"class":152},"uid:uid",[123,167,156],{"class":129},[123,169,171,174,177,180,182],{"class":125,"line":170},6,[123,172,173],{"class":129},"    \u003C",[123,175,176],{"class":152},"ech:uidOrganisationIdCategorie",[123,178,179],{"class":129},">CHE\u003C\u002F",[123,181,176],{"class":152},[123,183,156],{"class":129},[123,185,187,189,192,195,197],{"class":125,"line":186},7,[123,188,173],{"class":129},[123,190,191],{"class":152},"ech:uidOrganisationId",[123,193,194],{"class":129},">353272857\u003C\u002F",[123,196,191],{"class":152},[123,198,156],{"class":129},[123,200,202,205,207],{"class":125,"line":201},8,[123,203,204],{"class":129},"  \u003C\u002F",[123,206,165],{"class":152},[123,208,156],{"class":129},[123,210,212,215,217],{"class":125,"line":211},9,[123,213,214],{"class":129},"\u003C\u002F",[123,216,153],{"class":152},[123,218,156],{"class":129},[15,220,221],{},"The response contains name, legal form, address and status. The status values 3 (definitive)\nand 4 (being changed) count as active; 5 and 6 mean deleted, 7 cancelled. If the organisation is\nmissing from the response, the number is not in the register.",[24,223,225],{"id":224},"uid-register-or-zefix","UID register or Zefix?",[15,227,228,229,233],{},"Zefix is the central business name index of the commercial register. It only lists companies with\na commercial register entry, but with purpose, capital and the publications in the Swiss Official\nGazette of Commerce. For the question \"Does this UID exist, and is the company active?\" the UID\nregister is the better source: it knows more companies and can be queried without credentials.\nThe Zefix interface needs an account. How it works is explained in the guide on the\n",[32,230,232],{"href":231},"\u002Fen\u002Fratgeber\u002Fzefix-api\u002F","Zefix API",".",[24,235,237],{"id":236},"what-goes-wrong-in-a-shop","What goes wrong in a shop",[15,239,240],{},"Without a check, the shop collects numbers nobody can use later:",[50,242,243,246,249,252,255],{},[53,244,245],{},"typos and swapped digits that only show up at invoicing or in the dunning run",[53,247,248],{},"the same company several times, because the UID was stored once with dots and once without",[53,250,251],{},"invoice orders from companies deleted from the register long ago",[53,253,254],{},"plugins for the EU VAT number that validate through the EU's VIES system: VIES does not know\nthe Swiss UID, so the check goes nowhere",[53,256,257],{},"a register outage that blocks the whole checkout although the number is correct",[15,259,260],{},"A good check therefore validates format and check digit immediately in the shop, asks the\nregister only after that, caches the answer for a while and lets a number with a correct check\ndigit through when the register does not respond.",[24,262,264],{"id":263},"guide-set-up-the-uid-check-in-the-woocommerce-checkout","Guide: set up the UID check in the WooCommerce checkout",[15,266,267,268,273],{},"That is exactly what my free plugin \"Strainovic UID Check Schweiz\" from the\n",[32,269,272],{"href":270,"rel":271},"https:\u002F\u002Fwordpress.org\u002Fplugins\u002Fstrainovic-uid-check-schweiz\u002F",[36],"WordPress plugin directory"," does:",[76,275,276,279,282,297],{},[53,277,278],{},"In the WordPress admin, under \"Plugins → Add New\", search for \"Strainovic UID Check Schweiz\"\nand install it.",[53,280,281],{},"Activate it. The \"UID\" field appears in the WooCommerce checkout on its own, in the contact\nsection of the Checkout block, after the company name in the classic checkout. It is optional\nand validated as soon as it is filled in.",[53,283,284,285,288,289,292,293,296],{},"For Contact Form 7, add a text field named ",[109,286,287],{},"uid"," to the form, for example ",[109,290,291],{},"[text uid]",", or\n",[109,294,295],{},"[text* uid]"," for a required field.",[53,298,299],{},"Test it: with CHE-123.456.789 the form reports an invalid number, with a deleted company a\nrejection, with an active company the order goes through.",[15,301,302],{},"The plugin needs no account and no key. Only the nine digits go to the register, from the shop's\nserver, never the customer's name or address. Each answer is cached for one day, so the same\nnumber is looked up at most once a day.",[24,304,306],{"id":305},"check-result-in-bexio","Check result in bexio",[15,308,309,310,314],{},"If you manage your customers in bexio, you usually need the result there. The\n",[32,311,313],{"href":312},"\u002Fen\u002Fuid-check\u002F","UID Check for bexio"," version queries the register on every order, stores the\nresult with a timestamp on the order and creates the contact and a check note in bexio.",[15,316,317],{},[32,318,320],{"href":319},"\u002Fen\u002Fratgeber\u002F","All guides",[322,323,324],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s7hpK, html code.shiki .s7hpK{--shiki-default:#B31D28;--shiki-default-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":119,"searchDepth":133,"depth":133,"links":326},[327,328,329,330,331,332,333,334],{"id":26,"depth":133,"text":27},{"id":44,"depth":133,"text":45},{"id":70,"depth":133,"text":71},{"id":95,"depth":133,"text":96},{"id":224,"depth":133,"text":225},{"id":236,"depth":133,"text":237},{"id":263,"depth":133,"text":264},{"id":305,"depth":133,"text":306},"Validate a Swiss UID number: format CHE-123.456.789, modulo 11 check digit, lookup in the federal UID register and how it differs from Zefix. With a guide for the WooCommerce checkout.","md",{},"\u002Fratgeber\u002Fuid-nummer-pruefen",null,{"title":5,"description":335},"ratgeber\u002Fuid-nummer-pruefen","D7ezaaVOR26aXkMBkjCILw1cUAUHPwZ7siTgLDRRc2w",1791118316417]