Reply
Highlighted
Member
Posts: 1
Registered: ‎01-24-2013

Sorry, an error occurred: A valid amount is required.

Hi, I'm having a problem integrating direct post in my codes. I just copied the PHP file which was given in one of your tutorials but of changed some things needed in the said file except for the amount. I wanted to try it first with the constant amount.

 

<?php
require_once 
'anet_php_sdk/AuthorizeNet.php';// The SDK
$url 
=" ";
$api_login_id 
='YOUR_API_LOGIN_ID';
$transaction_key 
='YOUR_TRANSACTION_KEY';
$md5_setting 
='YOUR_API_LOGIN_ID';// Your MD5 Setting
$amount 
="5.99";
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);
?>

 

Everything went smoothly but when I clicked the "Buy" button the direct_post.php, it gives me this error. "Sorry, an error occurred: A valid amount is required.".The response code was 3. I've read some similar problems regarding this but haven't found an answer. What does that mean? I didn't even change the amount in your sample code. Please help.

 

Thanks

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Sorry, an error occurred: A valid amount is required.

what kind of changed did you made?

Also, on the web browser, go thru to the "Buy" button page, and view the browser page source. There should be a "x_amount" hidden field, is it there?

Highlighted
Member
Posts: 5
Registered: ‎09-14-2013

Re: Sorry, an error occurred: A valid amount is required.

I had exactly the same problem. I did what you said, Raynor, and viewed the page source. A hidden field for x_amount was not there, and I don't see where the hidden fields are coming from/can't read php that well. What would be the next step?

 

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Sorry, an error occurred: A valid amount is required.