Sneaky
New Coder
I am just learning the ropes of Square API. I am currently using google pay api and then sending the token to the backend using square API. I am a bit lost on the topic of applying tax correctly. I am from Canada. From my current understanding, I only charge tax on canadian buyers (and also based on their province), else I don't charge tax. (I don't have a nexus in US)
Now to figure out which province they are from, I believe I need to get it from the google token, but I can't figure out how. I think I can get it from client side and I guess I could send it to server, but you can't trust anything sent from the client side unless its cryptographically signed like the google token from google pay. So I was thinking to decode it and get the billing address from there, but I can't figure out how. I also read you are not supposed to decode the token from google pay, just pass it on to square api. But then how would you reliably know the users province to know how much to tax them? Does anyone have any advice for this?
Now to figure out which province they are from, I believe I need to get it from the google token, but I can't figure out how. I think I can get it from client side and I guess I could send it to server, but you can't trust anything sent from the client side unless its cryptographically signed like the google token from google pay. So I was thinking to decode it and get the billing address from there, but I can't figure out how. I also read you are not supposed to decode the token from google pay, just pass it on to square api. But then how would you reliably know the users province to know how much to tax them? Does anyone have any advice for this?