AFAIK you're only required to give these details when your total bill exceeds a certain amount (~50,000?) and it's largely because buying gold/jewelry is a vector of money laundering and tax avoidance. I don't buy jewelry but ran into this recently when my mother wanted some.
So if you're a tourist you can't buy anything? Weird.
Spain has a similar thing for this, you have to give your NIE/DNIe number everywhere. Like when ordering something online. But not in brick and mortar shops.
Still I find it a very poor practice in terms of privacy.
Buying stuff through QR codes is very common in India now. You can pay for everything from groceries to street food using QR codes. It runs off the government-sponsored UPI standard. However, AFAIK you need an Indian bank account to be able to participate. It's quite a pain coming from abroad, and I just used cash instead. That does mean I have am prone to paying foreign withdrawal fees, but alas. It does work pretty well for the people of India though.