212015Feb

Solved : Woocommerce Paypal Support For INR

Gateway Disabled: PayPal does not support your store currency.

When we change the currency to INR as store currency in Woocommerce settings then it will result in an error on woocommerce paypal page like this.

Paypal Error

Reason
The reason is quite simple because Paypal does not support Indian Currency and you can check in list of supported currencies by paypal.

Solution(Updated)


The solution is also quite simple. To remove this error add the following code snippet in theme functions.php.

After adding INR go to paypal setting page in woocommerce plugin and you will see error is gone.

So are we done with it ????????? NO.

The Real Thing
We have just modified the woocommerce plugin to remove the error from paypal setting page. Paypal still does not support Indian Currency and we can’t also make paypal to support Indian Currency. In simple words Your online store support INR and payapl doesn’t.. The Hook Is We have to convert currency before redirecting to paypal. To do this got to your theme’s function.php file and add the below code.

Check How To Open Contact Form 7 in Pop Up in WordPress

The Logic

  • First we are getting all Paypal arguments before redirecting to Paypal by using “woocommerce_paypal_args” hook.
  • After that we are fetching current INR Rate In USD using Yahoo API.
  • After getting conversion rate we are modifying the Paypal Arguments according to USD value.
  • Now all done and returning.

Note – After redirecting to paypal, customer will see all the prices in USD not in INR.


  • PHbox

    Hi, thanks for you help, works fine for me, (I use it to my web that use Colombian Pesos) ,

    For the first step, I prefer use this code in function.php

    add_filter( ‘woocommerce_paypal_supported_currencies’, ‘add_aed_paypal_valid_currency’ );
    function add_aed_paypal_valid_currency( $currencies ) {
    array_push ( $currencies , ‘XXX’ ); /* YOUR CURRENCY */
    return $currencies;
    }

    Because if you or your customer update the woocommerce, this change disappears.

    Regards

    • Glad it worked for you. Ya I missed that so I’ll update on this. Thanks :)

  • gobi

    after your code the currency value is not converted into payupal.i mentioned as 200 INR .but when i click proceed to checkout .in paypal pal the price values displays 0 .why its not converting price values.

    • Please give me the link where you have implement this or give me the code snippet so that I can help. In my case it is working perfectly.

      • derek

        HI there, I have the same error with R0 value using ZAR ? please. could you help me?

        • I have checked and it is working perfectly on your website.

  • Malco1987

    Hi i am trying to attempt this however i cannot find “plugin/woocommerce/classes/gateways/paypal/class-wc-gateway-paypal.php” i go to editor then select WooCommerce am i doing the right thing

    • Hi Malco, as suggested in one of comment you can use the following code instead of above first step..

      add_filter( ‘woocommerce_paypal_supported_currencies’, ‘add_paypal_valid_currency’ );
      function add_paypal_valid_currency( $currencies ) {
      array_push ( $currencies , ‘XXX’ ); /* YOUR CURRENCY */
      return $currencies;
      }

      • Malco1987

        Hi thanks for the quick reply… ok i used that code and i now have access to paypal setting in woocommerce i am now trying to implement you code in step 2 however once i paste youe code into the functions.php file and try to checkout it redirects me to PayPals home page any thoughts?

        • Malco, I didn’t get your point what you are saying…we want to to redirect to Paypal page so what’s the big deal in it ? Is there anything else you found unexpected ?

          • Rico11

            hello I have same problem, after place an order it redirect to Paypal Home page, not the paypal payment page. any solution for this problem? Thanks

        • Rico11

          Hei, I got the solution, its on this Line :
          add_filter(‘woocommerce_paypal_args’, ‘woocommerce_paypal_args_for_inr’)

          Do not change the ‘inr’ to any currency code, It seems inr on that line didn’t mean Indian Rupe

  • Vishal

    Thanks Sahil,

    FYi, in new woocommerce

    they have changed “classes” – plugin/woocommerce/classes/gateways/paypal/class-wc-gateway-paypal.php

    to “includes”

    plugin/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php

  • rashmi

    Thanks for the code..Worked for me..

  • Vicky Media

    Hello,

    Greate Code Its working perfectly. Accept once it redirects form Paypal to website and in Admin Panel when I receive Order I only find instead of Rs. or USD I get ? i.e. instead of currency Symbol I get ?

    • Hi Vicky,

      Need to check . Don’t have any information on this.

  • tecaclon

    It works like a charm. Thank you!

  • Smart Dev 2004

    Not working at ALL

    WooCommerce 2.10.4, change there directory structure and update there framework
    Any one help in add Paypal Currency Conversion in WooCommerce 2.10.4
    Use third-party free API like OpenExchange or Google Finance exchange rate API

    Update your tutorial with latest Woocommerce version
    Post New tutorial with solutions…

    • Hi Smart Dev,

      Can you please check now as I have updated the hook.

  • Ramakrishna

    Hi, I use WC-Vendors plugin and I need to configure Woocommercfe Adaptive Payments, The above worked for Paypal, What about adaptive payments? Can you also pass me this code, I think only few modifications are needed to enable India with WC Vendors Woocommerce Paypal Adptive Payments

  • Amritanshu Kalia

    Hey thanks for the code seems to work perfectly. But doesn’t work when Aelia currency switcher is activated… Any idea?? I’ll be really gratefull

    • Hi Amrit,

      No idea on this but one possible reason I think this plugin doesn’t support Indian currency.It supports only currencies supported by paypal so you have to make this plugin support Indian currency.

      • Amritanshu Kalia

        if i set the INR as the base currency for woocommerce store , then everything works fine for INR but for other currencies it gets stuck and vice versa. So i tried other plugin i.e woocommerce cuurecy switcher by realmag. And your method work fine with that plugin. Thanks a lot for replying

        • Great !!

        • So Amrit, you used the code to define INR, and also one to convert value and then added switcher?

          • Amritanshu Kalia

            hey Mohit!

            I used currency switcher just like we normally do on the site.. used the above code in functions.php
            Incase the currency selected is INR above role of above code comes into play!!

          • I think I framed the question incorrectly. When I was googling for solutions, someone said that only the first code is fine if you are using currency switcher. My question was did you use both the codes or only the one to define the INR?

          • Amritanshu Kalia

            hey there , i did use both the codes.
            First one adds the support of INR to the paypal , means if you don’t use the first code and the selected currency is INR , then paypal gateway will remain disabled on checkout page.
            and second code does the trick of converting INR to the USD

          • Thanks, tried it, it worked. 2 codes + currency switcher. One catch, it fails if I enable the address Geolocate in either Woocommerce or Currency switcher. Gives an error on Paypal.
            Disabling that helps.

  • Sur

    Hi, thank you very much. It worked!
    I would like to ask one thing. Is there a way we can also charge foreign exchange costs? For example, say I want to charge a 3% forex surcharge. The cart price is Rs. 1,000. But I want to charge the customer Rs. 1,030 if he chooses to use PayPal and pay in USD. Is this somehow possible?

    • Hi Sur,
      As you can see we have $paypal_args[‘tax_cart’] in the method we used for manipulating price so there you can use your logic for exchange costs :)

    • Pochampally

      Hi Sur, we facing the same issue, how to solve the issue… kindly reply plz with code…

  • Rahul

    hi,
    It works great

  • Neeraj

    Hi,

    Thanks a lot for this code. It worked for me! However, if a user puts a discount code, the conversion is still for the original price when he/she lands on paypal. Is there some way to resolve this??

    • try fetching discount value from $paypal_args array and convert it into required currency.

      • Shobhit Bansal

        please elaborate or if possible please add this function in the code.

        • what you want exactly ?

          try printing print_r($paypal_args)..it will give all payment data and you can manipulate as you want.

  • Pochampally

    Hi, Thank for above code. we added the code working fine. now we want
    to add instead of http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s
    some fixed value Rupees ( 64.50) instead of fetching from finance yahoo. why becoz
    Example: today yahoo exchange price 1usd =67.05 based this its ok.
    but bank echange rate; 64.50
    so i want to mention directly without using YAHOO Finance, we want to keep 64.50, where to change in code. kindly help above issue

    • Replace
      $convert_rate = getFromYahoo();
      to
      $convert_rate = 64.50;

      • Pochampally

        Thanks a Lot for your quick reply. code working fine as per our requirement. we are really happy…

  • Pochampally

    We have another issue. that is Paypal users who are making payment in USD papal will charge
    4.4 % we want add 4.4% extra charge to customer how do add this

  • Pochampally

    Thanks a lot for this code. Coming to coupon code discount if a customer apply for discount code, the conversion is still for the original price. when customer lands on paypal. Is thereway to resolve this issue Example: Rs. 500 flat discount

  • Purva Bathe

    Hello, Thanks for the code i used it on my web site. Code removing the error and after selecting paypal as payment method i am redirecting for making payment but when fill all details and click pay it is showing me error that “please select another payment method or try to contact your merchant”.

  • vipul

    Hi. I am a complete newbie to this. Can you please let me know exactly where should I be putting each of these code snippets?
    Thanks

    • Go to your theme function.php and add all code there

  • Liccchi

    Thanks for the code. I added it on my website but it is showing me the error.

    Error: code=AMOUNT_ERROR

    How to resolve it

  • Note – After redirecting to paypal, customer will see all the prices in USD not in INR.

    We can’t we change this

  • Asansol Durgapur Cake

    https://uploads.disquscdn.com/images/dd2d08e66698e99041faf490d7d12e5f2bd69b74813a72277b377874e5205a93.png
    Dear Sahil Sir
    on Paypal order summary Page its Still INR ..I Want it to be USD Please help

    PFA

  • Mohamed Yusoof

    https://uploads.disquscdn.com/images/07cdf0707ea6ae5977e505948872d48ab0b169526aad9cf9fc98772f5b4abd93.jpg
    i tried this code, working
    but finally receiving error in paypal checkout page “Things don’t appear to be working at the moment. Please try again later.”

    how to solve this,