ZeroAquaduct Posted January 2, 2003 Share Posted January 2, 2003 I have USD as my default currency and JPY (Japanese Yen) as one of my other accepted currencies. This works perfectly if I select money order as my payment method, but it'll fail if I select PayPal (PayPal will return an error message). I know what the problem is -- the shopping cart is sending an amount with 2 decimals places to PayPal, although I have 0 decimal places configured under "currencies" in my admin. For example, it says ¥800 in my checkout, but when the checkout sends info to PayPal, it'll send ¥800.99, or whatever the cents turn out to be. This will not work with PayPal because JPY doesn't have cents. I have the Nov. 20 snapshot installed along with the PayPal IPN .96 contribution. Is there anyway I could keep USD as my default currency, but have the checkout send a 0 decimal place JPY amount to PayPal? I don't want to have my default currency in JPY, although this will solve the problem. TIA. Quote Link to comment Share on other sites More sharing options...
ZeroAquaduct Posted January 2, 2003 Author Share Posted January 2, 2003 For example, it says ¥800 in my checkout, but when the checkout sends info to PayPal, it'll send ¥800.99, or whatever the cents turn out to be. This will not work with PayPal because JPY doesn't have cents. Sorry, the Yen sign didn't show up. It should say: For example, it says Y800 in my checkout, but when the checkout sends info to PayPal, it'll send Y800.99, or whatever the cents turn out to be. This will not work with PayPal because JPY doesn't have cents. Quote Link to comment Share on other sites More sharing options...
Ian-San Posted January 2, 2003 Share Posted January 2, 2003 I also send yen with 2 decimal places and have not noticed any problems. It could be because the payment always has .00 as decimals as the default currency is yen. However, if I send GBP or USD with 0 decimal places, PayPal just rounds it up so you would think it could manage this simple problem. Anyway, if you have the post-nov version, you should be able to use this function to sort out the problem: tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . I am not using this as I have pre-nov but it looks like it should work. If it doesnt, it could be that you have not set the decimals for your currency correctly. Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
ZeroAquaduct Posted January 2, 2003 Author Share Posted January 2, 2003 Thanks for the reply Ian. I'm using the PayPay IPN contribution, so I don't use the stock PayPal payment module that came with osCommerce. However, I used your code as a reference and looked at checkout_paypalipn.php; I realize that it has "2" in the code that processes the payment info (meaning "2 decimal places"). If I changed this to "0," the JPY will work, but now every currency will have 0 decimal places. I added your "$currencies->get_decimal_places($my_currency)" code, but it returns an error, saying that the "get_decimal_places()" function is undefined. How can I add this definition into my file? The checkout_paypalipn.php is similar to checkout_process.php under the "// load the before_process function from the payment modules" area. TIA. Quote Link to comment Share on other sites More sharing options...
Ian-San Posted January 3, 2003 Share Posted January 3, 2003 It is part of the currencies.php class module in the new checkout. I dont know if it will work in older snapshots but you can try to add it in with the other functions shown at the end of this class module: function get_value($code) { return $this->currencies[$code]['value']; } function get_decimal_places($code) { return $this->currencies[$code]['decimal_places']; } function display_price($products_price, $products_tax, $quantity = 1) { return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); } } ?> Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
ZeroAquaduct Posted January 3, 2003 Author Share Posted January 3, 2003 Thanks again for the reply, Ian. I put the codes in and everything is up and running now. :thumbsup: Quote Link to comment Share on other sites More sharing options...
Ian-San Posted January 3, 2003 Share Posted January 3, 2003 Great - actually I just added this code myself - to make sure that I do not get the same problem as you - and it seems to test out okay. Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.