WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Sending a Paypal-accepted currency amount in Bakery
  • Print
Pages: [1]   Go Down

Author Topic: Sending a Paypal-accepted currency amount in Bakery  (Read 5255 times)

Offline svsanchez

  • Posts: 589
Sending a Paypal-accepted currency amount in Bakery
« on: May 21, 2013, 07:48:04 PM »
Hello community, I think this one could be a little hard:

I have a customer who is creating his Bakery shop and he uses the local currency (Guatemalan Quetzal). He will accept Paypal (which doesn't accept Quetzals) and also Advance Payment and Invoice Payment. He wants to show his prices in Guatemalan Quetzals by default, and ONLY use US Dollars if the user selects to pay by Paypal. Is it possible to convert the amount that Bakery will send to Paypal from the local currency to USD at the checkout?

I didn't tell him this wasn't possible as this little software always has something new to amaze me.
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Sending a Paypal-accepted currency amount in Bakery
« Reply #1 on: May 21, 2013, 10:32:12 PM »
In the file /modules/bakery/payment_methods/paypal/processor.php you can find these two lines:
Code: (original) [Select]
'currency_code' => $setting_shop_currency,
'amount'        => $_SESSION['bakery']['order_total'],

You can overrule the currency code to "USD" and fill the amount with a calculated USD price.
Something like:
Code: (untested) [Select]
'currency_code' => 'USD',
'amount'        => round ($_SESSION['bakery']['order_total'] / 7.85 , 2),

This way it will never show USD in the website, only the transaction data sent to PayPal will be in USD
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline svsanchez

  • Posts: 589
Re: Sending a Paypal-accepted currency amount in Bakery
« Reply #2 on: May 22, 2013, 06:27:44 AM »
Yes! It worked perfectly! One last question, in this solution the exchange rate is written in the code, is there a way to call the exchange rate somehow so that the site administrator doesn't have to mess with the code?
Logged

Offline hillschmidt

  • Posts: 388
Re: Sending a Paypal-accepted currency amount in Bakery
« Reply #3 on: May 22, 2013, 10:40:07 AM »
a starting point: http://www.white-hat-web-design.co.uk/blog/php-currency-conversion-exchange-rates-xml/

Just to give an idea what's possible!
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Sending a Paypal-accepted currency amount in Bakery
« Reply #4 on: May 22, 2013, 11:15:00 AM »
Quote from: hillschmidt on May 22, 2013, 10:40:07 AM
Just to give an idea what's possible!
It might be hard to find a public/free feed with the GTQ exchangerate.

Alternative (a bit dirty solution) you could place a small file (i.e. in the media folder) that holds the current rate.

Upload in your /media folder a file called "rate.txt" with the content 7.85 (so just the current rate, nothing else..)

Somewhere just before creating the array with data to send
Code: (untested) [Select]
$rate = floatval(file_get_contents(WB_PATH.MEDIA_DIRECTORY'./rate.txt'));and next calculate the rate like:
Code: (untested) [Select]
'amount'        => round($_SESSION['bakery']['order_total'] / $rate , 2),
The tricky part is that there may never be any error in the "rate.txt" file, or the payment will crash or use a wrong amount.
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Sending a Paypal-accepted currency amount in Bakery
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2