Ask A Question

Notifications

You’re not receiving notifications from this thread.

Dynamic Pricing based on user country

Enrique Benitez asked in General

Hello!

I'm thinking of a way to handle dynamic pricing on my web app based on the user country, for example:

A user wants to subscribe for a pro account on my website and this user is based outside the US so that user don't need to pay VAT... So the price for the subscription to my site changes for those users.

How can I handle this more effectively? I was thinking that it's all about the user ip address and then use ruby geocoder.

Thanks! :)

Reply

Hey Enrique,

You could definitely geocode their IP in order to get their country. That would probably be the most accurate version of this. Alternatively you could ask the user to fill out their country as part of the sign up process or something in order to record that without doing geocoding. The geocoding approach will look a lot more seamless on the UI side of things though, so I'd probably recommend that route.

Another option I just thought of could be taking the locale from the browser and using that to determine the country: http://stackoverflow.com/questions/7113736/detect-browser-language-in-rails I'm not sure how well this would work as the geocoded IPs would definitely be more accurate.

Reply

Yeah I'm going to use the Geocoder gem as well as the built-in ip getter from Devise to accomplish that.

Thanks, Chris!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.