I'm testing out MultiPrice for a client that wants controllable Euro pricing as well as GBP for their store. However when enabling the module I am unable even to check out using the default currency and country - getting the "The link you have used to enter the PayPal system contains an incorrectly formatted item amount." message from Paypal Website Payment standard.

The same error message happens if I change to a country, price and currency altered via Multiprice, and I had a go at making the changes in 512186 - with the same result.

Any ideas?

CommentFileSizeAuthor
#40 621424.patch3.24 KBstella
#38 621424.patch1.18 KBstella
#34 uc_paypal.module.zip11.2 KBhixster
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Docc’s picture

Ill check it out when i get the change. Probably a small bug in the formatting

jamesfk’s picture

Thanks Docc, otherwise all the correct values are being displayed on product pages, shopping cart and payment page - just breaks when the paypal link is clicked...

jamesfk’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Docc’s picture

James

Paypal works for me out of the box. Do you have more info for me? ubercart version, wich amount you checking out? and wich currency, and paypal payment settings etc

jamesfk’s picture

Hi Docc,

Thanks for getting back - Ubercart is an unmodified 6.x-2.0, Multiprice is the latest 2.x-dev - default currency and country is GBP / UK - paypal set to the same for website payments standard. Multiprice is configured with one extra Country, France with the currency set to EUR and the euro symbol set up. As soon as multiprice is enabled, any purchases in the default GBP currency fail - as well as EUR ones (which I'd expect until paypal payment is patched).

Any ideas? Happy to give you the demo site address if that would help?

Docc’s picture

yeah link to demo site would help

Docc’s picture

k if you look at the form code on your checkout review. You see that the amount is styled with currency like "£252.16" ex. <input type="hidden" name="amount_1" id="edit-amount-1" value="£252.16" />

Though it shouldnt have a currency, should just be the amount like "252.16" ex <input type="hidden" name="amount_1" id="edit-amount-1" value="252.16" />

Probaply one of the modules using the price handler wrong. Try to disable all other handlers (like VAT) and see if that clears it up

jamesfk’s picture

Hi Docc,

Will do - strange thing it that it only happens once MP is enabled. Will knock some off and let you know - thanks for looking :)

tjb74’s picture

Getting the same error. I have a multiple currency Paypal account, but get "The link you have used to enter the PayPal system contains an incorrectly formatted item amount." when using multiprice. Is this an issue with uc_multiprice or with the Paypal module? I tried to use the hack on the Paypal module without any success either. Any progress on this issue?
Thanks

tjb74’s picture

I made the changes to the paypal module as such

// default currency selection
  $currency = variable_get('uc_paypal_wps_currency', 'USD');

// uc_multiprice module support
if (module_exists('uc_multiprice')) {
  $country_id = uc_multiprice_country_id();
  $result = db_query("SELECT iso2 FROM {countries_api_countries} WHERE numcode = %d", $country_id);
  $iso2 = db_fetch_object($result)->iso2;
  switch ($iso2) {
    case 'CA':
      $currency = 'CAD';
      break;
    case 'US':
    default:
      $currency = 'USD';
      break;
  }
}

comment out the following line:

'currency_code' => variable_get('uc_paypal_wps_currency', 'USD'),

and add the following immediately after:

'currency_code' => $currency,

I see that the currency symbol is being sent with the amount to paypal which, as is said above, is not the right format. By disabling multiprice module the right format is sent to Paypal, and I need to use the VAT modules so can't disable them, so where is the currency symbol coming from and how can is it be modified to either not include it or pick up the price like when the multiprice module is not enabled? Any ideas? Thanks.

tjb74’s picture

My Paypal modules changes look like this... My default currency is GB pounds and I want to show prices in Pounds, Euros and US$... By changing the paypal code below I have now got Euros and USD working but no the default £, which I think is the original in this issue. The default currency is carrying the symbol with it...

// default currency selection
$currency = variable_get('uc_paypal_wps_currency', 'GBP');

// uc_multiprice module support
if (module_exists('uc_multiprice')) {
$country_id = uc_multiprice_country_id();
$result = db_query("SELECT iso2 FROM {countries_api_countries} WHERE numcode = %d", $country_id);
$iso2 = db_fetch_object($result)->iso2;
switch ($iso2) {
case 'FR':
$currency = 'EUR';
break;
case 'US':
$currency = 'USD';
break;
case 'GB':
default:
$currency = 'GBP';
break;
}
}

Not sure how to get the default to work... ?

