根据用户位置检测货币?
我正在创建一个用户可以订阅的国际网络应用程序。我希望订阅费率根据用户的货币而变化。如果我的用户在美国,他们每月支付 19 美元;如果在中国,他们会支付其他费用。因此,我认为我可以检测用户的位置,并且从他们的位置,我可以检测他们的货币(通过数据库中的位置到货币映射表)。如果我无法检测到他们的货币,那么我会强制他们在显示订阅费率之前输入货币。
这看起来是一个可以接受的解决方案吗?这会很可靠吗?如果没有,谁能想到更好的解决方案?
I am creating an international web application which users can subscribe to. I want subscription rates to vary based on the user's currency. If my user is in the US, they pay $19/month; if in China, they pay some other rate. So, I am thinking I could detect the user's location, and from their location, I can detect their currency (via a location to currency map table in my database). If I can't detect their currency, then I'll force them to enter it before displaying subscription rates.
Does this seem like an acceptable solution? Will this be pretty reliable? If not, can anyone think of a better solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来不错。地理位置非常可靠,从国家到货币的映射应该很容易。不过,我不知道这样的映射是否已经在某个地方可用。
只需确保您允许用户更改货币,以防检测失败。或者他们碰巧在国外时尝试订阅,或者其他什么。
Seems good. Geolocation is pretty reliable, and the mapping from countries to currencies should be easy. I don't know whether such a mapping is already available somewhere, though.
Just make sure that you allow users to change the currency, in case your detection fails. Or they're trying to subscribe while they happen to be abroad, or something.
如何获取用户的位置可能会有所帮助
how to get the location of a user might be helpful