<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php) in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66119#M39702</link>
    <description>&lt;P&gt;Currently the live keys are assigned and the sanbox keys are commented out&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
class CodeConstants
{
	//merchant credentials
	const MERCHANT_LOGIN_ID = "xxxxxx";
	const MERCHANT_TRANSACTION_KEY = "xxxxxx";
     const MERCHANT_SIGNATURE_KEY = "xxxxxxx";
     
     //Sandbox
     // const MERCHANT_LOGIN_ID = "yyyyyyy";
	// const MERCHANT_TRANSACTION_KEY = "yyyyyy";
     // const MERCHANT_SIGNATURE_KEY = "Simon";
}
?&amp;gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 27 Jan 2019 19:29:59 GMT</pubDate>
    <dc:creator>spartonyan</dc:creator>
    <dc:date>2019-01-27T19:29:59Z</dc:date>
    <item>
      <title>SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66114#M39698</link>
      <description>&lt;P&gt;What steps are required to be fulfilled when going from SANDBOX to PRODUCTION using the sdk-php-master folder?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;STEPS COMPLETED&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1. Keys have been generated for PRODUCTION&lt;/P&gt;&lt;P&gt;2. Sandbox and Merchant accounts have been switched from Test to LIVE&lt;/P&gt;&lt;P&gt;3. The charge_credit_card.php file has been modifed from&lt;/P&gt;&lt;PRE&gt;$response = $controller-&amp;gt;executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);&lt;/PRE&gt;&lt;P&gt;to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$response = $controller-&amp;gt;executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Are there any other files that need to be changed from Sandbox to Production in the sdk-php-master folder?&lt;/LI&gt;&lt;LI&gt;Are there any other settings in the acounts that need to be changed?&lt;/LI&gt;&lt;LI&gt;We are receiving error E00007&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sun, 27 Jan 2019 17:44:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66114#M39698</guid>
      <dc:creator>spartonyan</dc:creator>
      <dc:date>2019-01-27T17:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66115#M39699</link>
      <description>This may be a dumb question, but you obviously put the credentials you generated in your constants&lt;BR /&gt;file, correct? For any other thing to put in production, it would be scripts you wrote that connect&lt;BR /&gt;to the API, or scripts you copied from the API reference. All of the API files that are loaded from the SDK are left untouched.&lt;BR /&gt;&lt;BR /&gt;so for instance if you’re doing some sort of script to process the response and it involves a get transaction details method call, you would need to configure that script to production&lt;BR /&gt;mode.&lt;BR /&gt;&lt;BR /&gt;And a good way to track this down is to pull your php error log.</description>
      <pubDate>Sun, 27 Jan 2019 18:23:09 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66115#M39699</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-01-27T18:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66116#M39700</link>
      <description>Also sandbox has nothing to do with production and if you want&lt;BR /&gt;To test your production credentials without using real money, you can keep your&lt;BR /&gt;Production account in test mode. You use PRODUCTION for test and live modes on a merchant account..</description>
      <pubDate>Sun, 27 Jan 2019 18:27:00 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66116#M39700</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-01-27T18:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66118#M39701</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Credentials&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Yes, both the sanbox keys and live keys are in the constant file.&lt;/LI&gt;&lt;LI&gt;No other scripts, I just passed the values to sdk-php-master/charge-credit-card.php.&lt;/LI&gt;&lt;LI&gt;I looked at error logs and nothing shows up for the E00007 type of issue.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I changed the $response from SANDBOX to PRODUCTION expecting everything to work.&amp;nbsp; Is there some other setting in another sdk-php-master file to change from SANDBOX to PRODUCTION?&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 19:22:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66118#M39701</guid>
      <dc:creator>spartonyan</dc:creator>
      <dc:date>2019-01-27T19:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66119#M39702</link>
      <description>&lt;P&gt;Currently the live keys are assigned and the sanbox keys are commented out&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
class CodeConstants
{
	//merchant credentials
	const MERCHANT_LOGIN_ID = "xxxxxx";
	const MERCHANT_TRANSACTION_KEY = "xxxxxx";
     const MERCHANT_SIGNATURE_KEY = "xxxxxxx";
     
     //Sandbox
     // const MERCHANT_LOGIN_ID = "yyyyyyy";
	// const MERCHANT_TRANSACTION_KEY = "yyyyyy";
     // const MERCHANT_SIGNATURE_KEY = "Simon";
}
?&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Jan 2019 19:29:59 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66119#M39702</guid>
      <dc:creator>spartonyan</dc:creator>
      <dc:date>2019-01-27T19:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66120#M39703</link>
      <description>Can you copy and paste your entire php script, including the includes/requires?</description>
      <pubDate>Sun, 27 Jan 2019 21:03:21 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66120#M39703</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-01-27T21:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66121#M39704</link>
      <description>&lt;PRE&gt;&amp;lt;?php
  session_start();
  require 'vendor/autoload.php';
  require_once 'CodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  define("AUTHORIZENET_LOG_FILE", "phplog");