Also, its going to be a lot of hard work to add countries (have to add to the paypal module as well as countries in Ubercart). I would like to have the prices shown in Euros for Euro zone countries without having to add every country and go back and edit a price for France, Spain, Italy, Austria, Ireland, etc. Just need prices selection in USD, GBP or EUR and the IP selector show USD for USA or Euros for a Eurozone country.... and an option to show and or select default price (GBP) for any other country such as Norway or New Zealand.

Docc’s picture

Should be the multiprice price handler thats giving problems. Ill see if i can track it down anytime this week.

tjb74’s picture

Appreciate that... Thanks.
I am not sure if it is part of the same issue, but it seems too restricting to have to have the country listed. I think I would prefer to select the currency to pay in, and do that whatever the county you are in (I live in France but would like to pay in Pounds through a UK paypal account), but initially still have the IP look up show the country currency, so France would show Euros if Euros was a multiprice option. If the country currency was not an option it would default to the site default. I want to offer 5 price options max (GBP, EUR, CHF, US, CAD) but want to sell worldwide to nearly every country.

Docc’s picture

tjbcham, think youre better of with the multicurrency module. Did you tried that module yet?
this module is all about different prices based on the country.

tjb74’s picture

Thanks for the suggestion, the other module seems not ot be ready with not even a dev update since July. I tried it and it didn't work, so I switched o trying this one. Multicurrency is probably more for when you are actually only selling in one currency, but want people to see what they are paying for in their currency, I am happy to accept € or £ or $ so can show the prices - also my suppliers want me showing different prices in each market in the market currency... Once I sort the the Paypal issue I will run with this module.

tjb74’s picture

By changing all the formats to use 3 characters and not the symbol works fine in PAYPAL, as paypal accepts 225.00EUR but not 225.00€. However when multiprice is disabled the checkout form is sent as just 225.00 whether symbols are used or Characters used, so this module is not stripping off the € or currency code. Any pointers to where that code is found?

DraconPern’s picture

Tried using uc_multiprice, against paypal sand box, but it fails. This is using Credit card and the Paypal website payment pro gateway.

I have tried €150,00 and $150,00EUR but both return an error from paypal saying the order amount is invalid. Test account's country is set to Germany. Using 'checkout with paypal' results in sandbox giving a error 500.

abubin’s picture

any fix on this yet? I am also facing similar error with multiprice.

I tried method from #10 and #11 but still getting the error.

Anyway I can output what is being send to paypal? That way I could see where it went wrong...please help.

tjb74’s picture

I actually stopped using Multiprice for the moment so didn't go any further with this. Would be good to have the option though.

abubin’s picture

then mind telling if you are implemented multi currency another way? Please teach...if this is not the right place, you can email me. abubin at gmail point com.

Thanks

Overtone’s picture

Issue tags: +module, +Ubercart, +paypal, +payments, +multicurrency, +south africa

Alternative Paypal Multiprice solution for South African Rand - ZAR Sales with Paypal USD Payments.

If you are looking for a solution for your South African online store. ( Drupal 6 and Ubercart V2 )

We have successfully launched a PayPal for South Africa module its built on the existing paypal payment modules for Ubercart but it enables the user to sell in ZAR and still use Paypal as a payment option.

The problem many Drupal users have had in South Africa is that although they can now create and use Paypal for their online payments and sales.. Paypal does not yet offer South African Rand (ZAR) as a Paypal Currency.

This means that the store will need to sell products in USD or some other accepted curency .. or use the multi-currency type module.. (which is a little difficult to get going - requires the user to register etc.. )..

The more desirable option is to offer your products for South Africa in ZAR and then if the user selects the Paypal option then to convert the total order amount to USD and make the payment in USD before being returned to the store etc.

We have developed such a module.. it uses the currency module to generate the latest exchange rates from Yahoo and its working nicely.

If you would like to test it out.. please visit our web development site and test it.

Our developers can help with integration and setup if you need help.

Overtone Web Development

http://dev.overtone.co.za

abubin’s picture

thanks but your ZAR multiprice is not what I am looking for.

ericwongcm’s picture

I tried #16 above, changing the "Currency Sign:" to USD instead of USD$ but Paypal didn't accept it, still says "The link you have used to enter the PayPal system contains an incorrectly format"

The only way Paypal would accept it is if I leave the "Currency Sign:" as "$"
but I would still like to display the currency in front of the price for different countries by changing the country settings -> currency format, e.g. USD$20, instead of simply $20, unless there is another display the same information.

I would also like to allow Paypal to accept multiple currency instead of one fixed default, e.g. if the user comes from Australia, then ubercart/multiprice can pass on the currency information to Paypal and allow the user to pay by AUD instead of the USD default.

I tried to change the paypal module according to #10, #11 but can't do it correctly, not sure how.

