cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Help:Switching to Production Mode

I am having an issue switching to Production mode and feel like it should work..Im posting to the correct URL have the right api and transaction keys for the live account plugged in and still cant get it to work below is my php and php log with error codes. Works great in the sandbox enviorment of course....thanks in advance...I am not the best coder so I need laymens terms

----------------------------------------------------------------------------------

 

<?php

$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$PhoneNumber = $_POST['PhoneNumber'];
$BillingAddress = $_POST['BillingAddress'];
$CardNumber = $_POST['CardNumber'];
$CardExpireDate = $_POST['CardExpireDate'];
$CardCSVNumber = $_POST['CardCSVNumber'];
$InvoiceNumber = $_POST['InvoiceNumber'];
$Amount = $_POST['Amount'];
$ProcessingFee = $Amount * 0.03;
$total = $Amount + $ProcessingFee;


define("AUTHORIZENET_SANDBOX", false);

 

require '/home/sextonla/public_html/vendor/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE","phplog");

 

 

// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName("xxxxxxxxxx);
$merchantAuthentication->setTransactionKey("xxxxxxxxxxxxxxxx");
$refId = 'ref' . time();

// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber($CardNumber);
$creditCard->setExpirationDate($CardExpireDate);
$creditCard->setCardCode($CardCSVNumber);
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setCreditCard($creditCard);

 

 


// Create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setAmount($total);
$transactionRequestType->setPayment($paymentOne);

$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId( $refId);
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetController\CreateTransactionController($request);
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);

if ($response != null)
{
$tresponse = $response->getTransactionResponse();
if (($tresponse != null) && ($tresponse->getResponseCode()=="1"))
{
$orderSuccess = 'success';
$authCode = $tresponse->getAuthCode();
$transId = $tresponse->getTransId();
// echo "Charge Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
// echo "Charge Credit Card TRANS ID : " . $tresponse->getTransId() . "\n";
}
else
{
$orderSuccess = 'error';
$errorResponse = "Charge Credit Card ERROR : Invalid response\n";
}
}
else
{
$orderSuccess = 'creditError';
$errorResponse = 'Charge Credit Card Null response returned';
}

?>

<?php if($orderSuccess == 'success'){ ?>
<div class="container ">
<h3>
Thank you for the payment!
</h3>

<h5>NAME</h5>
<p><?php echo $FirstName; echo ' '; echo $LastName; ?></p>

<h5>TRANSACTION ID</h5>
<p><?php echo $transId; ?></p>

<h5>AUTHORIZATION CODE</h5>
<p><?php echo $authCode;?></p>

<h5>INVOICE NUMBER</h5>
<p><?php echo $InvoiceNumber;?></p>

<h5>INVOICE AMOUNT</h5>
<p>$<?php echo $Amount;?></p>

<h5>PROCESSING FEE (3%)</h5>
<p>$<?php echo $ProcessingFee;?></p>

<h3>TOTAL AMOUNT PAID</h3>
<p>$<?php echo $total;?></p>


<input type="button" class="main-btn" name="Print Screen" value = "CLICK HERE TO PRINT TRANSACTION ID" onclick="window.print();" target="_blank" style="cursor:pointer;"/>
</div>
<?php } ?>

<?php if($orderSuccess == 'error'){ ?>
<div class="container" style="align-content: center !important; ">
<h3>
Sorry, <?php echo $FirstName; ?> there has been an error!
</h3>

<p>
<strong>Error: <?php echo $errorResponse; ?></strong>
</p>

<p>
Please contact us at <strong>251-626-3309</strong> if you have any questions or concerns.
</p>

</div>
<?php } ?>

<?php if($orderSuccess == 'creditError'){ ?>
<div class="container">
<h3>
Oops!, <?php echo $FirstName; ?> Something went wrong with charging your credit card!
</h3>

<p>
<strong>Error: <?php echo $errorResponse; ?></strong>
</p>

---------------------------------------------------------------------------------------

php log

------------------------------------------------------------------------------------

 

<createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><refId>ref1484836252</refId><messages><resultCode>Error</resultCode><message><code>E00027</code><text>The transaction was unsuccessful.</text></message></messages><transactionResponse><responseCode>3</responseCode><authCode /><avsResultCode>P</avsResultCode><cvvResultCode /><cavvResultCode /><transId>0</transId><refTransID /><transHash>2F80652AE21B6C07FB7853D967F5F1E1</transHash><testRequest>0</testRequest><accountNumber>XXXX8826</accountNumber><accountType>Visa</accountType><errors><error><errorCode>33</errorCode><errorText>Bill To First Name is required.</errorText></error><error><errorCode>33</errorCode><errorText>Bill To Last Name is required.</errorText></error><error><errorCode>33</errorCode><errorText>Bill To Zip/Postal Code is required.</errorText></error></errors><transHashSha2>0A3D00134E810B4ECD60B24E98FDA668113D3C99E77CA59907D07EB8F09FF77AF9A0C1EE6678DF935557923FFE54146B55C3CACF21E5B5F44145A707AFFB0AE7</transHashSha2></transactionResponse></createTransactionResponse>

kmelton
Member
3 REPLIES 3

 

Hi kmelton,

 

The error 33 you are getting indicates that you are not passing the required fields with your transaction request. This could be because of :

 

http://developer.authorize.net/api/reference/responseCodes.html?code=33

or

https://support.authorize.net/authkb/index?page=content&id=A1458

 

Thanks,

Joy

Joy
Administrator Administrator
Administrator

Aha I think i need to post a zipcode added it to my form now to find out how to implement it to post to authorize in my php...this could take a while, thank you for leading me in the right direction

but dont let that stop anyone from helping me..thanks