function chargeCreditCard($amount)
{
     //split $amount into local variables
    // $amount is an array of variables passed in $_REQUEST packed into an array for passign to functions
    // The 'array key name' is the name='' value in the form that is passed. Example: &amp;lt;input type=hidden value='invtotal'&amp;gt; 
    // You CAN use the $amount['name'] fields directly, but this way you can also do any validation before
    //   you pass them to the API.


    $CCNum=preg_replace('/\D/', '', $_REQUEST['creditcardnum']);
    $CCExp=preg_replace('/\D/', '', $_REQUEST['ccexpire']);
    $CCcvv=preg_replace('/\D/', '', $_REQUEST['cvv']);
    $INVamount=$_REQUEST['invtotal']; //invoice total
    $INVNum=$_REQUEST['invid'];       //invoice id#
    $BILLNameF=$_REQUEST['BNFirst'];  //Billing First Name
    $BILLNameL=$_REQUEST['BNLast'];   //Billing Last Name
    if(isset($_REQUEST['BCompany'])) {
        $BILLCompany=$_REQUEST['BCompany'];
    } else {
        $BILLCompany="";
    }
    $BILLAddr=$_REQUEST['BAddr'];     //Billing Address
    $BILLCity=$_REQUEST['BCity'];     //Billing City
    $BILLState=$_REQUEST['BState'];   //Billing State
    $BILLZip=$_REQUEST['BZip'];       //Billing Zip
    if(isset($_REQUEST['BCountry'])) {
        $BILLCountry=$_REQUEST['BCountry'];
    } else {
        $BILLCountry='USA';
    }

    $CUSTId=$_REQUEST['CID'];    //Customer ID
    if($BILLCompany!="") {
        $CUSTType="business";
    } else {
        $CUSTType="individual";
    }
    if(isset($_REQUEST['CUSTEmail'])) {
        $CUSTEmail=$_REQUEST['CUSTEmail'];
    } else {
        $CUSTEmail="";
    }
    
    $OrderPKG = "Online Order - ".$_SESSION['PkgName'];
    
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication-&amp;gt;setName(\CodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication-&amp;gt;setTransactionKey(\CodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
    // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard-&amp;gt;setCardNumber($CCNum);
    $creditCard-&amp;gt;setExpirationDate($CCExp);
    $creditCard-&amp;gt;setCardCode($CCcvv);
    // Add the payment data to a paymentType object
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne-&amp;gt;setCreditCard($creditCard);
    // Create order information
    $order = new AnetAPI\OrderType();
    $order-&amp;gt;setInvoiceNumber($INVNum);
    $order-&amp;gt;setDescription($OrderPKG);
    // Set the customer's Bill To address
    $customerAddress = new AnetAPI\CustomerAddressType();
    $customerAddress-&amp;gt;setFirstName($BILLNameF);
    $customerAddress-&amp;gt;setLastName($BILLNameL);
    $customerAddress-&amp;gt;setCompany($BILLCompany);
    $customerAddress-&amp;gt;setAddress($BILLAddr);
    $customerAddress-&amp;gt;setCity($BILLCity);
    $customerAddress-&amp;gt;setState($BILLState);
    $customerAddress-&amp;gt;setZip($BILLZip);
    $customerAddress-&amp;gt;setCountry($BILLCountry);
    // Set the customer's identifying information
    $customerData = new AnetAPI\CustomerDataType();
    $customerData-&amp;gt;setType("individual");
    $customerData-&amp;gt;setId($CUSTId);
    $customerData-&amp;gt;setEmail($CUSTEmail);
    // Add values for transaction settings
    $duplicateWindowSetting = new AnetAPI\SettingType();
    $duplicateWindowSetting-&amp;gt;setSettingName("duplicateWindow");
    $duplicateWindowSetting-&amp;gt;setSettingValue("60");
    // Add some merchant defined fields. These fields won't be stored with the transaction,
    // but will be echoed back in the response.
    $merchantDefinedField1 = new AnetAPI\UserFieldType();
    $merchantDefinedField1-&amp;gt;setName("customerLoyaltyNum");
    $merchantDefinedField1-&amp;gt;setValue("1128836273");
    $merchantDefinedField2 = new AnetAPI\UserFieldType();
    $merchantDefinedField2-&amp;gt;setName("favoriteColor");
    $merchantDefinedField2-&amp;gt;setValue("blue");
    // Create a TransactionRequestType object and add the previous objects to it
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType-&amp;gt;setTransactionType("authCaptureTransaction");
    $transactionRequestType-&amp;gt;setAmount($INVamount);
    $transactionRequestType-&amp;gt;setOrder($order);
    $transactionRequestType-&amp;gt;setPayment($paymentOne);
    $transactionRequestType-&amp;gt;setBillTo($customerAddress);
    $transactionRequestType-&amp;gt;setCustomer($customerData);
    $transactionRequestType-&amp;gt;addToTransactionSettings($duplicateWindowSetting);
    $transactionRequestType-&amp;gt;addToUserFields($merchantDefinedField1);
    $transactionRequestType-&amp;gt;addToUserFields($merchantDefinedField2);
    // Assemble the complete transaction request
    $request = new AnetAPI\CreateTransactionRequest();
    $request-&amp;gt;setMerchantAuthentication($merchantAuthentication);
    $request-&amp;gt;setRefId($refId);
    $request-&amp;gt;setTransactionRequest($transactionRequestType);
    // Create the controller and get the response
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller-&amp;gt;executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);
    
    if ($response != null) {
     
         $_SESSION['TransID'] = '';
         $_SESSION['AuthCode'] = '';
         
        // Check to see if the API request was successfully received and acted upon
        if ($response-&amp;gt;getMessages()-&amp;gt;getResultCode() == "Ok") {
            // Since the API request was successful, look for a transaction response
            // and parse it to display the results of authorizing the card
            $tresponse = $response-&amp;gt;getTransactionResponse();
        
            if ($tresponse != null &amp;amp;&amp;amp; $tresponse-&amp;gt;getMessages() != null) {
                // echo " Successfully created transaction with Transaction ID: " . $tresponse-&amp;gt;getTransId() . "&amp;lt;br&amp;gt;";
                // echo " Transaction Response Code: " . $tresponse-&amp;gt;getResponseCode() . "&amp;lt;br&amp;gt;";
                // echo " Message Code: " . $tresponse-&amp;gt;getMessages()[0]-&amp;gt;getCode() . "&amp;lt;br&amp;gt;";
                // echo " Auth Code: " . $tresponse-&amp;gt;getAuthCode() . "\n";
                // echo " Description: " . $tresponse-&amp;gt;getMessages()[0]-&amp;gt;getDescription() . "&amp;lt;br&amp;gt;";
                $_SESSION['TransID'] = $tresponse-&amp;gt;getTransId();
                $_SESSION['AuthCode'] = $tresponse-&amp;gt;getAuthCode();
                header("Location: ..\order_shiponline_confirm");
			 die;
            } else {
                echo "Transaction Failed \n";
                if ($tresponse-&amp;gt;getErrors() != null) {
                    echo " Error Code  : " . $tresponse-&amp;gt;getErrors()[0]-&amp;gt;getErrorCode() . "&amp;lt;br&amp;gt;";
                    echo " Error Message : " . $tresponse-&amp;gt;getErrors()[0]-&amp;gt;getErrorText() . "&amp;lt;br&amp;gt;";
                    echo " &amp;lt;b&amp;gt;Click BACK on your browser to retype the card number.&amp;lt;/b&amp;gt;";
                }
            }
            // Or, print errors if the API request wasn't successful
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response-&amp;gt;getTransactionResponse();
        
            if ($tresponse != null &amp;amp;&amp;amp; $tresponse-&amp;gt;getErrors() != null) {
                echo " Error Code  : " . $tresponse-&amp;gt;getErrors()[0]-&amp;gt;getErrorCode() . "&amp;lt;br&amp;gt;";
                echo " Error Message : " . $tresponse-&amp;gt;getErrors()[0]-&amp;gt;getErrorText() . "&amp;lt;br&amp;gt;";
            } else {
                echo " Error Code  : " . $response-&amp;gt;getMessages()-&amp;gt;getMessage()[0]-&amp;gt;getCode() . "&amp;lt;br&amp;gt;";
                echo " Error Message : " . $response-&amp;gt;getMessages()-&amp;gt;getMessage()[0]-&amp;gt;getText() . "&amp;lt;br&amp;gt;";
            }
        }
    } else {
        echo  "No response returned &amp;lt;br&amp;gt;";
    }
    return $response;
}
if (!defined('DONT_RUN_SAMPLES')) {
    chargeCreditCard("2.23");
}&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Jan 2019 21:14:23 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66121#M39704</guid>
      <dc:creator>spartonyan</dc:creator>
      <dc:date>2019-01-27T21:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: SANDBOX to PRODUCTION (sdk-php-maser charge_credit_card.php)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66122#M39705</link>
      <description>I think if you take this-&lt;BR /&gt;&lt;BR /&gt;$INVamount=$_REQUEST['invtotal’];&lt;BR /&gt;&lt;BR /&gt;Outside of the function definition.&lt;BR /&gt;&lt;BR /&gt;And make your function execute like this:&lt;BR /&gt;&lt;BR /&gt;if (!defined('DONT_RUN_SAMPLES')) {&lt;BR /&gt;chargeCreditCard($INVamount);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Then change this line:&lt;BR /&gt;&lt;BR /&gt;$transactionRequestType-&amp;gt;setAmount($INVamount);&lt;BR /&gt;&lt;BR /&gt;To this:&lt;BR /&gt;&lt;BR /&gt;$transactionRequestType-&amp;gt;setAmount($amount);&lt;BR /&gt;&lt;BR /&gt;This script will work. One other possibility if it doesn’t is that you have mistakenly swapped out your Transkey and signature key. I can imagine that being easy to do. But try this and see what happens.&lt;BR /&gt;</description>
      <pubDate>Sun, 27 Jan 2019 21:34:58 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SANDBOX-to-PRODUCTION-sdk-php-maser-charge-credit-card-php/m-p/66122#M39705</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2019-01-27T21:34:58Z</dc:date>
    </item>
  </channel>
</rss>

