cancel
Showing results for 
Search instead for 
Did you mean: 

Where do I put the Login ID & Trans Key in the PHP Code?

I'm fairly new to php programming, though I am well versed in html/css/xhtml, I went through Stymiee's very thorough and easy to understand tutorial series on handling online payments. However, in that tut I didn't see where we input the connection codes (Login ID and Trans Key) to the secure gateway, is there a short snippet of code that I missed and where in the code does it go?

 

Thanks for your help! :robotvery-happy:

 

 

G33kyGal
Member
4 REPLIES 4

You can set those in config variables inside the API, I don't know if he's assuming you've done this or not. If you want to add it at the transaction level, change this in Part 5:

 

$transaction = new AuthorizeNetAIM;

 To this:

 

$transaction = new AuthorizeNetAIM($myID, $myKey);
TJPride
Expert

Thanks for the quick help, I will try that and see if it goes through, thanks so much! 

Tried what you suggested, but I get this error when I go to test it.

 

 

Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/a1833629/public_html/payment-form.php on line 98

 

line 98 has the Login ID and Trans Key in it with the $ at the start like you suggested. Is it the wrong syntax for the codes?

 

Obviously I can't post the id and key here, but it looks like this:

 

 $transaction = new AuthorizeNetAIM( $#B#bb#BB, $###BbbbBB###bb#);

 


$myid and $mykey represent variables that contain those codes:

 

// In your globals file you might have:
$GLOBALS['_auth_id'] = 'dsjfor23j3';
$GLOBALS['_auth_key'] = 'sdf23i4j23';

// Then in your code:
$transaction = new AuthorizeNetAIM($GLOBALS['_auth_id'], $GLOBALS['_auth_key']);

// If you want to just hard-code it in the call:
$transaction = new AuthorizeNetAIM('dsjfor23j3', 'sdf23i4j23');