I wanted to use the similar logic or algorithm tally uses to verify if the GST number entered by the user is right or wrong? Do they have a backend or database or anything like that? How do they verify the gst number entered by the user? In Tally ERP9.
I found a link but not much is mentioned. Is it there owned algorithm that's confidential? https://blogs.tallysolutions.com/detect-wrong-gstins-and-file-your-gst-returns-correctly/#:~:text=the%20GST%20law.-,Tally.,a%20ledger%20of%20a%20party.
There is no algorithm. To ensure that the GSTIN exists and corresponds to a company/proprietor you need to get access to the NIC servers, which isn't possible if you are not a GSP (GST Suvidha Provider).
What you can do is use Regex & other logic to verify the structure is correct. Have a look at this - https://blogs.tallysolutions.com/structure-of-your-gstin/
Further I would google 'PAN' structure. Then Combine the regex & some logic to get a clever pattern
Note: Verifying structure does not mean such a GSTIN actually exists.