DavidAJohn / PhotoPortfolio

Personal photo portfolio .NET web application which implements a Blazor and Tailwind CSS user interface with a MongoDb database, and includes integration with Stripe Checkout and Prodigi Print API
0 stars 0 forks source link

Hard-coded GBP currency #58

Open DavidAJohn opened 11 months ago

DavidAJohn commented 11 months ago

At this point, the application has a number of hard-coded references to the currency as GBP. This is primarily because I live in the UK and it made things simpler for me during development.

This would obviously need to be addressed for the application to be suitable for real-world use.

I don't have any concrete views on how this should be implemented at the moment, but I wanted to have an issue listed here so that it doesn't get forgotten.

Fortunately, it's possible to get a definitive list of countries to which a particular product can be shipped by Prodigi. So there needs to be a system within the application that makes this clear to the customer and to the admin when they set up products.

Stripe Checkout supports currency specification and the limiting of shipping address by country code(s).

So the third-party tools are available to implement this, it's just a matter of working out the process. I'll add salient issues to bear in mind in further comments.

To start with: do we suggest a currency to the customer based on geolocation? Do we allow them to change it? How?

DavidAJohn commented 11 months ago

IPData has a free tier for non-commercial use that I could try out: https://ipdata.co/

And they have a .net library: https://docs.ipdata.co/docs/net

For commercial use, it would cost a minimum of $10/month (or $96/year).

That would allow us to do a geo-location check to retrieve country code, currency code, and a little flag icon.

Perhaps we could do this for each customer when they hit the PhotoDetails page for the first time (or more precisely, when they request a quote), then we can store it in a cookie or local storage to use on subsequent visits.

There are other options: https://ipdata.co/blog/best-ip-geolocation-services/