abubin’s picture

you might want to try cck currency. It is a bit more complicated to setup than multiprice but at least it works with sending correct price and currency code to paypal.

seyi’s picture

The solution I found for this was simple. The amount_1 field can be just a number without having to be formatted to be a price with symbols. So I edited the uc_paypal.module file.

around line 971, i commented out the price and added my own

//$data['amount_'. $i] = uc_price($item->price, $context, $options);
$data['amount_'. $i] = $item->price; //seyi_code

same for line 992

//$data['amount_1'] = uc_price($order->order_total - $shipping - $tax, $context, $options);
$data['amount_1'] = $order->order_total - $shipping - $tax; //seyi_code

Works so far in all my testing

BWPanda’s picture

seyi's suggestion from #25 worked for me, but as I was using PayPal Express, I had to find and change a different line of code (same changes though - remove uc_price() function).

Docc’s picture

Assigned: Unassigned » Docc
Status: Active » Closed (cannot reproduce)

Tested it with PayPal Express Checkout and PayPal Website Payments Standard.
Cannot reproduce. Its working fine for me. Using ubercart 2.2

hixster’s picture

Not working for me either - using Paypal payments pro, getting the error :

We were unable to process your credit card payment. Please verify your card details and try again. If the problem persists, contact us to complete your order.

A closer look at the logs, shows paypal error message 10401:

Transaction refused because of an invalid argument. See additional error messages for details.
Order total is invalid.

O.k, so i've got paypal working, sort of - how do I get paypal to convert the value i submit into paypals local currency?

1) My paypal account is setup using USD
2) Ubercart / multiprice is setup with USD
3) I have 2 regions setup , US and GB(UK)
4) If I check out with a value of $29.99, - $29.99 appears in the paypal sandbox
5) If I check out with a value of £29.99 - $29.99 appears in the paypal sandbox.

How do i 'tell' paypal about the currency? There are a few 'threads' in this thread and it's not clear what the solution is.

- Do I need to use the country code as a suffix? Ie 29.99USD or 29.99GBP?
- If i do use the suffix approach, how can I have my prices in ubercart still displayed as normal, ie: £29.99

Any help on this much appreciated, so close to finishing this site, this is the only outstanding item.

hixster’s picture

Bumping - cannot checkout with paypal website payments pro if the country is different to the Currency code settings in the payment gateway settings.

I am using USD for the the Currency code in the gateway and by selecting United States as the country in the store, i can purchase products.
If i select United Kingdom as the country and checkout i get an error message and this is what is logged.

Payment failed for order 99: <b>Authorize and capture immediately failed.</b><br /><b>Error:</b> 10401: Order total is invalid.<br /><b>Address:</b> An unknown error occurred.<br /><b>CVV2:</b> Not checked

- Can someone confirm:
a) I need to set anything specifically in paypal website payments pro to accept multiple currencies.
b) This module modifies the submitted price so that the Currency code settings are ignore and the correctly formatted price is submitted to paypal
c) If I try solution #25 - how does paypal know which currency we are submitting?
d) I've tried looking at the hidden input values as suggested in post #7 http://drupal.org/node/621424#comment-2225724 , but can't see any numeric values at all.

hixster’s picture

Status: Closed (cannot reproduce) » Active

Marking a active - I've tried using express checkout as well and get the following error when trying to checkout:

The link you have used to enter the PayPal system contains an incorrectly formatted item amount.

So something is getting screwed with the default currency.

hixster’s picture

Right - I've tried using both express checkout and payment standard, and i've been looking in the cart review - my checkout currency is set like so,

<input type="hidden" name="currency_code" id="edit-currency-code" value="GBP" />

This never changes to USD, when I set the country to United States. It's seems that whatever the default currency is to in the gateway is what i set in the checkout.

hixster’s picture

After more searching an reading some other threads - i'm going to format the amounts myself for the Paypal WSPP function in the paypal module.
I'm not sure why the currency symbol is being return by uc_price, because in the $context and $options, sign is set to FALSE, but the uc_price is returning the amount WITH the symbol, hence my need to strip it off.

Whilst testing out my code to strip the currency symbol off, i have found an issue with the price that uc_price returns for the default currency.
It seems an extra garbage character is being added in front of the currency symbol? GBP is my default currency and this:

if ($currency == 'GBP') {	print 'Were in the US<br/>';$priceTrim = trim( $priceFormat, "£" );}

Should strip of the £ sign. but it doesn't.

if i try this for my other non-default currency , US - it does work

if ($currency == 'USD') {	print 'Were in the US<br/>';$priceTrim = trim( $priceFormat, "$" );}

