Reply
Member
Posts: 4
Registered: ‎11-19-2013
Accepted Solution

(LART me!) [PHP] $transaction->amount is null...

Had everything working in sandbox, using PHP AIM.

Management decided to give price breaks, so now I have to check a button on the form and assign the transaction amount based on the user input.

For some reason this is breaking:

$transaction = new AuthorizeNetAIM(API_Login_ID,Transaction_Key);//my test ID and Key
   if (defined(PKG_PRICE)) {
      die("PKG_PRICE is defined...");
      $transaction->amount = PKG_PRICE;
   } else {
      echo "making a good assignment now...";
      $transaction->amount = $this_pkg_price;
   }
   echo "the transaction amount is supposed to be $this_pkg_price, but it's coming up as: ";
   echo ($transaction->amount);exit;

 
And my output is "making a good assignment now", then "making a good assignment now
the transaction amount is supposed to be 2950, but it's coming up as: "

$transaction passes is_object().  $this_pkg_price is obviously set.

It's 4 PM here and must be something simple....


Accepted Solutions
Solution
Accepted by topic author kkinsey
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎11-19-2013

Re: (LART me!) [PHP] $transaction->amount is null...

Well, not sure why it's not working that way --- like I said, it seemed to have been working before.

As I suspected, though, it does work if we use our own variable as the first arg to the AuthorizeandCapture function:


$response = $transaction->authorizeAndCapture($my_special_price_variable);

 
I can code around that.  Thanks for the help.

View solution in original post


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

Re: (LART me!) [PHP] $transaction->amount is null...

is null or just your echo is not displaying? why did you have that is a seperated line?

Member
Posts: 4
Registered: ‎11-19-2013

Re: (LART me!) [PHP] $transaction->amount is null...


@RaynorC1emen7 wrote:

is null or just your echo is not displaying? why did you have that is a seperated line?



Heavy debugging, Raynor.

Member
Posts: 4
Registered: ‎11-19-2013

Re: (LART me!) [PHP] $transaction->amount is null...

To further elaborate, "null" is an understatement.  $transaction->amount is (apparently) not even set.

I'm currently operating under the assumption that the cause of this issue is that the variable is protected inside the AuthorizeNetAIM object.

However, I could swear that the code was working last week with simply "$transaction->amount = $variable;"

I'm sure I'll knock it, given enough time ... would appreciate any insight, though.

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

Re: (LART me!) [PHP] $transaction->amount is null...

[ Edited ]

are you sure you wasn't using

setFields

 

$transaction->amount isn't it for the response?

Solution
Accepted by topic author kkinsey
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎11-19-2013

Re: (LART me!) [PHP] $transaction->amount is null...

Well, not sure why it's not working that way --- like I said, it seemed to have been working before.

As I suspected, though, it does work if we use our own variable as the first arg to the AuthorizeandCapture function:


$response = $transaction->authorizeAndCapture($my_special_price_variable);

 
I can code around that.  Thanks for the help.