Jamin
El Presidente
Friendly Neighbour
Member Likes (0)
There was a problem setting up the transaction with eWay: Amount is not valid; Currency is not valid or not allowed;
Hi I just had a client pay for eWay membership etc, and ive run into this problem.
firstly ignore the Currency issue, I know why thats broken, but the Amount is not Valid error.. thats got me stumped.
Can a developer please check out eWay payment gateway and check its still working as it should from a fresh install?

Responses (31)
People Person (joined February 2012) Likes (0)
Hi Jamin,
Do you ahve your gateway Live or in Sandbox mode?
Best,
Kimberly
Member (joined September 2011) Likes (0)
Both give the same error.
I have Live credentials from my client.
Ben
People Person (joined February 2012) Likes (0)
Ben,
I'm registering for an account so I can test the default behavior in a sandbox site on my install :)
Member (joined September 2011) Likes (0)
My client is planning to go live by Monday. So to have a fix before would be epic!
This was expected to just work. So he set a deadline and sent press releases etc. :|
Ben
People Person (joined February 2012) Likes (0)
I've got the account, and trying it now
Sorry for the delay, but as I was asking for an account to test with no actual working site they had a few questions for me :)
People Person (joined February 2012) Likes (0)
Hey Ben!
Can you verify that your client has registered to use the same currency in eWay and has that you have the same currency chosen within Marketpress.
People Person (joined February 2012) Likes (0)
pics
Member (joined September 2011) Likes (0)
All checked.
My client has signed up to eWay NZ (not australia) so I updated the file to include the nz.eway gateway instead of au.eway.
This doesnt fix the Amount is not valid error, which is the major problem.
I believe that the $_SESSION is not passing the total amount to eWay.
Can you please notify the lead developer of this thread.
People Person (joined February 2012) Likes (0)
The lead developer is not available, but I have someone else looking into it and have called in a favor from someone that may be able to help.
Have you updated the Marketpress currency settings as well?
If you are using the Sandbox you need to test in AUD currency. Have you tried to test the reporting in the eWAY account direct?
Developer (joined January 2012) Likes (0)
@Jamin, I will look into this issue. Or at least try and investigate this. I think as Kimberly suggested this might be a money mismatch. I'll setup a test environment on my end. Report back shortly.
Developer (joined January 2012) Likes (0)
@Jamin, if you have the ability to edit your PHP code I would like to get some debug information from you.
I need you to find the eway gateway file . Should be located
/wp-content/plugins/marketpress/marketpress-includes/plugins-gateway/eway.php
Open the file then go to line 192. You should see where the amount value is set. Then the next line is where the call to eWay is made.
`$params['Amount'] = $mp->display_currency($total);
$result = $this->api_call('https://au.ewaygateway.com/Request', $params);`
What I want you to do is add the following line between those lines
echo "params<pre>"; print_r($params); echo "</pre>";When you hit the checkout Confirm Your Purchase page you should see the debug output at the top. Something like the following:
http://screencast.com/t/40NCHLVKBxZW
This should help us debug what is going on. From my initial testing this morning things do seem to work correctly as advertised.
Developer (joined January 2012) Likes (0)
@Jamin, Sorry for more followup. Have been running more tests on my end. About my setup.
WordPress 3.4 RC2
MarketPress 2.5.9 (current)
Theme: TwentyEleven
Plugins: No other plugins running.
MarketPress setup
Store Settings > General - I've setup the Base Country for NZ http://screencast.com/t/D0OPj77hDD on this same page I have the Currency setup also as NZ http://screencast.com/t/hbvSWlst
Store Settings > Payments - I've enable eWay. And have the eWay Currency set to NZ http://screencast.com/t/iIBQMYumUL
I made an edit to the eWay gateway PHP code /wp-content/plugins/marketpress/marketpress-includes/plugins-gateway/eway.php line 194 to changed the gateway request URL from using the AU to NZ system.
$result = $this->api_call('https://nz.ewaygateway.com/Request', $params);I've setup a single $10.00 product in my local test system. Added a quantity of 1 to my cart. Went through the processing. And way able to get to the eWay checkout
page http://screencast.com/t/dHJZM5ojXP the URL is https://nz.ewaygateway.com/NZ/PaymentPage.aspx?value=??? to provide proof it went to NZ and not AU.
So at this point I'm not sure the issue on your end. Kimberly has befriended a technical contact at eWay. What we need to do it somehow figure out the exact error code number returned. I have a PDF of the API code when we have this.
In your away.php file after the line for the gateway:
$result = $this->api_call('https://nz.ewaygateway.com/Request', $params);Can you add this additional line to output the result
echo "result<pre>"; print_r($result); echo "</pre>";The result is actually XML code. So you will need to view source in your browser to capture it and paste it back into this thread.
I know we are 12 hours apart. So I'll be around this evening my time to help get this resolved.
Member (joined September 2011) Likes (0)
hi Paul,
thanks very much for looking into this. Time is running out to get it working before the client launches.
I followed your exact instructions. Everything is set to NZ dollar, country, currency etc like in your screenshots.
Here is the debug output:
I am running WP 3.3 and the current version of Marketpress.
I can grant you ftp access if its easier as we are on the other side of the world :)
Developer (joined January 2012) Likes (0)
Jamin,
Yeah, that re info doest not help. This is not listed in the API documentation for eWay Shared processing.
If you can provide FTP and wp-admin access that would be great. Please send that to my email paul [at] incsub.com. Then I can see what is different on your setup.
Thanks.
Paul
Member (joined September 2011) Likes (0)
print_r($params) =
everything looks like it should be working..
Member (joined September 2011) Likes (0)
Emailing you now Paul.
Developer (joined January 2012) Likes (1)Liked by: 
Jamin, just noticed on thing looking at your debug output compared to my own. Your amount is simply '2'. Not '2.00' as a normal money field (without dollar sign) would be expected to be.
No worries I'll test once I get access.
Member (joined September 2011) Likes (0)
Paul youre correct about the decimal.
That is the error. I just turned off the option to remove the decimal place from Store settings.
It worked!
Maybe you have a way of it using decimal places when checking out with the option still on.
Developer (joined January 2012) Likes (1)Liked by: 
Great!!
Yeah, I think that logic has to do really with the gateway. I think most gateways expect amounts with 2 decimal places always. I'm not aware of one without. Regardless the option you mention is on the store presentation side. So for your presentation you should be able to chose to show prices for provides without the decimal. But when the order processing kicks in for the gateway I think MarketProcess should format it to include the 2 decimal places.
So I think you found a slight bug. For now I would say leave the decimal showing until we can get this patched. I need to check with Aaron who is the lead developer of this plugin.
Member (joined September 2011) Likes (0)
Yay we (you really lol) found a bug :D
Ok i will have to just go with having the decimal in there for now, my client wont like it lol but meh as long as he can launch on time he'll be happy :)
Thank you Paul!
Ben
Developer (joined January 2012) Likes (0)
Ben,
Sorry about that. But yeah at least it should work now. One other thing is I don't like having to edit the PHP code to alter the URL for the NZ vs. AU eWay system. If you ever upgrade that change would need to be reapplied. So need to put this on the UI where you can select it like the other gateway options.
So since I have FTP access I could patch the eWay gateway PHP code to add in the decimal places. This way you can leave then off for the user presentation.
Member (joined September 2011) Likes (0)
Please if you could do that, I make lots of backups before I update in case anything breaks. I have a log of all the core changes I make. Ill note this one down too incase its not fixed in the next update.
It would be handy to have an option to change the eWay gateway address depending on the currency selected.
Member (joined September 2011) Likes (0)
This is why I love this site. The devs are so helpful! I hope your boss sees this thread! ;D
Developer (joined January 2012) Likes (1)Liked by: 
This hack is now done (A one line change actually) to the eway.php file line 193
//$params['Amount'] = $mp->display_currency($total); // Old line
$params['Amount'] = number_format( round( $total, 2 ), 2, '.', ''); // New line
Just to confirm the 'Show Decimal in Prices' option under Store Settings General tab is current 'No'. Just ran a test with quantity of 2 in the cart.
http://screencast.com/t/fyg3d3Qi
And order went to eWay correctly. http://screencast.com/t/RQeeWGvgSCeK for the corrected $2.00 amount.
So please backup the eway.php file. And please confirm this is working (again). Then when you are ready feel free to close this ticket.
Thanks.
Paul
Developer (joined January 2012) Likes (1)Liked by: 
Dude! Thanks for the awesome points love. :)
Member (joined September 2011) Likes (0)
Works perfectly!
Thank you very much :)
Ben
Member (joined September 2011) Likes (0)
Oh no.. looks like I may have spoken too soon.
Just got home to do a full transaction. Before, I just got the eWay shared page to open.
This time I went through with a transaction, and I was returned to :
http://customtabs.co.nz/edaboc2/store/shopping-cart/checkout/?eway-cancel=1
Member (joined September 2011) Likes (0)
Oh look at me, fixed it.
The response from eWay was TrxnStatus=true.
Whats in the eway.php file line ~278 is
if ($xml->TrxnStatus == 'True') {changed to non-capital true and fixed. There's another bug :)
Developer (joined January 2012) Likes (0)
OH good one. I'll note that in changes on my end.
Member (joined September 2011) Likes (1)Liked by: 
PaulM, please add another bug i discovered.
When using the Domain Mapping plugin, the Return and Cancel URLs still use the original site url instead of the new mapped domain.
I fixed it by stealing the following code from the Paypal Gateway file and inserting it into eWay.php line 121.
Without these extra lines, the payment was being processed, but the order was never sent back to the correct domain (in my case it was being sent to customtabs.co.nz/edaboc/.../confirmation instead of edaboc.com/.../confirmation).
Dangerous bug lol
Developer (joined January 2012) Likes (1)Liked by: 
Jamin, Thanks for bringing this up. And apologies for the delay in my response. Things have been crazy. I'll make sure the changes are applied to the next release of MarketPress.
Become a member