So, then i thought, i'll just remove the first character of the string using this.

if ($currency == 'GBP') {	print 'Were in the UK<br/>'.$priceFormat.' ---';$priceTrim = substr($priceFormat, 1);}

Which still leaves the £ sign intact. In the end, i have to remove 2 character to get rid of the £ sign , which is way too random!

if ($currency == 'GBP') {	print 'Were in the UK<br/>'.$priceFormat.' ---';$priceTrim = substr($priceFormat, 2);}

Could it be that uc_multiprice creates this issue? Could this be the reason that the default currency doesn't work through paypal?

hixster’s picture

Here's more on the above post #32. This is the code i'm using to test my price , i've just put this in my node-product.tpl.php for testing purposes.
Notice my lines which strip the currency code are identical, albeit that the currency symbol changes changes appropriately.

Here is the output that this code produces..

When UK (default currency/country is selected
Were in the UK
This is the price £87.00 formatted
This is the price �87.00GBP trimmed

When US (default currency/country is selected
Were in the US
This is the price $29.99 formatted
This is the price 29.99USD trimmed

Notice the corrupt symbol in front of the trimmed price?

<?php 
			// uc_multiprice module support
			if (module_exists('uc_multiprice')) {
			  $country_id = uc_multiprice_country_id();
			  $result = db_query("SELECT iso2 FROM {countries_api_countries} WHERE numcode = %d", $country_id);
			  $iso2 = db_fetch_object($result)->iso2;
			  switch ($iso2) {
			    case 'GB':
			      $currency = 'GBP';
			      break;
			    case 'US':
			    default:
			      $currency = 'USD';
			      break;
			  }
			}

				$context = array(
				'revision' => 'formatted-original',
				'type' => 'amount',
				);
				$options = array(
				'sign' => FALSE,
				'thou' => FALSE,
				'dec' => '.',
				
				);
				
				$priceFormat = (string)uc_price($node->sell_price, $context, $options);
				if ($currency == 'GBP') {	print 'Were in the UK<br/>';$priceTrim = preg_replace("/[\£,]/","", $priceFormat);}
				if ($currency == 'USD') {	print 'Were in the US<br/>';$priceTrim = preg_replace("/[\$,]/","", $priceFormat);}
				
				print 'This is the price '.$priceFormat.' formatted<br/>';
				print 'This is the price '.$priceTrim.$currency.' trimmed<br/>';	
			?>
hixster’s picture

FileSize
11.2 KB

I've managed to get Website payments pro working with UC_Multiprice now, i'm attaching my modified version of the paypal module for reference.
NOTE: this is only modified so that payments pro works, there are no mods for express checkout of standard payments.

Depending on your default & addtional countries, you'll need to modify the switch statements starting at line 304 and the code that strips the currency symbol of the result of uc_price starting line 328.

hixster’s picture

bumping - is anyone active on this issue queue?

hixster’s picture

bumping

ericwongcm’s picture

Re: #24,

Abubin, I have looked at Ubercart CCK currency, but it doesn't seems to support ip2cc module or ip2country to get the country code from the user by IP.

Re: #27
Docc, do you mean you cannot reproduce the same problem Hixster is describing?
Can you please try again and offer us a fix?
Can you also please read my related comment which may help to fix this issue - http://drupal.org/node/546084#comment-4077564

Hixster, yeah, I am still here. Been waiting and hoping for a real fix for paypal to accept multi currency.

stella’s picture

Project: UC Multiprice » Ubercart
Version: 6.x-2.x-dev » 6.x-2.6
Component: Code » Module integration
Assigned: Docc » Unassigned
Category: bug » feature
Status: Active » Needs review
Issue tags: -Ubercart, -south africa
FileSize
1.18 KB

I can't reproduce this PayPal Express Checkout error with the latest ubercart (6.x-2.6). However, it doesn't support uc_multiprice module so the currency is always set to the default setting and never what the user selects during checkout.

Attached patch adds support for this, though could be potentially extended to only change the currency code for the currencies supported by PayPal.

Moving to ubercart issue queue.

Status: Needs review » Needs work

The last submitted patch, 621424.patch, failed testing.

stella’s picture

Status: Needs work » Needs review
FileSize
3.24 KB

oops, correct version of the patch attached this time.

Status: Needs review » Needs work

The last submitted patch, 621424.patch, failed testing.

stella’s picture

Project: Ubercart » UC Multiprice
Version: 6.x-2.6 » 6.x-1.0
Component: Module integration » Code
Category: feature » bug
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -module, -paypal, -payments, -multicurrency

Automatically closed -- issue fixed for 2 weeks with no activity.