0

In a Prestashop 1.6 based store I want to accept payments via Paypal in only one currency (Euros). However, I want to show prices in other currencies based on the location of the customer (probably using it's IP address?). How can I do that?

notGeek
  • 1,394
  • 5
  • 21
  • 40
  • What I know is how to show prices in other currencies based on the location of the customer using his/her IP. But I don't know how to implement the functionality to accept payments via Paypal in only one currency. If interested please contact. – Nimish Jul 07 '17 at 12:26
  • Can you please explain how you do the first part @Nimish? – notGeek Jul 07 '17 at 14:10

2 Answers2

0

In Modules and services > payment you have a tab CURRENCY RESTRICTIONS, you can check in which currency you would like Paypal to be available

For currecy selection by IP: First, you should get the user IP after, you should set the curency of the Prestashop context

$this->context->currency->id = $id_currency

To get $id_currency, follow this steps

  • You should get the country of the the user IP with this script
  • Then get the currency code by country code (you can get if from a csv file or you you should use an API or database)
tarek fellah
  • 365
  • 1
  • 10
  • 32
  • Regarding currency restrictions, I want PayPal to be available to all users but even when the price is presented in another currency to the user on the procust page I want the payment to be processed in Euros through PayPal. Regarding the geolocation, I think Prestashop already has support for this. Am I worng? – notGeek Jul 09 '17 at 01:23
  • @notGeek for Paypal you should change unto the module code, "but even when the price is presented in another currency to the user" what do you mean? – tarek fellah Jul 09 '17 at 09:45
  • What I mean is: the price need to be shown in customer currency but when he pays, I want the payment to be processed always in Euros. – notGeek Jul 09 '17 at 22:37
  • 1
    @notGeek I think you should create a new override for PaymentModuleClass and override the validateOrder method and you have just to change id_currency there on line 181 Change $id_currency = $currency_special ? (int)$currency_special : (int)$this->context->cart->id_currency; to $id_currency = '$id_euro_currency'; – tarek fellah Jul 10 '17 at 04:07
-1

The free IP Find service provides currency information in the response for any given IP Address.

Eg. http://ipfind.co?ip=8.8.8.8

Will return (among other things)

currency: USD

JordanC
  • 4,339
  • 1
  • 22
  • 16