[
  {
    "path": ".gitignore",
    "content": "# Cache and logs (Symfony2)\n/app/cache/*\n/app/logs/*\n!app/cache/.gitkeep\n!app/logs/.gitkeep\n\n# Cache and logs (Symfony3)\n/var/cache/*\n/var/logs/*\n!var/cache/.gitkeep\n!var/logs/.gitkeep\n\n# Parameters\n/app/config/parameters.yml\n/app/config/parameters.ini\n\n# Managed by Composer\n/app/bootstrap.php.cache\n/var/bootstrap.php.cache\n/bin/*\n!bin/console\n!bin/symfony_requirements\n/vendor/\n\n# Assets and user uploads\n/web/bundles/\n/web/uploads/\n\n# PHPUnit\n/app/phpunit.xml\n/phpunit.xml\n\n# Build data\n/build/\n\n# Composer PHAR\n/composer.phar\n/composer.lock\n\n# log files\n/phplog\n\n# PHP Storm\n/.idea/*\n\n# Operating system files\n.DS_Store\n/lib\n/*.cache\n/testslog\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: php\n\nmatrix:\n  include:\n    - php: 5.6\n      env: PHPUNIT_VERSION=5.6.*\n      dist: trusty\n    - php: 7.0\n      env: PHPUNIT_VERSION=5.6.*\n      dist: trusty\n    - php: 7.1\n      env: PHPUNIT_VERSION=5.7.*\n      dist: trusty\n    - php: 7.2\n      env: PHPUNIT_VERSION=8.5.*\n      dist: bionic\n    - php: 7.3\n      env: PHPUNIT_VERSION=9.5.*\n      dist: bionic\n    - php: 7.4\n      env: PHPUNIT_VERSION=9.5.*\n      dist: bionic\n    - php: 8.0\n      env: PHPUNIT_VERSION=9.5.*\n      dist: bionic\n\nsudo: false\n\nbefore_script:\n    - composer require \"phpunit/phpunit:${PHPUNIT_VERSION}\" --no-update\n    - composer update --prefer-dist\n\nscript:\n    - phpunit TestRunner.php .\n\n"
  },
  {
    "path": "AcceptSuite/create-an-accept-payment-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createAnAcceptPaymentTransaction($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment object for a payment nonce\n    $opaqueData = new AnetAPI\\OpaqueDataType();\n    $opaqueData->setDataDescriptor(\"COMMON.ACCEPT.INAPP.PAYMENT\");\n    $opaqueData->setDataValue(\"119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9\");\n\n\n    // Add the payment data to a paymentType object\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setOpaqueData($opaqueData);\n\n    // Create order information\n    $order = new AnetAPI\\OrderType();\n    $order->setInvoiceNumber(\"10101\");\n    $order->setDescription(\"Golf Shirts\");\n\n    // Set the customer's Bill To address\n    $customerAddress = new AnetAPI\\CustomerAddressType();\n    $customerAddress->setFirstName(\"Ellen\");\n    $customerAddress->setLastName(\"Johnson\");\n    $customerAddress->setCompany(\"Souveniropolis\");\n    $customerAddress->setAddress(\"14 Main Street\");\n    $customerAddress->setCity(\"Pecan Springs\");\n    $customerAddress->setState(\"TX\");\n    $customerAddress->setZip(\"44628\");\n    $customerAddress->setCountry(\"USA\");\n\n    // Set the customer's identifying information\n    $customerData = new AnetAPI\\CustomerDataType();\n    $customerData->setType(\"individual\");\n    $customerData->setId(\"99999456654\");\n    $customerData->setEmail(\"EllenJohnson@example.com\");\n\n    // Add values for transaction settings\n    $duplicateWindowSetting = new AnetAPI\\SettingType();\n    $duplicateWindowSetting->setSettingName(\"duplicateWindow\");\n    $duplicateWindowSetting->setSettingValue(\"60\");\n\n    // Add some merchant defined fields. These fields won't be stored with the transaction,\n    // but will be echoed back in the response.\n    $merchantDefinedField1 = new AnetAPI\\UserFieldType();\n    $merchantDefinedField1->setName(\"customerLoyaltyNum\");\n    $merchantDefinedField1->setValue(\"1128836273\");\n\n    $merchantDefinedField2 = new AnetAPI\\UserFieldType();\n    $merchantDefinedField2->setName(\"favoriteColor\");\n    $merchantDefinedField2->setValue(\"blue\");\n\n    // Create a TransactionRequestType object and add the previous objects to it\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\"); \n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setOrder($order);\n    $transactionRequestType->setPayment($paymentOne);\n    $transactionRequestType->setBillTo($customerAddress);\n    $transactionRequestType->setCustomer($customerData);\n    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);\n    $transactionRequestType->addToUserFields($merchantDefinedField1);\n    $transactionRequestType->addToUserFields($merchantDefinedField2);\n\n    // Assemble the complete transaction request\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n\n    if ($response != null) {\n        // Check to see if the API request was successfully received and acted upon\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            // Since the API request was successful, look for a transaction response\n            // and parse it to display the results of authorizing the card\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Successfully created transaction with Transaction ID: \" . $tresponse->getTransId() . \"\\n\";\n                echo \" Transaction Response Code: \" . $tresponse->getResponseCode() . \"\\n\";\n                echo \" Message Code: \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Auth Code: \" . $tresponse->getAuthCode() . \"\\n\";\n                echo \" Description: \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n            // Or, print errors if the API request wasn't successful\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error Code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error Message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }      \n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n      createAnAcceptPaymentTransaction(\"2.23\");\n}\n?>"
  },
  {
    "path": "AcceptSuite/get-accept-customer-profile-page.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getAcceptCustomerProfilePage($customerprofileid = \"123212\")\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n    \n\t  // Use an existing payment profile ID for this Merchant name and Transaction key\n\t  \n\t  $setting = new AnetAPI\\SettingType();\n\t  $setting->setSettingName(\"hostedProfileReturnUrl\");\n\t  $setting->setSettingValue(\"https://returnurl.com/return/\");\n\t  \n\t  //$alist = new AnetAPI\\ArrayOfSettingType();\n\t  //$alist->addToSetting($setting);\n\t  \n\t  $request = new AnetAPI\\GetHostedProfilePageRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setCustomerProfileId($customerprofileid);\n\t  $request->addToHostedProfileSettings($setting);\n\t  \n\t  $controller = new AnetController\\GetHostedProfilePageController($request);\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  \n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\t  echo $response->getToken().\"\\n\";\n\t   }\n\t  else\n\t  {\n\t\t  echo \"ERROR :  Failed to get hosted profile page\\n\";\n\t\t  $errorMessages = $response->getMessages()->getMessage();\n\t\t  echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\t  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      getAcceptCustomerProfilePage();    \n?>\n"
  },
  {
    "path": "AcceptSuite/get-an-accept-payment-page.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getAnAcceptPaymentPage()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\");\n    $transactionRequestType->setAmount(\"12.23\");\n\n    // Set Hosted Form options\n    $setting1 = new AnetAPI\\SettingType();\n    $setting1->setSettingName(\"hostedPaymentButtonOptions\");\n    $setting1->setSettingValue(\"{\\\"text\\\": \\\"Pay\\\"}\");\n\n    $setting2 = new AnetAPI\\SettingType();\n    $setting2->setSettingName(\"hostedPaymentOrderOptions\");\n    $setting2->setSettingValue(\"{\\\"show\\\": false}\");\n\n    $setting3 = new AnetAPI\\SettingType();\n    $setting3->setSettingName(\"hostedPaymentReturnOptions\");\n    $setting3->setSettingValue(\n        \"{\\\"url\\\": \\\"https://mysite.com/receipt\\\", \\\"cancelUrl\\\": \\\"https://mysite.com/cancel\\\", \\\"showReceipt\\\": true}\"\n    );\n\n    // Build transaction request\n    $request = new AnetAPI\\GetHostedPaymentPageRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n\n    $request->addToHostedPaymentSettings($setting1);\n    $request->addToHostedPaymentSettings($setting2);\n    $request->addToHostedPaymentSettings($setting3);\n    \n    //execute request\n    $controller = new AnetController\\GetHostedPaymentPageController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\")) {\n        echo $response->getToken().\"\\n\";\n    } else {\n        echo \"ERROR :  Failed to get hosted payment page token\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"RESPONSE : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n}\nif (!defined('DONT_RUN_SAMPLES')) {\n    getAnAcceptPaymentPage();\n}\n"
  },
  {
    "path": "CustomerProfiles/create-customer-payment-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction createCustomerPaymentProfile($existingcustomerprofileid, $phoneNumber)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create a Customer Profile Request\n    //  1. (Optionally) create a Payment Profile\n    //  2. (Optionally) create a Shipping Profile\n    //  3. Create a Customer Profile (or specify an existing profile)\n    //  4. Submit a CreateCustomerProfile Request\n    //  5. Validate Profile ID returned\n\n    // Set credit card information for payment profile\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4242424242424242\");\n    $creditCard->setExpirationDate(\"2038-12\");\n    $creditCard->setCardCode(\"142\");\n    $paymentCreditCard = new AnetAPI\\PaymentType();\n    $paymentCreditCard->setCreditCard($creditCard);\n\n    // Create the Bill To info for new payment type\n    $billto = new AnetAPI\\CustomerAddressType();\n    $billto->setFirstName(\"Ellen\".$phoneNumber);\n    $billto->setLastName(\"Johnson\");\n    $billto->setCompany(\"Souveniropolis\");\n    $billto->setAddress(\"14 Main Street\");\n    $billto->setCity(\"Pecan Springs\");\n    $billto->setState(\"TX\");\n    $billto->setZip(\"44628\");\n    $billto->setCountry(\"USA\");\n    $billto->setPhoneNumber($phoneNumber);\n    $billto->setfaxNumber(\"999-999-9999\");\n\n    // Create a new Customer Payment Profile object\n    $paymentprofile = new AnetAPI\\CustomerPaymentProfileType();\n    $paymentprofile->setCustomerType('individual');\n    $paymentprofile->setBillTo($billto);\n    $paymentprofile->setPayment($paymentCreditCard);\n    $paymentprofile->setDefaultPaymentProfile(true);\n\n    $paymentprofiles[] = $paymentprofile;\n\n    // Assemble the complete transaction request\n    $paymentprofilerequest = new AnetAPI\\CreateCustomerPaymentProfileRequest();\n    $paymentprofilerequest->setMerchantAuthentication($merchantAuthentication);\n\n    // Add an existing profile id to the request\n    $paymentprofilerequest->setCustomerProfileId($existingcustomerprofileid);\n    $paymentprofilerequest->setPaymentProfile($paymentprofile);\n    $paymentprofilerequest->setValidationMode(\"liveMode\");\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateCustomerPaymentProfileController($paymentprofilerequest);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") ) {\n        echo \"Create Customer Payment Profile SUCCESS: \" . $response->getCustomerPaymentProfileId() . \"\\n\";\n    } else {\n        echo \"Create Customer Payment Profile: ERROR Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\n    }\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n      createCustomerPaymentProfile(\"1929905607\", \"000-000-0009\");\n}\n?>\n"
  },
  {
    "path": "CustomerProfiles/create-customer-profile-from-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction createCustomerProfileFromTransaction($transId= \"2249066517\")\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $customerProfile = new AnetAPI\\CustomerProfileBaseType();\n    $customerProfile->setMerchantCustomerId(\"123212\");\n    $customerProfile->setEmail(rand(0, 10000) . \"@test\" .\".com\");\n    $customerProfile->setDescription(rand(0, 10000) .\"sample description\");\n      \n    $request = new AnetAPI\\CreateCustomerProfileFromTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setTransId($transId);\n\n    // You can either specify the customer information in form of customerProfileBaseType object\n    $request->setCustomer($customerProfile);\n    //  OR   \n    // You can just provide the customer Profile ID\n        //$request->setCustomerProfileId(\"123343\");\n\n    $controller = new AnetController\\CreateCustomerProfileFromTransactionController($request);\n\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") ) {\n        echo \"SUCCESS: PROFILE ID : \" . $response->getCustomerProfileId() . \"\\n\";\n    } else {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n}\n\n// Provide a transaction that has customer information\nif (!defined('DONT_RUN_SAMPLES')) {\n      createCustomerProfileFromTransaction(\"2249066517\");\n}\n\n?>\n"
  },
  {
    "path": "CustomerProfiles/create-customer-profile-with-accept-nonce.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createCustomerProfileWithAcceptNonce($email)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create a Customer Profile Request\n    //  1. (Optionally) create a Payment Profile\n    //  2. (Optionally) create a Shipping Profile\n    //  3. Create a Customer Profile (or specify an existing profile)\n    //  4. Submit a CreateCustomerProfile Request\n    //  5. Validate Profile ID returned\n\n    // Set the payment data for the payment profile to a token obtained from Accept.js\n    $op = new AnetAPI\\OpaqueDataType();\n    $op->setDataDescriptor(\"COMMON.ACCEPT.INAPP.PAYMENT\");\n    $op->setDataValue(\"119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setOpaqueData($op);\n\n\n    // Create the Bill To info for new payment type\n    $billto = new AnetAPI\\CustomerAddressType();\n    $billto->setFirstName(\"Ellen\");\n    $billto->setLastName(\"Johnson\");\n    $billto->setCompany(\"Souveniropolis\");\n    $billto->setAddress(\"14 Main Street\");\n    $billto->setCity(\"Pecan Springs\");\n    $billto->setState(\"TX\");\n    $billto->setZip(\"44628\");\n    $billto->setCountry(\"USA\");\n    $billto->setPhoneNumber(123-123-1234);\n    $billto->setfaxNumber(\"999-999-9999\");\n\n    // Create a new Customer Payment Profile object\n    $paymentprofile = new AnetAPI\\CustomerPaymentProfileType();\n    $paymentprofile->setCustomerType('individual');\n    $paymentprofile->setBillTo($billto);\n    $paymentprofile->setPayment($paymentOne);\n    $paymentprofile->setDefaultPaymentProfile(true);\n\n    $paymentprofiles[] = $paymentprofile;\n\n    // Create a new CustomerProfileType and add the payment profile object\n    $customerprofile = new AnetAPI\\CustomerProfileType();\n    $customerprofile->setDescription(\"Customer Test PHP Accept Test\");\n\n    $customerprofile->setMerchantCustomerId(\"M_\".$email);\n    $customerprofile->setEmail($email);\n    $customerprofile->setPaymentProfiles($paymentprofiles);\n\n    // Assemble the complete transaction request\n    $request = new AnetAPI\\CreateCustomerProfileRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setProfile($customerprofile);\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateCustomerProfileController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") ) {\n        echo \"Succesfully created customer profile : \" . $response->getCustomerProfileId() . \"\\n\";\n        $paymentProfiles = $response->getCustomerPaymentProfileIdList();\n        echo \"SUCCESS: PAYMENT PROFILE ID : \" . $paymentProfiles[0] . \"\\n\";\n    } else {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    createCustomerProfileWithAcceptNonce(\"test123@test.com\");\n}\n?>\n"
  },
  {
    "path": "CustomerProfiles/create-customer-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createCustomerProfile($email)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create a Customer Profile Request\n    //  1. (Optionally) create a Payment Profile\n    //  2. (Optionally) create a Shipping Profile\n    //  3. Create a Customer Profile (or specify an existing profile)\n    //  4. Submit a CreateCustomerProfile Request\n    //  5. Validate Profile ID returned\n\n    // Set credit card information for payment profile\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4242424242424242\");\n    $creditCard->setExpirationDate(\"2038-12\");\n    $creditCard->setCardCode(\"142\");\n    $paymentCreditCard = new AnetAPI\\PaymentType();\n    $paymentCreditCard->setCreditCard($creditCard);\n\n    // Create the Bill To info for new payment type\n    $billTo = new AnetAPI\\CustomerAddressType();\n    $billTo->setFirstName(\"Ellen\");\n    $billTo->setLastName(\"Johnson\");\n    $billTo->setCompany(\"Souveniropolis\");\n    $billTo->setAddress(\"14 Main Street\");\n    $billTo->setCity(\"Pecan Springs\");\n    $billTo->setState(\"TX\");\n    $billTo->setZip(\"44628\");\n    $billTo->setCountry(\"USA\");\n    $billTo->setPhoneNumber(\"888-888-8888\");\n    $billTo->setfaxNumber(\"999-999-9999\");\n\n    // Create a customer shipping address\n    $customerShippingAddress = new AnetAPI\\CustomerAddressType();\n    $customerShippingAddress->setFirstName(\"James\");\n    $customerShippingAddress->setLastName(\"White\");\n    $customerShippingAddress->setCompany(\"Addresses R Us\");\n    $customerShippingAddress->setAddress(rand() . \" North Spring Street\");\n    $customerShippingAddress->setCity(\"Toms River\");\n    $customerShippingAddress->setState(\"NJ\");\n    $customerShippingAddress->setZip(\"08753\");\n    $customerShippingAddress->setCountry(\"USA\");\n    $customerShippingAddress->setPhoneNumber(\"888-888-8888\");\n    $customerShippingAddress->setFaxNumber(\"999-999-9999\");\n\n    // Create an array of any shipping addresses\n    $shippingProfiles[] = $customerShippingAddress;\n\n\n    // Create a new CustomerPaymentProfile object\n    $paymentProfile = new AnetAPI\\CustomerPaymentProfileType();\n    $paymentProfile->setCustomerType('individual');\n    $paymentProfile->setBillTo($billTo);\n    $paymentProfile->setPayment($paymentCreditCard);\n    $paymentProfiles[] = $paymentProfile;\n\n\n    // Create a new CustomerProfileType and add the payment profile object\n    $customerProfile = new AnetAPI\\CustomerProfileType();\n    $customerProfile->setDescription(\"Customer 2 Test PHP\");\n    $customerProfile->setMerchantCustomerId(\"M_\" . time());\n    $customerProfile->setEmail($email);\n    $customerProfile->setpaymentProfiles($paymentProfiles);\n    $customerProfile->setShipToList($shippingProfiles);\n\n\n    // Assemble the complete transaction request\n    $request = new AnetAPI\\CreateCustomerProfileRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setProfile($customerProfile);\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateCustomerProfileController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n  \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\")) {\n        echo \"Succesfully created customer profile : \" . $response->getCustomerProfileId() . \"\\n\";\n        $paymentProfiles = $response->getCustomerPaymentProfileIdList();\n        echo \"SUCCESS: PAYMENT PROFILE ID : \" . $paymentProfiles[0] . \"\\n\";\n    } else {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    createCustomerProfile(\"test123@test.com\");\n}\n"
  },
  {
    "path": "CustomerProfiles/create-customer-shipping-address.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction createCustomerShippingAddress($existingcustomerprofileid = \"1929905607\", \n    $phoneNumber=\"000-000-0000\"\n) {\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n    \n    // Use An existing customer profile id for this merchant name and transaction key\n\n    // Create the customer shipping address\n    $customershippingaddress = new AnetAPI\\CustomerAddressType();\n    $customershippingaddress->setFirstName(\"James\");\n    $customershippingaddress->setLastName(\"White\");\n    $customershippingaddress->setCompany(\"Addresses R Us\");\n    $customershippingaddress->setAddress(rand() . \" North Spring Street\");\n    $customershippingaddress->setCity(\"Toms River\");\n    $customershippingaddress->setState(\"NJ\");\n    $customershippingaddress->setZip(\"08753\");\n    $customershippingaddress->setCountry(\"USA\");\n    $customershippingaddress->setPhoneNumber($phoneNumber);\n    $customershippingaddress->setFaxNumber(\"999-999-9999\");\n\n    // Create a new customer shipping address for an existing customer profile\n\n    $request = new AnetAPI\\CreateCustomerShippingAddressRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setCustomerProfileId($existingcustomerprofileid);\n    $request->setAddress($customershippingaddress);\n    $controller = new AnetController\\CreateCustomerShippingAddressController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") ) {\n        echo \"Create Customer Shipping Address SUCCESS: ADDRESS ID : \" . $response-> getCustomerAddressId() . \"\\n\";\n    } else {\n        echo \"Create Customer Shipping Address  ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n}\nif (!defined('DONT_RUN_SAMPLES')) {\n      createCustomerShippingAddress();\n}\n?>\n"
  },
  {
    "path": "CustomerProfiles/delete-customer-payment-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction deleteCustomerPaymentProfile($customerProfileId= \"1929905607\", \n    $customerpaymentprofileid = \"1842074814\"\n) {\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n    \n\t  // Use an existing payment profile ID for this Merchant name and Transaction key\n\t  \n\t  $request = new AnetAPI\\DeleteCustomerPaymentProfileRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setCustomerProfileId($customerProfileId);\n\t  $request->setCustomerPaymentProfileId($customerpaymentprofileid);\n\t  $controller = new AnetController\\DeleteCustomerPaymentProfileController($request);\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\t  echo \"SUCCESS: Delete Customer Payment Profile  SUCCESS  :\" . \"\\n\";\n\t   }\n\t  else\n\t  {\n\t\t  echo \"ERROR :  Delete Customer Payment Profile: Invalid response\\n\";\n\t\t  $errorMessages = $response->getMessages()->getMessage();\n\t\t  echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\t  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      deleteCustomerPaymentProfile();\n ?>\n"
  },
  {
    "path": "CustomerProfiles/delete-customer-profile.php",
    "content": "<?php\n\trequire 'vendor/autoload.php';\n\trequire_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction deleteCustomerProfile($customerProfileId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n\t  // Delete an existing customer profile  \n\t  $request = new AnetAPI\\DeleteCustomerProfileRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setCustomerProfileId( $customerProfileId );\n\n\t  $controller = new AnetController\\DeleteCustomerProfileController($request);\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\techo \"DeleteCustomerProfile SUCCESS : \" .  \"\\n\";\n\t  }\n\t  else\n\t  {\n\t\techo \"ERROR :  DeleteCustomerProfile: Invalid response\\n\";\n\t\t$errorMessages = $response->getMessages()->getMessage();\n\t\techo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\n\t  return $response;\n  }\n  \n  if(!defined('DONT_RUN_SAMPLES'))\n      deleteCustomerProfile(\"1929905651\");\n?>\n"
  },
  {
    "path": "CustomerProfiles/delete-customer-shipping-address.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction deleteCustomerShippingAddress($customerprofileid = \"1929905607\", $customeraddressid = \"901116911\")\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n    \n\t  // Use an existing customer profile and address id for this merchant name and transaction key\n\t  // Delete an existing customer shipping address for an existing customer profile\n\t  $request = new AnetAPI\\DeleteCustomerShippingAddressRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setCustomerProfileId($customerprofileid);\n\t  $request->setCustomerAddressId($customeraddressid);\n\n\t  $controller = new AnetController\\DeleteCustomerShippingAddressController($request);\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\t  echo \"Delete Customer Shipping Address SUCCESS\" . \"\\n\";\n\t   }\n\t  else\n\t  {\n\t\t  echo \"Delete Customer Shipping Address  ERROR :  Invalid response\\n\";\n\t\t  $errorMessages = $response->getMessages()->getMessage();\n\t\t  echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\t  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      deleteCustomerShippingAddress();\n?>\n"
  },
  {
    "path": "CustomerProfiles/get-customer-payment-profile-list.php",
    "content": "<?php\n\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getCustomerPaymentProfileList()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n        \n        //Setting the paging\n        $paging = new AnetAPI\\PagingType();\n        $paging->setLimit(\"1000\");\n        $paging->setOffset(\"1\");\n        \n        //Setting the sorting\n        $sorting = new AnetAPI\\CustomerPaymentProfileSortingType();\n        $sorting->setOrderBy(\"id\");\n        $sorting->setOrderDescending(false);\n        \n        //Creating the request with the required parameters\n        $request = new AnetAPI\\GetCustomerPaymentProfileListRequest();\n        $request->setMerchantAuthentication($merchantAuthentication);\n        $request->setRefId($refId);\n        $request->setPaging($paging);\n        $request->setSorting($sorting);\n        $request->setSearchType(\"cardsExpiringInMonth\");\n        $request->setMonth(\"2020-12\");\n    \n        // Controller\n        $controller = new AnetController\\GetCustomerPaymentProfileListController($request);\n        // Getting the response\n        $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n        \n    if (($response != null)) {\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            // Success\n            echo \"GetCustomerPaymentProfileList SUCCESS: \" . \"\\n\";\n            $errorMessages = $response->getMessages()->getMessage();\n            echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n            echo \"Total number of Results in the result set\" . $response->getTotalNumInResultSet() . \"\\n\";\n            // Displaying the customer payment profile list\n            foreach ($response->getPaymentProfiles() as $paymentProfile) {\n                echo \"\\nCustomer Profile ID: \" . $paymentProfile->getCustomerProfileId() . \"\\n\";\n                echo \"Payment profile ID: \" . $paymentProfile->getCustomerPaymentProfileId() . \"\\n\";\n                echo \"Credit Card Number: \" . $paymentProfile->getPayment()->getCreditCard()->getCardNumber() . \"\\n\";\n                if ($paymentProfile->getBillTo() != null) {\n                    echo \"First Name in Billing Address: \" . $paymentProfile->getBillTo()->getFirstName() . \"\\n\";\n                }\n            }\n        } else {\n            // Error\n            echo \"GetCustomerPaymentProfileList ERROR :  Invalid response\\n\";\n            $errorMessages = $response->getMessages()->getMessage();\n            echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n        }\n    } else {\n        // Failed to get the response\n        echo \"NULL Response Error\";\n    }\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    getCustomerPaymentProfileList();\n}\n"
  },
  {
    "path": "CustomerProfiles/get-customer-payment-profile.php",
    "content": "<?php\n\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getCustomerPaymentProfile($customerProfileId=\"1929905607\", \n    $customerPaymentProfileId= \"1842074814\"\n) {\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n\t//request requires customerProfileId and customerPaymentProfileId\n\t$request = new AnetAPI\\GetCustomerPaymentProfileRequest();\n\t$request->setMerchantAuthentication($merchantAuthentication);\n\t$request->setRefId( $refId);\n\t$request->setCustomerProfileId($customerProfileId);\n\t$request->setCustomerPaymentProfileId($customerPaymentProfileId);\n\n\t$controller = new AnetController\\GetCustomerPaymentProfileController($request);\n\t$response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\tif(($response != null)){\n\t\tif ($response->getMessages()->getResultCode() == \"Ok\")\n\t\t{\n\t\t\techo \"GetCustomerPaymentProfile SUCCESS: \" . \"\\n\";\n\t\t\techo \"Customer Payment Profile Id: \" . $response->getPaymentProfile()->getCustomerPaymentProfileId() . \"\\n\";\n\t\t\techo \"Customer Payment Profile Billing Address: \" . $response->getPaymentProfile()->getbillTo()->getAddress(). \"\\n\";\n\t\t\techo \"Customer Payment Profile Card Last 4 \" . $response->getPaymentProfile()->getPayment()->getCreditCard()->getCardNumber(). \"\\n\";\n\n\t\t\tif($response->getPaymentProfile()->getSubscriptionIds() != null) \n\t\t\t{\n\t\t\t\tif($response->getPaymentProfile()->getSubscriptionIds() != null)\n\t\t\t\t{\n\n\t\t\t\t\techo \"List of subscriptions:\";\n\t\t\t\t\tforeach($response->getPaymentProfile()->getSubscriptionIds() as $subscriptionid)\n\t\t\t\t\t\techo $subscriptionid . \"\\n\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo \"GetCustomerPaymentProfile ERROR :  Invalid response\\n\";\n\t\t\t$errorMessages = $response->getMessages()->getMessage();\n\t\t    echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t\t}\n\t}\n\telse{\n\t\techo \"NULL Response Error\";\n\t}\n\treturn $response;\n}\nif(!defined('DONT_RUN_SAMPLES'))\n    getCustomerPaymentProfile();\n?>\n"
  },
  {
    "path": "CustomerProfiles/get-customer-profile-ids.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getCustomerProfileIds()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Get all existing customer profile ID's\n    $request = new AnetAPI\\GetCustomerProfileIdsRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $controller = new AnetController\\GetCustomerProfileIdsController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    {\n        echo \"GetCustomerProfileId's SUCCESS: \" . \"\\n\";\n        $profileIds[] = $response->getIds();\n        echo \"There are \" . count($profileIds[0]) . \" Customer Profile ID's for this Merchant Name and Transaction Key\" . \"\\n\";\n     }\n    else\n    {\n        echo \"GetCustomerProfileId's ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      getCustomerProfileIds();\n?>\n"
  },
  {
    "path": "CustomerProfiles/get-customer-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getCustomerProfile()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n\t\t// Create the payment data for a credit card\n\t  $creditCard = new AnetAPI\\CreditCardType();\n\t  $creditCard->setCardNumber( \"4111111111111111\" );\n\t  $creditCard->setExpirationDate(\"2038-12\");\n\t  $paymentCreditCard = new AnetAPI\\PaymentType();\n\t  $paymentCreditCard->setCreditCard($creditCard);\n\n\t  // Create the Bill To info\n\t  $billto = new AnetAPI\\CustomerAddressType();\n\t  $billto->setFirstName(\"Ellen\");\n\t  $billto->setLastName(\"Johnson\");\n\t  $billto->setCompany(\"Souveniropolis\");\n\t  $billto->setAddress(\"14 Main Street\");\n\t  $billto->setCity(\"Pecan Springs\");\n\t  $billto->setState(\"TX\");\n\t  $billto->setZip(\"44628\");\n\t  $billto->setCountry(\"USA\");\n  \n\t  // Create a Customer Profile Request\n\t  //  1. create a Payment Profile\n\t  //  2. create a Customer Profile   \n\t  //  3. Submit a CreateCustomerProfile Request\n\t  //  4. Validate Profiiel ID returned\n\n\t  $paymentprofile = new AnetAPI\\CustomerPaymentProfileType();\n\n\t  $paymentprofile->setCustomerType('individual');\n\t  $paymentprofile->setBillTo($billto);\n\t  $paymentprofile->setPayment($paymentCreditCard);\n\t  $paymentprofiles[] = $paymentprofile;\n\t  $customerprofile = new AnetAPI\\CustomerProfileType();\n\t  $customerprofile->setDescription(\"Customer 2 Test PHP\");\n\t  $merchantCustomerId = time().rand(1,150);\n\t  $customerprofile->setMerchantCustomerId($merchantCustomerId);\n\t  $customerprofile->setEmail(\"test2@domain.com\");\n\t  $customerprofile->setPaymentProfiles($paymentprofiles);\n\n\t  $request = new AnetAPI\\CreateCustomerProfileRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setRefId( $refId);\n\t  $request->setProfile($customerprofile);\n\t  $controller = new AnetController\\CreateCustomerProfileController($request);\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\t  echo \"SUCCESS: CreateCustomerProfile PROFILE ID : \" . $response->getCustomerProfileId() . \"\\n\";\n\n\t\t  $profileIdRequested = $response->getCustomerProfileId();\n\t   }\n\t  else\n\t  {\n\t\t  echo \"ERROR :  CreateCustomerProfile: Invalid response\\n\";\n\t\t  $errorMessages = $response->getMessages()->getMessage();\n\t\t  echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\t  // Retrieve an existing customer profile along with all the associated payment profiles and shipping addresses\n\n\t  $request = new AnetAPI\\GetCustomerProfileRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setCustomerProfileId($profileIdRequested);\n\t  $controller = new AnetController\\GetCustomerProfileController($request);\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\techo \"GetCustomerProfile SUCCESS : \" .  \"\\n\";\n\t\t$profileSelected = $response->getProfile();\n\t\t$paymentProfilesSelected = $profileSelected->getPaymentProfiles();\n\t\techo \"Profile Has \" . count($paymentProfilesSelected). \" Payment Profiles\" . \"\\n\";\n\n\t\tif($response->getSubscriptionIds() != null) \n\t\t{\n\t\t\tif($response->getSubscriptionIds() != null)\n\t\t\t{\n\n\t\t\t\techo \"List of subscriptions:\";\n\t\t\t\tforeach($response->getSubscriptionIds() as $subscriptionid)\n\t\t\t\t\techo $subscriptionid . \"\\n\";\n\t\t\t}\n\t\t}\n\t  }\n\t  else\n\t  {\n\t\techo \"ERROR :  GetCustomerProfile: Invalid response\\n\";\n\t\t$errorMessages = $response->getMessages()->getMessage();\n\t\techo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\t  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n  {\n\tgetCustomerProfile();\n  }\n?>\n"
  },
  {
    "path": "CustomerProfiles/get-customer-shipping-address.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction getCustomerShippingAddress($customerprofileid, $customeraddressid)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n    \n\t  // An existing customer profile id and shipping address id for this merchant name and transaction key\n\t  $customerProfileId = $customerprofileid;\n\t  $customerAddressId = $customeraddressid;\n\n\t  $request = new AnetAPI\\GetCustomerShippingAddressRequest();\n\t  $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setCustomerProfileId($customerProfileId);\n\t  $request->setCustomerAddressId($customerAddressId);\n\t  \n\t  $controller = new AnetController\\GetCustomerShippingAddressController($request);\n\t  \n\t  //Retrieving existing customer shipping address\n\t  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t  {\n\t\t  echo \"Get Customer Shipping Address SUCCESS\" . \"\\n\";\n\t\t  echo \"\tFirstName \t: \" . $response->getAddress()->getFirstName() . \"\\n\";\n\t\t  echo \"\tLastName \t: \" . $response->getAddress()->getLastName() . \"\\n\";\n\t\t  echo \"\tCompany \t: \" . $response->getAddress()->getCompany() . \"\\n\";\n\t\t  echo \"\tAddress \t: \" . $response->getAddress()->getAddress() . \"\\n\";\n\t\t  echo \"\tCity \t\t: \" . $response->getAddress()->getCity() . \"\\n\";\n\t\t  echo \"\tState \t\t: \" . $response->getAddress()->getState() . \"\\n\";\n\t\t  echo \"\tZip \t\t: \" . $response->getAddress()->getZip() . \"\\n\";\n\t\t  echo \"\tCountry \t: \" . $response->getAddress()->getCountry() . \"\\n\";\n\t\t  echo \"\tPhone Number \t: \" . $response->getAddress()->getPhoneNumber() . \"\\n\";\n\t\t  echo \"\tFAX Number \t: \" . $response->getAddress()->getFaxNumber() . \"\\n\";\n\t\t  echo \"Customer AddressId \t: \" . $response->getAddress()->getCustomerAddressId() . \"\\n\";\n\n\t\tif($response->getSubscriptionIds() != null) \n\t\t{\n\t\t\tif($response->getSubscriptionIds() != null)\n\t\t\t{\n\n\t\t\t\techo \"List of subscriptions:\";\n\t\t\t\tforeach($response->getSubscriptionIds() as $subscriptionid)\n\t\t\t\t\techo $subscriptionid . \"\\n\";\n\t\t\t}\n\t\t}\n\t   }\n\t  else\n\t  {\n\t\t  echo \"Get Customer Shipping Address  ERROR :  Invalid response\\n\";\n\t\t  $errorMessages = $response->getMessages()->getMessage();\n\t\t  echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t  }\n\t  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      getCustomerShippingAddress(\"36152127\",\"36976566\");\n?>\n"
  },
  {
    "path": "CustomerProfiles/update-customer-payment-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction updateCustomerPaymentProfile($customerProfileId = \"1916322670\",\n    $customerPaymentProfileId = \"1829639667\") \n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n\t$request = new AnetAPI\\GetCustomerPaymentProfileRequest();\n\t$request->setMerchantAuthentication($merchantAuthentication);\n\t$request->setRefId( $refId);\n\t$request->setCustomerProfileId($customerProfileId);\n\t$request->setCustomerPaymentProfileId($customerPaymentProfileId);\n\t  \n\t$controller = new AnetController\\GetCustomerPaymentProfileController($request);\n\t$response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\tif (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n\t{\n\t\t$billto = new AnetAPI\\CustomerAddressType();\n\t\t$billto = $response->getPaymentProfile()->getbillTo();\n\t\t\n\t\t$creditCard = new AnetAPI\\CreditCardType();\n\t\t$creditCard->setCardNumber( \"4111111111111111\" );\n\t\t$creditCard->setExpirationDate(\"2038-12\");\n\t\t\n\t\t$paymentCreditCard = new AnetAPI\\PaymentType();\n\t\t$paymentCreditCard->setCreditCard($creditCard);\n\t\t$paymentprofile = new AnetAPI\\CustomerPaymentProfileExType();\n\t\t$paymentprofile->setBillTo($billto);\n\t\t$paymentprofile->setCustomerPaymentProfileId($customerPaymentProfileId);\n\t\t$paymentprofile->setPayment($paymentCreditCard);\t\n\n\t\t// We're updating the billing address but everything has to be passed in an update\n\t\t// For card information you can pass exactly what comes back from an GetCustomerPaymentProfile\n\t\t// if you don't need to update that info\n\t\t  \n\t\t// Update the Bill To info for new payment type\n\t\t$billto->setFirstName(\"Mrs Mary\");\n\t\t$billto->setLastName(\"Doe\");\n\t\t$billto->setAddress(\"9 New St.\");\n\t\t$billto->setCity(\"Brand New City\");\n\t\t$billto->setState(\"WA\");\n\t\t$billto->setZip(\"98004\");\n\t\t$billto->setPhoneNumber(\"000-000-0000\");\n\t\t$billto->setfaxNumber(\"999-999-9999\");\n\t\t$billto->setCountry(\"USA\");\n\t\t \n\t\t// Update the Customer Payment Profile object\n\t\t$paymentprofile->setBillTo($billto);\n\n\t\t// Submit a UpdatePaymentProfileRequest\n\t\t$request = new AnetAPI\\UpdateCustomerPaymentProfileRequest();\n\t\t$request->setMerchantAuthentication($merchantAuthentication);\n\t\t$request->setCustomerProfileId($customerProfileId);\n\t\t$request->setPaymentProfile( $paymentprofile );\n\n\t\t$controller = new AnetController\\UpdateCustomerPaymentProfileController($request);\n\t\t$response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t\tif (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n\t\t{\n\t\t\t$Message = $response->getMessages()->getMessage();\n\t\t\tprint_r($response);\n\t\t\techo \"Update Customer Payment Profile SUCCESS: \" . $Message[0]->getCode() . \"  \" .$Message[0]->getText() . \"\\n\";\n\t\t}\n\t\telse if ($response != null)\n\t\t{\n\t\t\t$errorMessages = $response->getMessages()->getMessage();\n\t\t\techo \"Failed to Update Customer Payment Profile :  \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t\t}\n\t\n\t\treturn $response;\n\t}\n\telse\n\t{\n\t\techo \"Failed to Get Customer Payment Profile :  \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n\t}\n\n\treturn $response;\n}\n\nif(!defined('DONT_RUN_SAMPLES'))\n    updateCustomerPaymentProfile();\n?>\n"
  },
  {
    "path": "CustomerProfiles/update-customer-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction updateCustomerProfile()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n      // Create the payment data for a credit card\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber( \"4111111111111111\" );\n    $creditCard->setExpirationDate(\"2038-12\");\n    $paymentCreditCard = new AnetAPI\\PaymentType();\n    $paymentCreditCard->setCreditCard($creditCard);\n\n    // Create the Bill To info\n    $billto = new AnetAPI\\CustomerAddressType();\n    $billto->setFirstName(\"Ellen\");\n    $billto->setLastName(\"Johnson\");\n    $billto->setCompany(\"Souveniropolis\");\n    $billto->setAddress(\"14 Main Street\");\n    $billto->setCity(\"Pecan Springs\");\n    $billto->setState(\"TX\");\n    $billto->setZip(\"44628\");\n    $billto->setCountry(\"USA\");\n    \n   // Create a Customer Profile Request\n   //  1. create a Payment Profile\n   //  2. create a Customer Profile   \n   //  3. Submit a CreateCustomerProfile Request\n   //  4. Validate Profiiel ID returned\n\n    $paymentprofile = new AnetAPI\\CustomerPaymentProfileType();\n\n    $paymentprofile->setCustomerType('individual');\n    $paymentprofile->setBillTo($billto);\n    $paymentprofile->setPayment($paymentCreditCard);\n    $paymentprofiles[] = $paymentprofile;\n    $customerprofile = new AnetAPI\\CustomerProfileType();\n    $customerprofile->setDescription(\"Update Customer Profile Request Test for PHP\");\n    $merchantCustomerId = time().rand(1,150);\n    $customerprofile->setMerchantCustomerId($merchantCustomerId);\n    $customerprofile->setEmail(rand(0,10000) . \"@test.com\");\n    $customerprofile->setPaymentProfiles($paymentprofiles);\n\n    $request = new AnetAPI\\CreateCustomerProfileRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setProfile($customerprofile);\n    $controller = new AnetController\\CreateCustomerProfileController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    {\n        echo \"SUCCESS: CreateCustomerProfile PROFILE ID : \" . $response->getCustomerProfileId() . \"\\n\";\n\n        $profileidcreated = $response->getCustomerProfileId();\n     }\n    else\n    {\n        echo \"ERROR :  CreateCustomerProfile: Invalid response\\n\";\n    }\n    // Update an existing customer profile\n\n    $updatecustomerprofile = new AnetAPI\\CustomerProfileExType();\n    $updatecustomerprofile->setCustomerProfileId($profileidcreated);\n    $updatecustomerprofile->setDescription(\"Updated existing Profile Request\");\n    $updatecustomerprofile->setEmail(\"updated\".rand(0,10000).\"@test.com\");\n\n    $request = new AnetAPI\\UpdateCustomerProfileRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setProfile($updatecustomerprofile);\n\n    $controller = new AnetController\\UpdateCustomerProfileController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    {\n      echo \"UpdateCustomerProfile SUCCESS : \" .  \"\\n\";\n    // Validate the description and e-mail that was updated\n        $request = new AnetAPI\\GetCustomerProfileRequest();\n        $request->setMerchantAuthentication($merchantAuthentication);\n        $request->setCustomerProfileId($profileidcreated );\n        $controller = new AnetController\\GetCustomerProfileController($request);\n        $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n        if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n        {\n            echo \"Get updated CustomerProfile  SUCCESS : \" .  \"\\n\";\n            $profileselected = $response->getProfile();\n            echo \"Updated Customer Profile Customer description : \" . $profileselected->getDescription() . \"\\n\";\n            echo \"Updated Customer Profile EMail description : \" . $profileselected->getEmail() . \"\\n\";\n        }\n        else\n        {\n          echo \"ERROR :  GetCustomerProfile: Invalid response\\n\";\n          $errorMessages = $response->getMessages()->getMessage();\n          echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n        }\n    }\n    else\n    {\n      echo \"ERROR :  UpdateCustomerProfile: Invalid response\\n\";\n      $errorMessages = $response->getMessages()->getMessage();\n      echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n    updateCustomerProfile();\n?>\n"
  },
  {
    "path": "CustomerProfiles/update-customer-shipping-address.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction updateCustomerShippingAddress($customerprofileid, $customeraddressid)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n  // An existing customer profile id for this merchant name and transaction key\n  $existingcustomerprofileid = $customerprofileid;\n\n  // Create the customer shipping address\n  $customershippingaddress = new AnetAPI\\CustomerAddressExType();\n  $customershippingaddress->setFirstName(\"Jane\");\n  $customershippingaddress->setLastName(\"White\");\n  $customershippingaddress->setCompany(\"Addresses R Us\");\n  $customershippingaddress->setAddress(\"14 North Spring Street Suite 240\");\n  $customershippingaddress->setCity(\"Toms River\");\n  $customershippingaddress->setState(\"NJ\");\n  $customershippingaddress->setZip(\"08753\");\n  $customershippingaddress->setCountry(\"USA\");\n  $customershippingaddress->setPhoneNumber(\"201-000-0000\");\n  $customershippingaddress->setFaxNumber(\"973-999-9999\");\n  $customershippingaddress->setCustomerAddressId($customeraddressid);\n\n  // Update an existing customer shipping address for an existing customer profile\n  $request = new AnetAPI\\UpdateCustomerShippingAddressRequest();\n  $request->setMerchantAuthentication($merchantAuthentication);\n  $request->setCustomerProfileId($existingcustomerprofileid);\n  $request->setAddress($customershippingaddress);\n  $controller = new AnetController\\UpdateCustomerShippingAddressController($request);\n  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n  {\n      echo \"Update Customer Shipping Address SUCCESS.\\n\";\n   }\n  else\n  {\n      echo \"Update Customer Shipping Address  ERROR :  Invalid response\\n\";\n      $errorMessages = $response->getMessages()->getMessage();\n      echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n  }\n  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      updateCustomerShippingAddress( \"1929905607\",\"901116911\");\n?>\n"
  },
  {
    "path": "CustomerProfiles/validate-customer-payment-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n  \nfunction validateCustomerPaymentProfile($customerProfileId= \"1929905607\",\n    $customerPaymentProfileId= \"1842074814\"\n) {\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n  \n  // Use an existing payment profile ID for this Merchant name and Transaction key\n  //validationmode tests , does not send an email receipt\n  $validationmode = \"testMode\";\n\n  $request = new AnetAPI\\ValidateCustomerPaymentProfileRequest();\n  \n  $request->setMerchantAuthentication($merchantAuthentication);\n  $request->setCustomerProfileId($customerProfileId);\n  $request->setCustomerPaymentProfileId($customerPaymentProfileId);\n  $request->setValidationMode($validationmode);\n  \n  $controller = new AnetController\\ValidateCustomerPaymentProfileController($request);\n  $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n  \n  if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n  {\n      $validationMessages = $response->getMessages()->getMessage();\n      echo \"Response : \" . $validationMessages[0]->getCode() . \"  \" .$validationMessages[0]->getText() . \"\\n\";\n   }\n  else\n  {\n      echo \"ERROR :  Validate Customer Payment Profile: Invalid response\\n\";\n      $errorMessages = $response->getMessages()->getMessage();\n      echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n  }\n  return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      validateCustomerPaymentProfile();\n ?>\n"
  },
  {
    "path": "FraudManagement/approve-or-decline-held-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction approveOrDeclineHeldTransaction()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n      //create a transaction\n      $transactionRequestType = new AnetAPI\\HeldTransactionRequestType();\n      $transactionRequestType->setAction(\"approve\"); //other possible value: decline\n      $transactionRequestType->setRefTransId(\"60012148205\");\n      \n\n      $request = new AnetAPI\\UpdateHeldTransactionRequest();\n      $request->setMerchantAuthentication($merchantAuthentication);\n      $request->setHeldTransactionRequest( $transactionRequestType);\n      $controller = new AnetController\\UpdateHeldTransactionController($request);\n      $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n      \n\n      if ($response != null)\n      {\n        if($response->getMessages()->getResultCode() == \"Ok\")\n        {\n          $tresponse = $response->getTransactionResponse();\n          \n\t        if ($tresponse != null && $tresponse->getMessages() != null)   \n          {\n            echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n            echo \"Charge Credit Card AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n            echo \"Charge Credit Card TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n            echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n          }\n          else\n          {\n            echo \"Transaction Failed \\n\";\n            if($tresponse->getErrors() != null)\n            {\n              echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n              echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n            }\n          }\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          $tresponse = $response->getTransactionResponse();\n          if($tresponse != null && $tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n          }\n          else\n          {\n            echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n            echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n          }\n        }      \n      }\n      else\n      {\n        echo  \"No response returned \\n\";\n      }\n\n      return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n      approveOrDeclineHeldTransaction();\n?>\n"
  },
  {
    "path": "FraudManagement/get-held-transaction-list.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getHeldTransactionList() \n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n\n    $request = new AnetAPI\\GetUnsettledTransactionListRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setStatus(\"pendingApproval\");\n\n\n    $controller = new AnetController\\GetUnsettledTransactionListController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n\t\tif(null != $response->getTransactions())\n\t\t{\n\t\t\tforeach($response->getTransactions() as $tx)\n\t\t\t{\n\t\t\t  echo \"SUCCESS: TransactionID: \" . $tx->getTransId() . \"\\n\";\n\t\t\t}\n        }\n\t\telse{\n\t\t\techo \"No suspicious transactions for the merchant.\" . \"\\n\";\n\t\t}\n    }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getHeldTransactionList();\n\n?>\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Authorize.Net\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "MobileInAppTransactions/create-an-accept-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createAnAcceptTransaction($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment object for a payment nonce\n    $opaqueData = new AnetAPI\\OpaqueDataType();\n    $opaqueData->setDataDescriptor(\"COMMON.ACCEPT.INAPP.PAYMENT\");\n    $opaqueData->setDataValue(\"119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9\");\n    \n    // Add the payment data to a paymentType object\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setOpaqueData($opaqueData);\n\n    // Create order information\n    $order = new AnetAPI\\OrderType();\n    $order->invoiceNumber(\"10101\");\n    $order->setDescription(\"Golf Shirts\");\n\n    // Set the customer's Bill To address\n    $customerAddress = new AnetAPI\\CustomerAddressType();\n    $customerAddress->setFirstName(\"Ellen\");\n    $customerAddress->setLastName(\"Johnson\");\n    $customerAddress->setCompany(\"Souveniropolis\");\n    $customerAddress->setAddress(\"14 Main Street\");\n    $customerAddress->setCity(\"Pecan Springs\");\n    $customerAddress->setState(\"TX\");\n    $customerAddress->setZip(\"44628\");\n    $customerAddress->setCountry(\"USA\");\n\n    // Set the customer's identifying information\n    $customerData = new AnetAPI\\CustomerDataType();\n    $customerData->setType(\"individual\");\n    $customerData->setId(\"99999456654\");\n    $customerData->setEmail(\"EllenJohnson@example.com\");\n\n    //Add values for transaction settings\n    $duplicateWindowSetting = new AnetAPI\\SettingType();\n    $duplicateWindowSetting->setSettingName(\"duplicateWindow\");\n    $duplicateWindowSetting->setSettingValue(\"600\");\n\n    // Create a transactionRequestType object and add the previous objects to it\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"authCaptureTransaction\"); \n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setOrder($order);\n    $transactionRequestType->setPayment($paymentOne);\n    $transactionRequestType->setBillTo($customerAddress);\n    $transactionRequestType->setCustomer($customerData);\n    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);\n\n    // Assemble the complete transaction request\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n\n    if ($response != null) {\n        // Check to see if the API request was successfully received and acted upon\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            // Since the API request was successful, look for a transaction response\n            // and parse it to display the results of authorizing the card\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Successfully created transaction with Transaction ID: \" . $tresponse->getTransId() . \"\\n\";\n                echo \" Transaction Response Code: \" . $tresponse->getResponseCode() . \"\\n\";\n                echo \" Message Code: \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Auth Code: \" . $tresponse->getAuthCode() . \"\\n\";\n                echo \" Description: \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n            // Or, print errors if the API request wasn't successful\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error Code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error Message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }      \n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n      CreateAnAcceptTransaction(\"2.23\");\n}\n?>\n"
  },
  {
    "path": "MobileInAppTransactions/create-an-android-pay-transaction.php",
    "content": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createAnAndroidPayTransaction()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $op = new AnetAPI\\OpaqueDataType();\n    $op->setDataDescriptor(\"COMMON.ANDROID.INAPP.PAYMENT\");\n    $op->setDataValue(\"eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoiOTRlZTA1OTMzNWU1ODdlNTAxY2M0YmY5MDYxM2UwODE0ZjAwYTdiMDhiYzdjNjQ4ZmQ4NjVhMmFmNmEyMmNjMiIsInRyYW5zYWN0aW9uSWQiOiJjMWNhZjVhZTcyZjAwMzlhODJiYWQ5MmI4MjgzNjM3MzRmODViZjJmOWNhZGYxOTNkMWJhZDlkZGNiNjBhNzk1IiwiZXBoZW1lcmFsUHVibGljS2V5IjoiTUlJQlN6Q0NBUU1HQnlxR1NNNDlBZ0V3Z2ZjQ0FRRXdMQVlIS29aSXpqMEJBUUloQVBcL1wvXC9cLzhBQUFBQkFBQUFBQUFBQUFBQUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL01Gc0VJUFwvXC9cL1wvOEFBQUFCQUFBQUFBQUFBQUFBQUFBQVwvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cLzhCQ0JheGpYWXFqcVQ1N1BydlZWMm1JYThaUjBHc014VHNQWTd6ancrSjlKZ1N3TVZBTVNkTmdpRzV3U1RhbVo0NFJPZEpyZUJuMzZRQkVFRWF4ZlI4dUVzUWtmNHZPYmxZNlJBOG5jRGZZRXQ2ek9nOUtFNVJkaVl3cFpQNDBMaVwvaHBcL200N242MHA4RDU0V0s4NHpWMnN4WHM3THRrQm9ONzlSOVFJaEFQXC9cL1wvXC84QUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cLys4NXZxdHB4ZWVoUE81eXNMOFl5VlJBZ0VCQTBJQUJHbStnc2wwUFpGVFwva0RkVVNreHd5Zm84SnB3VFFRekJtOWxKSm5tVGw0REdVdkFENEdzZUdqXC9wc2hCWjBLM1RldXFEdFwvdERMYkUrOFwvbTB5Q21veHc9IiwicHVibGljS2V5SGFzaCI6IlwvYmI5Q05DMzZ1QmhlSEZQYm1vaEI3T28xT3NYMkora0pxdjQ4ek9WVmlRPSJ9LCJzaWduYXR1cmUiOiJNSUlEUWdZSktvWklodmNOQVFjQ29JSURNekNDQXk4Q0FRRXhDekFKQmdVckRnTUNHZ1VBTUFzR0NTcUdTSWIzRFFFSEFhQ0NBaXN3Z2dJbk1JSUJsS0FEQWdFQ0FoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQXdKekVsTUNNR0ExVUVBeDRjQUdNQWFBQnRBR0VBYVFCQUFIWUFhUUJ6QUdFQUxnQmpBRzhBYlRBZUZ3MHhOREF4TURFd05qQXdNREJhRncweU5EQXhNREV3TmpBd01EQmFNQ2N4SlRBakJnTlZCQU1lSEFCakFHZ0FiUUJoQUdrQVFBQjJBR2tBY3dCaEFDNEFZd0J2QUcwd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFOQzgra2d0Z212V0YxT3pqZ0ROcmpURUJSdW9cLzVNS3ZsTTE0NnBBZjdHeDQxYmxFOXc0ZklYSkFEN0ZmTzdRS2pJWFlOdDM5ckx5eTd4RHdiXC81SWtaTTYwVFoyaUkxcGo1NVVjOGZkNGZ6T3BrM2Z0WmFRR1hOTFlwdEcxZDlWN0lTODJPdXA5TU1vMUJQVnJYVFBITmNzTTk5RVBVblBxZGJlR2M4N20wckFnTUJBQUdqWERCYU1GZ0dBMVVkQVFSUk1FK0FFSFpXUHJXdEpkN1laNDMxaENnN1lGU2hLVEFuTVNVd0l3WURWUVFESGh3QVl3Qm9BRzBBWVFCcEFFQUFkZ0JwQUhNQVlRQXVBR01BYndCdGdoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQURnWUVBYlVLWUNrdUlLUzlRUTJtRmNNWVJFSW0ybCtYZzhcL0pYditHQlZRSmtPS29zY1k0aU5ERkFcL2JRbG9nZjlMTFU4NFRId05SbnN2VjNQcnY3UlRZODFncTBkdEM4elljQWFBa0NISUkzeXFNbko0QU91NkVPVzlrSmsyMzJnU0U3V2xDdEhiZkxTS2Z1U2dRWDhLWFFZdVpMazJScjYzTjhBcFhzWHdCTDNjSjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0=\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setOpaqueData($op);\n\n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"authCaptureTransaction\");\n    $transactionRequestType->setAmount(151);\n    $transactionRequestType->setPayment($paymentOne);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \" AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \" TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif(!defined('DONT_RUN_SAMPLES'))\n    createAnAndroidPayTransaction();\n?>\n"
  },
  {
    "path": "MobileInAppTransactions/create-an-apple-pay-transaction.php",
    "content": "<?php\r\nrequire 'vendor/autoload.php';\r\nrequire_once 'constants/SampleCodeConstants.php';\r\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\r\nuse net\\authorize\\api\\controller as AnetController;\r\n\r\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\r\n\r\nfunction createAnApplePayTransaction()\r\n{\r\n    /* Create a merchantAuthenticationType object with authentication details\r\n       retrieved from the constants file */\r\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\r\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\r\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\r\n    \r\n    // Set the transaction's refId\r\n    $refId = 'ref' . time();\r\n\r\n    $op = new AnetAPI\\OpaqueDataType();\r\n    $op->setDataDescriptor(\"COMMON.APPLE.INAPP.PAYMENT\");\r\n    $op->setDataValue(\"eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoiOTRlZTA1OTMzNWU1ODdlNTAxY2M0YmY5MDYxM2UwODE0ZjAwYTdiMDhiYzdjNjQ4ZmQ4NjVhMmFmNmEyMmNjMiIsInRyYW5zYWN0aW9uSWQiOiJjMWNhZjVhZTcyZjAwMzlhODJiYWQ5MmI4MjgzNjM3MzRmODViZjJmOWNhZGYxOTNkMWJhZDlkZGNiNjBhNzk1IiwiZXBoZW1lcmFsUHVibGljS2V5IjoiTUlJQlN6Q0NBUU1HQnlxR1NNNDlBZ0V3Z2ZjQ0FRRXdMQVlIS29aSXpqMEJBUUloQVBcL1wvXC9cLzhBQUFBQkFBQUFBQUFBQUFBQUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL01Gc0VJUFwvXC9cL1wvOEFBQUFCQUFBQUFBQUFBQUFBQUFBQVwvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cLzhCQ0JheGpYWXFqcVQ1N1BydlZWMm1JYThaUjBHc014VHNQWTd6ancrSjlKZ1N3TVZBTVNkTmdpRzV3U1RhbVo0NFJPZEpyZUJuMzZRQkVFRWF4ZlI4dUVzUWtmNHZPYmxZNlJBOG5jRGZZRXQ2ek9nOUtFNVJkaVl3cFpQNDBMaVwvaHBcL200N242MHA4RDU0V0s4NHpWMnN4WHM3THRrQm9ONzlSOVFJaEFQXC9cL1wvXC84QUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cLys4NXZxdHB4ZWVoUE81eXNMOFl5VlJBZ0VCQTBJQUJHbStnc2wwUFpGVFwva0RkVVNreHd5Zm84SnB3VFFRekJtOWxKSm5tVGw0REdVdkFENEdzZUdqXC9wc2hCWjBLM1RldXFEdFwvdERMYkUrOFwvbTB5Q21veHc9IiwicHVibGljS2V5SGFzaCI6IlwvYmI5Q05DMzZ1QmhlSEZQYm1vaEI3T28xT3NYMkora0pxdjQ4ek9WVmlRPSJ9LCJzaWduYXR1cmUiOiJNSUlEUWdZSktvWklodmNOQVFjQ29JSURNekNDQXk4Q0FRRXhDekFKQmdVckRnTUNHZ1VBTUFzR0NTcUdTSWIzRFFFSEFhQ0NBaXN3Z2dJbk1JSUJsS0FEQWdFQ0FoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQXdKekVsTUNNR0ExVUVBeDRjQUdNQWFBQnRBR0VBYVFCQUFIWUFhUUJ6QUdFQUxnQmpBRzhBYlRBZUZ3MHhOREF4TURFd05qQXdNREJhRncweU5EQXhNREV3TmpBd01EQmFNQ2N4SlRBakJnTlZCQU1lSEFCakFHZ0FiUUJoQUdrQVFBQjJBR2tBY3dCaEFDNEFZd0J2QUcwd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFOQzgra2d0Z212V0YxT3pqZ0ROcmpURUJSdW9cLzVNS3ZsTTE0NnBBZjdHeDQxYmxFOXc0ZklYSkFEN0ZmTzdRS2pJWFlOdDM5ckx5eTd4RHdiXC81SWtaTTYwVFoyaUkxcGo1NVVjOGZkNGZ6T3BrM2Z0WmFRR1hOTFlwdEcxZDlWN0lTODJPdXA5TU1vMUJQVnJYVFBITmNzTTk5RVBVblBxZGJlR2M4N20wckFnTUJBQUdqWERCYU1GZ0dBMVVkQVFSUk1FK0FFSFpXUHJXdEpkN1laNDMxaENnN1lGU2hLVEFuTVNVd0l3WURWUVFESGh3QVl3Qm9BRzBBWVFCcEFFQUFkZ0JwQUhNQVlRQXVBR01BYndCdGdoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQURnWUVBYlVLWUNrdUlLUzlRUTJtRmNNWVJFSW0ybCtYZzhcL0pYditHQlZRSmtPS29zY1k0aU5ERkFcL2JRbG9nZjlMTFU4NFRId05SbnN2VjNQcnY3UlRZODFncTBkdEM4elljQWFBa0NISUkzeXFNbko0QU91NkVPVzlrSmsyMzJnU0U3V2xDdEhiZkxTS2Z1U2dRWDhLWFFZdVpMazJScjYzTjhBcFhzWHdCTDNjSjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0=\");\r\n    $paymentOne = new AnetAPI\\PaymentType();\r\n    $paymentOne->setOpaqueData($op);\r\n\r\n    //create a transaction\r\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\r\n    $transactionRequestType->setTransactionType( \"authCaptureTransaction\");\r\n    $transactionRequestType->setAmount(151);\r\n    $transactionRequestType->setPayment($paymentOne);\r\n\r\n    $request = new AnetAPI\\CreateTransactionRequest();\r\n    $request->setMerchantAuthentication($merchantAuthentication);\r\n    $request->setRefId( $refId);\r\n    $request->setTransactionRequest( $transactionRequestType);\r\n\r\n    $controller = new AnetController\\CreateTransactionController($request);\r\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\r\n\r\n\r\n    if ($response != null)\r\n    {\r\n      if($response->getMessages()->getResultCode() == \"Ok\")\r\n      {\r\n        $tresponse = $response->getTransactionResponse();\r\n        \r\n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \r\n        {\r\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\r\n          echo \" AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\r\n          echo \" TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\r\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \r\n          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\r\n        }\r\n        else\r\n        {\r\n          echo \"Transaction Failed \\n\";\r\n          if($tresponse->getErrors() != null)\r\n          {\r\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\r\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \r\n          }\r\n        }\r\n      }\r\n      else\r\n      {\r\n        echo \"Transaction Failed \\n\";\r\n        $tresponse = $response->getTransactionResponse();\r\n        if($tresponse != null && $tresponse->getErrors() != null)\r\n        {\r\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\r\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \r\n        }\r\n        else\r\n        {\r\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\r\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\r\n        }\r\n      }      \r\n    }\r\n    else\r\n    {\r\n      echo  \"No response returned \\n\";\r\n    }\r\n\r\n    return $response;\r\n}\r\n\r\nif(!defined('DONT_RUN_SAMPLES'))\r\n    createAnApplePayTransaction();\r\n?>\r\n"
  },
  {
    "path": "MobileInAppTransactions/create-google-pay-transaction.php",
    "content": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createGooglePayTransaction()\n{\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    $refId = 'ref' . time();\n\n    $opaqueData = new AnetAPI\\OpaqueDataType();\n    $opaqueData->setDataDescriptor(\"COMMON.GOOGLE.INAPP.PAYMENT\");\n    $opaqueData->setDataValue(\"1234567890ABCDEF1111AAAA2222BBBB3333CCCC4444DDDD5555EEEE6666FFFF7777888899990000\");\n    $paymentType = new AnetAPI\\PaymentType();\n    $paymentType->setOpaqueData($opaqueData);\n\n    $lineItem = new AnetAPI\\LineItemType();\n    $lineItem->setItemId(\"1\");\n    $lineItem->setName(\"vase\");\n    $lineItem->setDescription(\"Cannes logo\");\n    $lineItem->setQuantity(18);\n    $lineItem->setUnitPrice(45.00);\n\n    $lineItemsArray = array();\n    $lineItemsArray[0] = $lineItem;\n\n    $tax = new AnetAPI\\ExtendedAmountType();\n    $tax->setAmount(5.00);\n    $tax->setName(\"level2 tax name\");\n    $tax->setDescription(\"level2 tax\");\n\n    $userField = new AnetAPI\\UserFieldType();\n    $userFields = array();\n\n    $userField->setName(\"UserDefinedFieldName1\");\n    $userField->setValue(\"UserDefinedFieldValue1\");\n    $userFields[0] = $userField;\n\n    $userField->setName(\"UserDefinedFieldName2\");\n    $userField->setValue(\"UserDefinedFieldValue2\");\n    $userFields[1] = $userField;\n\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\");\n    $transactionRequestType->setAmount(151);\n    $transactionRequestType->setPayment($paymentType);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \" AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \" TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif(!defined('DONT_RUN_SAMPLES'))\n    createGooglePayTransaction();\n?>\n"
  },
  {
    "path": "PayPalExpressCheckout/authorization-and-capture-continued.php",
    "content": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api\\contract\\v1 as AnetAPI;\n    use net\\authorize\\api\\controller as AnetController;\n\n    define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalAuthorizeCaptureContinued($refTransId, $payerID)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Set PayPal compatible merchant credentials\n    $payPalType=new AnetAPI\\PayPalType();\n    $payPalType->setPayerID($payerID);\n\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setPayPal($payPalType);\n\n    // Create an authorize and capture continued transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureContinueTransaction\");\n    $transactionRequestType->setPayment($paymentOne);\n    $transactionRequestType->setRefTransId($refTransId);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setTransactionRequest($transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null) {\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            $tresponse = $response->getTransactionResponse();\n          \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \"Transaction Response...\\n\";\n                echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n                //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent\n                echo \"Secure acceptance URL: \".$tresponse->getSecureAcceptance()->getSecureAcceptanceUrl().\"\\n\";\n                echo \"Transaction ID: \".$tresponse->getTransId().\"\\n\";\n                echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }\n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    payPalAuthorizeCaptureContinued(\"2241708986\", \"6ZSCSYG33VP8Q\");\n}\n"
  },
  {
    "path": "PayPalExpressCheckout/authorization-and-capture.php",
    "content": "<?php\n\trequire 'vendor/autoload.php';\n\trequire_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n    define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalAuthorizeCapture($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $payPalType=new AnetAPI\\PayPalType();\n    $payPalType->setCancelUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $payPalType->setSuccessUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setPayPal($payPalType);\n\n\t\t// Create an authorize and capture transaction\n\t\t$transactionRequestType = new AnetAPI\\TransactionRequestType();\n\t\t$transactionRequestType->setTransactionType( \"authCaptureTransaction\");\n\t\t$transactionRequestType->setPayment($paymentOne);\n\t\t$transactionRequestType->setAmount($amount);\n\n\t\t$request = new AnetAPI\\CreateTransactionRequest();\n\t\t$request->setMerchantAuthentication($merchantAuthentication);\n\t\t$request->setTransactionRequest( $transactionRequestType);\n\t\t$controller = new AnetController\\CreateTransactionController($request);\n\t\t$response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n\t    if ($response != null)\n\t    {\n\t      if($response->getMessages()->getResultCode() == \"Ok\")\n\t      {\n\t        $tresponse = $response->getTransactionResponse();\n\t        \n\t        if ($tresponse != null && $tresponse->getMessages() != null)   \n\t        {\n          \t\techo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n\t\t\t\t//Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent\n\t\t\t\techo \"Secure acceptance URL: \".$tresponse->getSecureAcceptance()->getSecureAcceptanceUrl().\"\\n\";\n\t\t\t\techo \"Transaction ID: \".$tresponse->getTransId().\"\\n\";\n\t\t\t\t\n\t          \techo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t          \techo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n\t        }\n\t        else\n\t        {\n\t          echo \"Transaction Failed \\n\";\n\t          if($tresponse->getErrors() != null)\n\t          {\n\t            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n\t            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n\t          }\n\t        }\n\t      }\n\t      else\n\t      {\n\t        echo \"Transaction Failed \\n\";\n\t        $tresponse = $response->getTransactionResponse();\n\t        \n\n\t        if($tresponse != null && $tresponse->getErrors() != null)\n\t        {\n\t          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n\t          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n\t        }\n\t        else\n\t        {\n\t          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n\t          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n\t        }\n\t      }      \n\t    }\n\t    else\n\t    {\n\t      echo  \"No response returned \\n\";\n\t    }\n\n\t\treturn $response;\n\t}\n\n  \tif(!defined('DONT_RUN_SAMPLES'))\n    \tpayPalAuthorizeCapture(12.322);\n?>\n"
  },
  {
    "path": "PayPalExpressCheckout/authorization-only-continued.php",
    "content": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api\\contract\\v1 as AnetAPI;\n    use net\\authorize\\api\\controller as AnetController;\n\n    define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalAuthorizeOnlyContinued($transactionId, $payerId)\n{\n\n    echo \"PayPal Authorize Only Continued Transaction\\n\";\n    \n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Set PayPal compatible merchant credentials\n    $payPalType=new AnetAPI\\PayPalType();\n    $payPalType->setPayerID($payerID);\n\n    $paypal_type->setSuccessUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $paypal_type->setCancelUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    \n    $payment_type = new AnetAPI\\PaymentType();\n    $payment_type->setPayPal($paypal_type);\n\n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authOnlyContinueTransaction\");\n    $transactionRequestType->setRefTransId($transactionId);\n    $transactionRequestType->setAmount(125.34);\n    $transactionRequestType->setPayment($payment_type);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null) {\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n                echo \"TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n                echo \"Payer ID : \" . $tresponse->getSecureAcceptance()->getPayerID();\n                echo \"Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }\n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n  \nif (!defined('DONT_RUN_SAMPLES')) {\n    payPalAuthorizeOnlyContinued(\"2241711631\", \"JJLRRB29QC7RU\");\n}\n"
  },
  {
    "path": "PayPalExpressCheckout/authorization-only.php",
    "content": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalAuthorizeOnly($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data for a paypal account\n    $payPalType = new AnetAPI\\PayPalType();\n    $payPalType->setCancelUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $payPalType->setSuccessUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setPayPal($payPalType);\n\n    //create a auth-only transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"authOnlyTransaction\");\n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setPayment($paymentOne);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n            echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n            echo \"Received response code: \".$tresponse->getResponseCode().\"\\n\";\n            //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent\\n\";\n            echo \"Secure acceptance URL: \".$tresponse->getSecureAcceptance()->getSecureAcceptanceUrl().\"\\n\";\n            echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif(!defined('DONT_RUN_SAMPLES'))\n    payPalAuthorizeOnly(23.34);\n\n?>\n"
  },
  {
    "path": "PayPalExpressCheckout/credit.php",
    "content": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalCredit($transactionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    //use transaction of already settled paypal checkout transaction\n    $refTransId = $transactionId;\n\n    // Create the payment data for a paypal account\n    $payPalType = new AnetAPI\\PayPalType();\n    $payPalType->setCancelUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $payPalType->setSuccessUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setPayPal($payPalType);\n\n    //create a refund transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"refundTransaction\");\n    $transactionRequestType->setAmount(181);\n    $transactionRequestType->setPayment($paymentOne);\n    ///refTransId of successfully settled transaction\n    $transactionRequestType->setRefTransId($refTransId);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n            echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n            echo \"Credit SUCCESS AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n            echo \"Credit TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n            echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif(!defined('DONT_RUN_SAMPLES')){\n\t//use transaction id of already settled transaction\n  payPalCredit(\"2241762126\");\n}\n?>\n"
  },
  {
    "path": "PayPalExpressCheckout/get-details.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalGetDetails($transactionId)\n{\n\n    echo \"PayPal Get Details Transaction\\n\";\n    \n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    //create a transaction of type get details\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"getDetailsTransaction\"); \n    \n    //replace following transaction ID with your transaction ID for which the details are required\n    $transactionRequestType->setRefTransId($transactionId);\n\n    // Create the payment data for a paypal account\n    $payPalType = new AnetAPI\\PayPalType();\n    $payPalType->setCancelUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $payPalType->setSuccessUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setPayPal($payPalType);\n\n    $transactionRequestType->setPayment($paymentOne);\n\n    //create a transaction request\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n\n    //execute the api call to get transaction details\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Transaction Response...\\n\";\n          echo \"Received response code: \".$tresponse->getResponseCode().\"\\n\";\n          echo \"Transaction ID: \".$tresponse->getTransId().\"\\n\";\n          //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent\n          if(null != $tresponse->getSecureAcceptance())\n          {\n            echo \"Payer ID : \" . $tresponse->getSecureAcceptance()->getPayerID() . \"\\n\";\n          }\n          \n          //parse the shipping information from response\n          $shipping_response = $tresponse->getShipTo();\n          if(null != $shipping_response)\n          {\n            echo \"Shipping address : \" . $shipping_response->getAddress() . \", \" . $shipping_response->getCity()\n              . \", \" . $shipping_response->getState() . \", \" . $shipping_response->getCountry() . \"\\n\";\n          }          \n\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n\nif(!defined('DONT_RUN_SAMPLES'))\n  payPalGetDetails(\"60007107304\");\n\n?>"
  },
  {
    "path": "PayPalExpressCheckout/prior-authorization-capture.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalPriorAuthorizationCapture($transactionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $payPalType = new AnetAPI\\PayPalType();\n    $payPalType->setSuccessUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n    $payPalType->setCancelUrl(\"http://www.merchanteCommerceSite.com/Success/TC25262\");\n\n    $paymentType = new AnetAPI\\PaymentType();\n    $paymentType->setPayPal($payPalType);\n\n    $transactionRequest = new AnetAPI\\TransactionRequestType();\n    $transactionRequest->setTransactionType(\"priorAuthCaptureTransaction\");\n    $transactionRequest->setPayment($paymentType);\n    $transactionRequest->setAmount(floatval(19.45));\n    $transactionRequest->setRefTransId($transactionId);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest($transactionRequest);\n    \n    $controller = new AnetController\\CreateTransactionController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Prior Authorization capture AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n  {\n    payPalPriorAuthorizationCapture(\"2249863278\");\n  }\n?>"
  },
  {
    "path": "PayPalExpressCheckout/void.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction payPalVoid($transactionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $payPalType = new AnetAPI\\PayPalType();\n    $payPalType->setSuccessUrl(\"\");\n    $payPalType->setCancelUrl(\"\");\n\n    $paymentType = new AnetAPI\\PaymentType();\n    $paymentType->setPayPal($payPalType);\n\n    $transactionRequest = new AnetAPI\\TransactionRequestType();\n    $transactionRequest->setTransactionType(\"voidTransaction\");\n    $transactionRequest->setPayment($paymentType);\n    $transactionRequest->setRefTransId($transactionId);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest($transactionRequest);\n    \n    $controller = new AnetController\\CreateTransactionController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Void transaction SUCCESS TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    payPalVoid(\"2241706281\");\n\n  ?>"
  },
  {
    "path": "PaymentTransactions/authorize-credit-card.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction authorizeCreditCard($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data for a credit card\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n    $creditCard->setCardCode(\"123\");\n\n    // Add the payment data to a paymentType object\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setCreditCard($creditCard);\n\n    // Create order information\n    $order = new AnetAPI\\OrderType();\n    $order->setInvoiceNumber(\"10101\");\n    $order->setDescription(\"Golf Shirts\");\n\n    // Set the customer's Bill To address\n    $customerAddress = new AnetAPI\\CustomerAddressType();\n    $customerAddress->setFirstName(\"Ellen\");\n    $customerAddress->setLastName(\"Johnson\");\n    $customerAddress->setCompany(\"Souveniropolis\");\n    $customerAddress->setAddress(\"14 Main Street\");\n    $customerAddress->setCity(\"Pecan Springs\");\n    $customerAddress->setState(\"TX\");\n    $customerAddress->setZip(\"44628\");\n    $customerAddress->setCountry(\"USA\");\n\n    // Set the customer's identifying information\n    $customerData = new AnetAPI\\CustomerDataType();\n    $customerData->setType(\"individual\");\n    $customerData->setId(\"99999456654\");\n    $customerData->setEmail(\"EllenJohnson@example.com\");\n\n    // Add values for transaction settings\n    $duplicateWindowSetting = new AnetAPI\\SettingType();\n    $duplicateWindowSetting->setSettingName(\"duplicateWindow\");\n    $duplicateWindowSetting->setSettingValue(\"60\");\n\n    // Add some merchant defined fields. These fields won't be stored with the transaction,\n    // but will be echoed back in the response.\n    $merchantDefinedField1 = new AnetAPI\\UserFieldType();\n    $merchantDefinedField1->setName(\"customerLoyaltyNum\");\n    $merchantDefinedField1->setValue(\"1128836273\");\n\n    $merchantDefinedField2 = new AnetAPI\\UserFieldType();\n    $merchantDefinedField2->setName(\"favoriteColor\");\n    $merchantDefinedField2->setValue(\"blue\");\n\n    // Create a TransactionRequestType object and add the previous objects to it\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authOnlyTransaction\"); \n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setOrder($order);\n    $transactionRequestType->setPayment($paymentOne);\n    $transactionRequestType->setBillTo($customerAddress);\n    $transactionRequestType->setCustomer($customerData);\n    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);\n    $transactionRequestType->addToUserFields($merchantDefinedField1);\n    $transactionRequestType->addToUserFields($merchantDefinedField2);\n\n    // Assemble the complete transaction request\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n\n    if ($response != null) {\n        // Check to see if the API request was successfully received and acted upon\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            // Since the API request was successful, look for a transaction response\n            // and parse it to display the results of authorizing the card\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Successfully created transaction with Transaction ID: \" . $tresponse->getTransId() . \"\\n\";\n                echo \" Transaction Response Code: \" . $tresponse->getResponseCode() . \"\\n\";\n                echo \" Message Code: \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Auth Code: \" . $tresponse->getAuthCode() . \"\\n\";\n                echo \" Description: \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n            // Or, print errors if the API request wasn't successful\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error Code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error Message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }      \n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    authorizeCreditCard(\"2.23\");\n}\n?>"
  },
  {
    "path": "PaymentTransactions/capture-funds-authorized-through-another-channel.php",
    "content": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1 as AnetAPI;\nuse net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction captureFundsAuthorizedThroughAnotherChannel($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setCreditCard($creditCard);\n\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"captureOnlyTransaction\");\n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setPayment($paymentOne);\n\n    //Auth code of the previously authorized  amount\n    $transactionRequestType->setAuthCode(\"ROHNFQ\");\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Successful.\" . \"\\n\";\n          echo \"Capture funds authorized through another channel TRANS ID  : \" . $tresponse->getTransId() . \" Amount : $amount \\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\nif(!defined('DONT_RUN_SAMPLES'))\n    captureFundsAuthorizedThroughAnotherChannel((rand(1, 999)/12*12));\n?>\n"
  },
  {
    "path": "PaymentTransactions/capture-previously-authorized-amount.php",
    "content": "<?php\n require 'vendor/autoload.php';\n require_once 'constants/SampleCodeConstants.php';\n use net\\authorize\\api\\contract\\v1 as AnetAPI;\n use net\\authorize\\api\\controller as AnetController;\n\n define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\n function capturePreviouslyAuthorizedAmount($transactionid)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Now capture the previously authorized  amount\n    echo \"Capturing the Authorization with transaction ID : \" . $transactionid . \"\\n\";\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"priorAuthCaptureTransaction\");\n    $transactionRequestType->setRefTransId($transactionid);\n\n    \n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n            echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n            echo \"Successful.\" . \"\\n\";\n            echo \"Capture Previously Authorized Amount, Trans ID : \" . $tresponse->getRefTransId() . \"\\n\";\n            echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n if(!defined('DONT_RUN_SAMPLES'))\n    capturePreviouslyAuthorizedAmount(60007076002);\n?>\n"
  },
  {
    "path": "PaymentTransactions/charge-credit-card.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction chargeCreditCard($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data for a credit card\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n    $creditCard->setCardCode(\"123\");\n\n    // Add the payment data to a paymentType object\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setCreditCard($creditCard);\n\n    // Create order information\n    $order = new AnetAPI\\OrderType();\n    $order->setInvoiceNumber(\"10101\");\n    $order->setDescription(\"Golf Shirts\");\n\n    // Set the customer's Bill To address\n    $customerAddress = new AnetAPI\\CustomerAddressType();\n    $customerAddress->setFirstName(\"Ellen\");\n    $customerAddress->setLastName(\"Johnson\");\n    $customerAddress->setCompany(\"Souveniropolis\");\n    $customerAddress->setAddress(\"14 Main Street\");\n    $customerAddress->setCity(\"Pecan Springs\");\n    $customerAddress->setState(\"TX\");\n    $customerAddress->setZip(\"44628\");\n    $customerAddress->setCountry(\"USA\");\n\n    // Set the customer's identifying information\n    $customerData = new AnetAPI\\CustomerDataType();\n    $customerData->setType(\"individual\");\n    $customerData->setId(\"99999456654\");\n    $customerData->setEmail(\"EllenJohnson@example.com\");\n\n    // Add values for transaction settings\n    $duplicateWindowSetting = new AnetAPI\\SettingType();\n    $duplicateWindowSetting->setSettingName(\"duplicateWindow\");\n    $duplicateWindowSetting->setSettingValue(\"60\");\n\n    // Add some merchant defined fields. These fields won't be stored with the transaction,\n    // but will be echoed back in the response.\n    $merchantDefinedField1 = new AnetAPI\\UserFieldType();\n    $merchantDefinedField1->setName(\"customerLoyaltyNum\");\n    $merchantDefinedField1->setValue(\"1128836273\");\n\n    $merchantDefinedField2 = new AnetAPI\\UserFieldType();\n    $merchantDefinedField2->setName(\"favoriteColor\");\n    $merchantDefinedField2->setValue(\"blue\");\n\n    // Create a TransactionRequestType object and add the previous objects to it\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\");\n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setOrder($order);\n    $transactionRequestType->setPayment($paymentOne);\n    $transactionRequestType->setBillTo($customerAddress);\n    $transactionRequestType->setCustomer($customerData);\n    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);\n    $transactionRequestType->addToUserFields($merchantDefinedField1);\n    $transactionRequestType->addToUserFields($merchantDefinedField2);\n\n    // Assemble the complete transaction request\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n\n    // Create the controller and get the response\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n\n    if ($response != null) {\n        // Check to see if the API request was successfully received and acted upon\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            // Since the API request was successful, look for a transaction response\n            // and parse it to display the results of authorizing the card\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Successfully created transaction with Transaction ID: \" . $tresponse->getTransId() . \"\\n\";\n                echo \" Transaction Response Code: \" . $tresponse->getResponseCode() . \"\\n\";\n                echo \" Message Code: \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Auth Code: \" . $tresponse->getAuthCode() . \"\\n\";\n                echo \" Description: \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n            // Or, print errors if the API request wasn't successful\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error Code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error Message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error Code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error Message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }\n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    chargeCreditCard(\"2.23\");\n}\n"
  },
  {
    "path": "PaymentTransactions/charge-customer-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction chargeCustomerProfile($profileid, $paymentprofileid, $amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $profileToCharge = new AnetAPI\\CustomerProfilePaymentType();\n    $profileToCharge->setCustomerProfileId($profileid);\n    $paymentProfile = new AnetAPI\\PaymentProfileType();\n    $paymentProfile->setPaymentProfileId($paymentprofileid);\n    $profileToCharge->setPaymentProfile($paymentProfile);\n\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"authCaptureTransaction\"); \n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setProfile($profileToCharge);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo  \"Charge Customer Profile APPROVED  :\" . \"\\n\";\n          echo \" Charge Customer Profile AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \" Charge Customer Profile TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }\n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    chargeCustomerProfile(\"36731856\",\"32689274\",12.23);\n?>\n"
  },
  {
    "path": "PaymentTransactions/charge-tokenized-credit-card.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction chargeTokenizedCreditCard($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data for a credit card\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n    // Set the token specific info\n    $creditCard->setIsPaymentToken(true);\n    $creditCard->setCryptogram(\"EjRWeJASNFZ4kBI0VniQEjRWeJA=\");\n    \n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setCreditCard($creditCard);\n    \n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\"); \n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setPayment($paymentOne);\n\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n        if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Charge Tokenized Credit Card AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \"Charge Tokenized Credit Card TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n    chargeTokenizedCreditCard(12.23);\n?>\n"
  },
  {
    "path": "PaymentTransactions/create-chase-pay-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createChasePayTransaction($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data for a credit card\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n    $creditCard->setCardCode(\"999\");\n    // Set the token specific info\n    $creditCard->setIsPaymentToken(true);\n    $creditCard->setCryptogram(\"EjRWeJASNFZ4kBI0VniQEjRWeJA=\");\n    $creditCard->setTokenRequestorName(\"CHASE_PAY\");\n    $creditCard->setTokenRequestorId(\"12345678901\");\n    $creditCard->setTokenRequestorEci(\"07\");\n    \n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setCreditCard($creditCard);\n    \n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\"); \n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setPayment($paymentOne);\n\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n        if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Charge Tokenized Credit Card AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \"Charge Tokenized Credit Card TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n          echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n          echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n  createChasePayTransaction(12.23);\n?>\n"
  },
  {
    "path": "PaymentTransactions/credit-bank-account.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction creditBankAccount($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    //Generate random bank account number\n    $randomAccountNumber= rand(100000000,9999999999);\n\n    // Create the payment data for a Bank Account\n    $bankAccount = new AnetAPI\\BankAccountType();\n    $bankAccount->setAccountType('checking');\n    // see eCheck documentation for proper echeck type to use for each situation\n    //$bankAccount->setEcheckType('WEB');\n    $bankAccount->setRoutingNumber('122000661'); //('122235821'); //('125008547');\n    $bankAccount->setAccountNumber($randomAccountNumber);\n    $bankAccount->setNameOnAccount('John Doe');\n    $bankAccount->setBankName('Wells Fargo Bank NA');\n    \n    $paymentBank= new AnetAPI\\PaymentType();\n    $paymentBank->setBankAccount($bankAccount);\n\n    // Order info\n    $order = new AnetAPI\\OrderType();\n    $order->setInvoiceNumber(\"101\");\n    $order->setDescription(\"Golf Shirts\");\n\n      //create a bank credit transaction\n    \n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"refundTransaction\");\n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setPayment($paymentBank);\n    $transactionRequestType->setOrder($order);\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null) {\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n                echo  \"Credit Bank Account APPROVED  :\" . \"\\n\";\n                echo  \"Credit Bank Account AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n                echo  \"Credit Bank Account TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n                echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }\n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    creditBankAccount(5.29);\n}\n\n"
  },
  {
    "path": "PaymentTransactions/debit-bank-account.php",
    "content": " <?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction debitBankAccount($amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    //Generate random bank account number\n    $randomAccountNumber= rand(100000000,9999999999);\n\n    // Create the payment data for a Bank Account\n    $bankAccount = new AnetAPI\\BankAccountType();\n    $bankAccount->setAccountType('checking');\n    // see eCheck documentation for proper echeck type to use for each situation\n    $bankAccount->setEcheckType('WEB');\n    $bankAccount->setRoutingNumber('122000661');\n\n    $bankAccount->setAccountNumber(rand(10000,999999999999));\n\n    $bankAccount->setNameOnAccount('John Doe');\n    $bankAccount->setBankName('Wells Fargo Bank NA');\n\n    $paymentBank= new AnetAPI\\PaymentType();\n    $paymentBank->setBankAccount($bankAccount);\n\n    // Order info\n    $order = new AnetAPI\\OrderType();\n    $order->setInvoiceNumber(\"101\");\n    $order->setDescription(\"Golf Shirts\");\n\n    //create a bank debit transaction\n    \n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType(\"authCaptureTransaction\");\n    $transactionRequestType->setAmount($amount);\n    $transactionRequestType->setPayment($paymentBank);\n    $transactionRequestType->setOrder($order);\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest($transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null) {\n        if ($response->getMessages()->getResultCode() == \"Ok\") {\n            $tresponse = $response->getTransactionResponse();\n        \n            if ($tresponse != null && $tresponse->getMessages() != null) {\n                echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n                echo \" Debit Bank Account APPROVED  :\" . \"\\n\";\n                echo \" Debit Bank Account AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n                echo \" Debit Bank Account TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n                echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\";\n                echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n            } else {\n                echo \"Transaction Failed \\n\";\n                if ($tresponse->getErrors() != null) {\n                    echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                    echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n                }\n            }\n        } else {\n            echo \"Transaction Failed \\n\";\n            $tresponse = $response->getTransactionResponse();\n            if ($tresponse != null && $tresponse->getErrors() != null) {\n                echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n                echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";\n            } else {\n                echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n                echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n            }\n        }\n    } else {\n        echo  \"No response returned \\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    debitBankAccount(5.29);\n}\n"
  },
  {
    "path": "PaymentTransactions/refund-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction refundTransaction($refTransId, $amount)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data for a credit card\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"0015\");\n    $creditCard->setExpirationDate(\"XXXX\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setCreditCard($creditCard);\n    //create a transaction\n    $transactionRequest = new AnetAPI\\TransactionRequestType();\n    $transactionRequest->setTransactionType( \"refundTransaction\"); \n    $transactionRequest->setAmount($amount);\n    $transactionRequest->setPayment($paymentOne);\n    $transactionRequest->setRefTransId($refTransId);\n \n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setTransactionRequest( $transactionRequest);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \"Refund SUCCESS: \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n    refundTransaction( \"2.23\");\n?>\n"
  },
  {
    "path": "PaymentTransactions/update-split-tender-group.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction updateSplitTenderGroup()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\UpdateSplitTenderGroupRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setRefId($refId);\n    $request->setSplitTenderId(\"115901\");\n    $request->setSplitTenderStatus(\"voided\");\n\n    $controller = new AnetController\\UpdateSplitTenderGroupController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    { \n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"SUCCESS  Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    updateSplitTenderGroup();\n  ?>\n"
  },
  {
    "path": "PaymentTransactions/void-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction voidTransaction($transactionid)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"voidTransaction\"); \n    $transactionRequestType->setRefTransId($transactionid);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n\t  $request->setRefId($refId);\n    $request->setTransactionRequest( $transactionRequestType);\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        \n\t      if ($tresponse != null && $tresponse->getMessages() != null)   \n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \" Void transaction SUCCESS AUTH CODE: \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \" Void transaction SUCCESS TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n  if(!defined('DONT_RUN_SAMPLES'))\n    voidTransaction(\"60009605785\");\n?>\n"
  },
  {
    "path": "README.md",
    "content": "# PHP Sample Code for the Authorize.Net SDK\n[![Travis CI Status](https://travis-ci.org/AuthorizeNet/sample-code-php.svg?branch=master)](https://travis-ci.org/AuthorizeNet/sample-code-php)\n\nThis repository contains working code samples which demonstrate PHP integration with the [Authorize.Net PHP SDK](https://github.com/AuthorizeNet/sdk-php).\n\nThe samples are organized into categories and common usage examples, just like our [API Reference Guide](http://developer.authorize.net/api/reference). Our API Reference Guide is an interactive reference for the Authorize.Net API. It explains the request and response parameters for each API method and has embedded code windows to allow you to send actual requests right within the API Reference Guide.\n\n\n## Using the Sample Code\n\nThe samples are all completely independent and self-contained. You can analyze them to get an understanding of how a particular method works, or you can use the snippets as a starting point for your own project.\n\nYou can also run each sample directly from the command line.\n\n## Running the Samples From the Command Line\n* Clone this repository:\n```\n    $ git clone https://github.com/AuthorizeNet/sample-code-php.git\n```\n* Run composer with the \"update\" option in the root directory of the repository.\n```\n    $ composer update\n```\n* Run the individual samples by name. For example:\n```\n    $ php PaymentTransactions/[CodeSampleName]\n```\ne.g.\n```\n    $ php PaymentTransactions/authorize-credit-card.php\n```\n\n### Installation Notes\nNote: If during \"composer update\", you get the error \"composer failed to open stream invalid argument\", go to your php.ini file (present where you have installed PHP), and uncomment the following lines:\n```\nextension=php_openssl.dll\nextension=php_curl.dll\n```\nOn Windows systems, you also have to uncomment:\n```\nextension_dir = \"ext\"\n```\nThen run `composer update` again. You might have to restart your machine before the changes take effect.\n\n### What if I'm not using Composer?\nWe provide a custom `SPL` autoloader. Just [download the SDK](https://github.com/AuthorizeNet/sdk-php/releases) and point to its `autoload.php` file:\n\n```php\nrequire 'path/to/anet_php_sdk/autoload.php';\n```\n"
  },
  {
    "path": "RecurringBilling/cancel-subscription.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction cancelSubscription($subscriptionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\ARBCancelSubscriptionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSubscriptionId($subscriptionId);\n\n    $controller = new AnetController\\ARBCancelSubscriptionController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        $successMessages = $response->getMessages()->getMessage();\n        echo \"SUCCESS : \" . $successMessages[0]->getCode() . \"  \" .$successMessages[0]->getText() . \"\\n\";\n        \n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n        \n    }\n\n    return $response;\n\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    cancelSubscription(\"7087965\");\n\n?>\n"
  },
  {
    "path": "RecurringBilling/create-subscription-from-customer-profile.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  date_default_timezone_set('America/Los_Angeles');\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createSubscriptionFromCustomerProfile($intervalLength, $customerProfileId,\n    $customerPaymentProfileId, $customerAddressId\n) {\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Subscription Type Info\n    $subscription = new AnetAPI\\ARBSubscriptionType();\n    $subscription->setName(\"Sample Subscription\");\n\n    $interval = new AnetAPI\\PaymentScheduleType\\IntervalAType();\n    $interval->setLength($intervalLength);\n    $interval->setUnit(\"days\");\n\n    $paymentSchedule = new AnetAPI\\PaymentScheduleType();\n    $paymentSchedule->setInterval($interval);\n    $paymentSchedule->setStartDate(new DateTime('2035-08-30'));\n    $paymentSchedule->setTotalOccurrences(\"12\");\n    $paymentSchedule->setTrialOccurrences(\"1\");\n\n    $subscription->setPaymentSchedule($paymentSchedule);\n    $subscription->setAmount(rand(1,99999)/12.0*12);\n    $subscription->setTrialAmount(\"0.00\");\n    \n    $profile = new AnetAPI\\CustomerProfileIdType();\n    $profile->setCustomerProfileId($customerProfileId);\n    $profile->setCustomerPaymentProfileId($customerPaymentProfileId);\n    $profile->setCustomerAddressId($customerAddressId);\n\n    $subscription->setProfile($profile);\n\n    $request = new AnetAPI\\ARBCreateSubscriptionRequest();\n    $request->setmerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSubscription($subscription);\n    $controller = new AnetController\\ARBCreateSubscriptionController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    {\n        echo \"SUCCESS: Subscription ID : \" . $response->getSubscriptionId() . \"\\n\";\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    createSubscriptionFromCustomerProfile( \\SampleCode\\Constants::SUBSCRIPTION_INTERVAL_DAYS, \"247150\", \"215472\", \"189691\");\n\n?>\n"
  },
  {
    "path": "RecurringBilling/create-subscription.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  date_default_timezone_set('America/Los_Angeles');\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createSubscription($intervalLength)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Subscription Type Info\n    $subscription = new AnetAPI\\ARBSubscriptionType();\n    $subscription->setName(\"Sample Subscription\");\n\n    $interval = new AnetAPI\\PaymentScheduleType\\IntervalAType();\n    $interval->setLength($intervalLength);\n    $interval->setUnit(\"days\");\n\n    $paymentSchedule = new AnetAPI\\PaymentScheduleType();\n    $paymentSchedule->setInterval($interval);\n    $paymentSchedule->setStartDate(new DateTime('2035-12-30'));\n    $paymentSchedule->setTotalOccurrences(\"12\");\n    $paymentSchedule->setTrialOccurrences(\"1\");\n\n    $subscription->setPaymentSchedule($paymentSchedule);\n    $subscription->setAmount(rand(1,99999)/12.0*12);\n    $subscription->setTrialAmount(\"0.00\");\n    \n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n\n    $payment = new AnetAPI\\PaymentType();\n    $payment->setCreditCard($creditCard);\n    $subscription->setPayment($payment);\n\n    $order = new AnetAPI\\OrderType();\n    $order->setInvoiceNumber(\"1234354\");        \n    $order->setDescription(\"Description of the subscription\"); \n    $subscription->setOrder($order); \n    \n    $billTo = new AnetAPI\\NameAndAddressType();\n    $billTo->setFirstName(\"John\");\n    $billTo->setLastName(\"Smith\");\n\n    $subscription->setBillTo($billTo);\n\n    $request = new AnetAPI\\ARBCreateSubscriptionRequest();\n    $request->setmerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSubscription($subscription);\n    $controller = new AnetController\\ARBCreateSubscriptionController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    {\n        echo \"SUCCESS: Subscription ID : \" . $response->getSubscriptionId() . \"\\n\";\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    createSubscription(23);\n\n?>\n"
  },
  {
    "path": "RecurringBilling/get-list-of-subscriptions.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getListOfSubscriptions()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $sorting = new AnetAPI\\ARBGetSubscriptionListSortingType();\n    $sorting->setOrderBy(\"id\");\n    $sorting->setOrderDescending(false);\n\n    $paging = new AnetAPI\\PagingType();\n    $paging->setLimit(\"10\");\n    $paging->setOffset(\"1\");\n\n    $request = new AnetAPI\\ARBGetSubscriptionListRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSearchType(\"subscriptionInactive\");\n    $request->setSorting($sorting);\n    $request->setPaging($paging);\n\n\n    $controller = new AnetController\\ARBGetSubscriptionListController($request);\n\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\")) {\n        echo \"SUCCESS: Subscription Details:\" . \"\\n\";\n        echo \"Total Number In Results:\" . $response->getTotalNumInResultSet() . \"\\n\";\n        if ($response->getTotalNumInResultSet() > 0) {\n            foreach ($response->getSubscriptionDetails() as $subscriptionDetails) {\n                echo \"Subscription ID: \" . $subscriptionDetails->getId() . \"\\n\";\n            }\n        }\n    } else {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    getListOfSubscriptions();\n}\n"
  },
  {
    "path": "RecurringBilling/get-subscription-status.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getSubscriptionStatus($subscriptionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\ARBGetSubscriptionStatusRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSubscriptionId($subscriptionId);\n\n    $controller = new AnetController\\ARBGetSubscriptionStatusController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        echo \"SUCCESS: Subscription Status : \" . $response->getStatus() . \"\\n\";\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getSubscriptionStatus(\"3056948\");\n\n?>\n"
  },
  {
    "path": "RecurringBilling/get-subscription.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\n  function getSubscription($subscriptionId)\n  {\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\t\t\n    // Creating the API Request with required parameters\n    $request = new AnetAPI\\ARBGetSubscriptionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSubscriptionId($subscriptionId);\n    $request->setIncludeTransactions(true);\n\t    \n    // Controller\n    $controller = new AnetController\\ARBGetSubscriptionController($request);\n\t\t\n    // Getting the response\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\t\t\n    if ($response != null) \n    {\n        if($response->getMessages()->getResultCode() == \"Ok\")\n        {\n        \t// Success\n        \techo \"SUCCESS: GetSubscription:\" . \"\\n\";\n        \t// Displaying the details\n        \techo \"Subscription Name: \" . $response->getSubscription()->getName(). \"\\n\";\n        \techo \"Subscription amount: \" . $response->getSubscription()->getAmount(). \"\\n\";\n        \techo \"Subscription status: \" . $response->getSubscription()->getStatus(). \"\\n\";\n        \techo \"Subscription Description: \" . $response->getSubscription()->getProfile()->getDescription(). \"\\n\";\n        \techo \"Customer Profile ID: \" .  $response->getSubscription()->getProfile()->getCustomerProfileId() . \"\\n\";\n        \techo \"Customer payment Profile ID: \". $response->getSubscription()->getProfile()->getPaymentProfile()->getCustomerPaymentProfileId() . \"\\n\";\n                $transactions = $response->getSubscription()->getArbTransactions();\n                if($transactions != null){\n\t\t\tforeach ($transactions as $transaction) {\n                    \t\techo \"Transaction ID : \".$transaction->getTransId().\" -- \".$transaction->getResponse().\" -- Pay Number : \".$transaction->getPayNum().\"\\n\";\n                \t}\n\t\t}\n        }\n        else\n        {\n        \t// Error\n        \techo \"ERROR :  Invalid response\\n\";\t\n        \t$errorMessages = $response->getMessages()->getMessage();\n          echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n        }\n\t  }\n    else\n    {\n        // Failed to get response\n        echo \"Null Response Error\";\n    }\n\n    return $response;\n\t}\n\n\tif(!defined('DONT_RUN_SAMPLES'))\n\t\tgetSubscription(\"2942461\");\n ?>\n"
  },
  {
    "path": "RecurringBilling/update-subscription.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction updateSubscription($subscriptionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $subscription = new AnetAPI\\ARBSubscriptionType();\n\n    $creditCard = new AnetAPI\\CreditCardType();\n    $creditCard->setCardNumber(\"4111111111111111\");\n    $creditCard->setExpirationDate(\"2038-12\");\n\n    $payment = new AnetAPI\\PaymentType();\n    $payment->setCreditCard($creditCard);\n\n    //set profile information\n    $profile = new AnetAPI\\CustomerProfileIdType();\n    $profile->setCustomerProfileId(\"121212\");\n    $profile->setCustomerPaymentProfileId(\"131313\");\n    $profile->setCustomerAddressId(\"141414\");\n\n    $subscription->setPayment($payment);\n\n    //set customer profile information\n    //$subscription->setProfile($profile);\n    \n    $request = new AnetAPI\\ARBUpdateSubscriptionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId($refId);\n    $request->setSubscriptionId($subscriptionId);\n    $request->setSubscription($subscription);\n\n    $controller = new AnetController\\ARBUpdateSubscriptionController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\") )\n    {\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"SUCCESS Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n        \n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n      updateSubscription(\"3056948\");\n?>\n"
  },
  {
    "path": "SampleCodeList.txt",
    "content": "﻿SampleCodeName,IsDependent,ShouldRun\nChargeCreditCard,1,1\nCreateSubscription,1,1\nCreateSubscriptionFromCustomerProfile,1,1\nGetCustomerPaymentProfileList,0,1\nGetTransactionList,0,1\nCreateAnApplePayTransaction,0,0\nCreateAnAcceptTransaction,0,0\nCreateAnAndroidPayTransaction,0,0\ndecryptVisaSrcData,0,0\ncreateVisaSrcTransaction,0,0\nCaptureFundsAuthorizedThroughAnotherChannel,1,1\nAuthorizeCreditCard,1,1\nDebitBankAccount,1,1\nChargeTokenizedCreditCard,0,0\nPayPalAuthorizeOnly,1,1\nGetListOfSubscriptions,0,1\nGetUnsettledTransactionList,0,1\nGetBatchStatistics,1,1\nGetSettledBatchList,1,1\nUpdateSplitTenderGroup,0,1\nUpdateCustomerShippingAddress,1,1\nUpdateCustomerProfile,0,1\nUpdateCustomerPaymentProfile,1,1\nGetCustomerShippingAddress,1,1\nGetCustomerProfileIds,0,0\nGetCustomerProfile,1,1\nGetAcceptCustomerProfilePage,1,1\nGetCustomerPaymentProfile,1,1\nDeleteCustomerShippingAddress,1,1\nDeleteCustomerProfile,1,1\nDeleteCustomerPaymentProfile,1,1\nCreateCustomerShippingAddress,1,1\nCreateCustomerProfileFromTransaction,0,0\nGetTransactionDetails,1,1\nCapturePreviouslyAuthorizedgetAmount,1,0\nRefundTransaction,1,0\nVoidTransaction,1,1\nCreditBankAccount,1,0\nChargeCustomerProfile,1,1\nPayPalVoid,1,0\nPayPalAuthorizeCapture,1,1\nPayPalAuthorizeCaptureContinued,1,1\nPayPalAuthorizeOnlyContinued,1,0\nPayPalCredit,1,0\nPayPalGetDetails,1,1\nPayPalPriorAuthorizationCapture,1,0\nCancelSubscription,1,1\nGetSubscriptionStatus,1,1\nGetSubscription,1,1\nUpdateSubscription,1,1\nCreateCustomerProfile,1,1\nCreateCustomerPaymentProfile,1,1\nValidateCustomerPaymentProfile,1,0\nGetMerchantDetails,0,1\nUpdateHeldTransaction,1,0\nGetAnAcceptPaymentPage,0,1\nCreateAnAcceptPaymentTransaction,0,0\n"
  },
  {
    "path": "Sha512/compute_trans_hashSHA2.php",
    "content": "<?php\n\n$apiLogin=\"2Kfn5S7x7D\";\n$transId=\"60115585081\";\n$amount='12.00';\n$signatureKey='56E529FE6C63D60E545F84686096E6AA01D5E18A119F18A130F7CFB3983104216979E95D84C91BDD382AA0875264A63940A2D0AA5548F6023B4C78A9D52C18DA';\n$textToHash=\"^\". $apiLogin.\"^\". $transId .\"^\". $amount.\"^\";\n\nfunction generateSH512($textToHash, $signatureKey)\n{\n    if ($textToHash != null && $signatureKey != null) {\n                    $sig = hash_hmac('sha512', $textToHash, hex2bin($signatureKey));\n                    echo \" Computed SHA512 Hash: \" . strtoupper($sig) . \"\\n\";\n                } else {\n                    echo \"Either Signature key or the text to hash is empty \\n\";\n                }\n}\n\ngenerateSH512($textToHash, $signatureKey);\n?>\n"
  },
  {
    "path": "TestRunner.php",
    "content": "<?php\ndefine(\"DONT_RUN_SAMPLES\", \"true\");\ndefine(\"SAMPLE_CODE_NAME_HEADING\", \"SampleCodeName\");\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\n\nif ($_SERVER['argc'] != 3) {\n    die('\\n Usage: phpunit test-runner.php <SampleCodeDirectoryPath>');\n}\n$dirPath = $_SERVER['argv'][2];\necho $dirPath;\nif (substr($dirPath, -1) != \"/\") {\n    $dirPath = $dirPath.\"/\";\n}\n\n$directories = array(\n            'CustomerProfiles/',\n            'RecurringBilling/',\n            'PayPalExpressCheckout/',\n            'PaymentTransactions/',\n            'TransactionReporting/',\n            'MobileInappTransactions/',\n            'VisaCheckout/',\n\t\t\t'AcceptSuite/'\n);\n\n$errorlevel=error_reporting();\nerror_reporting($errorlevel & ~E_NOTICE); //turn off constant re-defined and other notices\nforeach ($directories as $directory) {\n    foreach (glob($dirPath.$directory . \"*.php\") as $sample) {\n        require_once $sample;\n        //echo $sample;\n    }\n}\n\nerror_reporting($errorlevel);\nclass TestRunner extends PHPUnit\\Framework\\TestCase\n{\n    public static $apiLoginId = \"5KP3u95bQpv\";\n    public static $transactionKey = \"346HZ32z3fP4hTG2\";\n    public static $transactionID = \"2245440957\";\n    public static $payerID = \"LM6NCLZ5RAKBY\";\n    //random amount for transactions/subscriptions\n    public static function getAmount()\n    {\n        return 12 + (rand(1, 9000)/10);\n    }\n    //random email for a new customer profile\n    public static function getEmail()\n    {\n        return rand(0, 10000) . \"@test\" .rand(0, 10000) .\".com\";\n    }\n    //random phonenumber for customer payment profile\n    public static function getPhoneNumber()\n    {\n        return self::toPhoneNumber(rand(0, 9999999999));\n    }\n    public static function getDay()\n    {\n        return rand(7, 365);\n    }\n    public function testAllSampleCodes()\n    {\n        $runTests = 0;\n\n        $file = $GLOBALS[\"dirPath\"].\"SampleCodeList.txt\";\n        $data = file($file) or die('\\nCould not read SampleCodeList.');\n        foreach ($data as $line) {\n            $line=trim($line);\n            if (trim($line)) {\n                list($apiName, $isDependent, $shouldRun)=explode(\",\", $line);\n                $apiName = trim($apiName);\n                echo \"\\nApi name: \" . $apiName.\"\\n\";\n                fwrite(STDOUT, print_r(\"\\nStarting Test: \" . $apiName.\"\\n\", TRUE));\n            }\n            if ($apiName && (false === strpos($apiName, SAMPLE_CODE_NAME_HEADING))) {\n                echo \"should run:\".$shouldRun.\"\\n\";\n                if (\"0\" === $shouldRun) {\n                    echo \":Skipping \" . $apiName . \"\\n\";\n                } else {\n                    //Try the request twice\n                    for ($i=0; $i<=1; $i++) {\n                        if (\"0\" === $isDependent) {\n                            echo \"not dependent\\n\";\n                            $sampleMethodName = $apiName;\n                            $sampleMethodName[0] = strtolower($sampleMethodName[0]);\n                        } else {\n                            $sampleMethodName = \"TestRunner::run\" . $apiName;\n                            echo \" is dependent\\n\";\n                        }\n                            \n                        //request the api\n                        echo \"Running sample: \" . $sampleMethodName . \"\\n\";\n                        \n                        fwrite(STDOUT, print_r($apiName . \"Start  Time: \" . date(\"H:i:s.\"). gettimeofday()['usec'] . \"\\n\", TRUE));\n                        $response = call_user_func($sampleMethodName);\n                        fwrite(STDOUT, print_r($apiName . \"Finish Time: \" . date(\"H:i:s.\"). gettimeofday()['usec'] . \"\\n\", TRUE));\n\n                        if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\")) {\n                            break;\n                        }\n                    }\n\n                    //response must be successful\n                    $this->assertNotNull($response);\n                    $this->assertEquals($response->getMessages()->getResultCode(), \"Ok\");\n                    echo $sampleMethodName . \" - OK \\n\";\n                    $runTests++;\n                }\n            }\n        }\n        echo \"Number of sample codes run: \". $runTests;\n    }\n\n    private static function toPhoneNumber($num)\n    {\n        $zeroPadded = sprintf(\"%10d\", $num);\n        return substr($zeroPadded, 0, 3).\"-\".substr($zeroPadded, 3, 3).\"-\".substr(6, 4);\n    }\n\n    public static function runAuthorizeCreditCard()\n    {\n        return authorizeCreditCard(self::getAmount());\n    }\n\n    public static function runCaptureFundsAuthorizedThroughAnotherChannel()\n    {\n        return captureFundsAuthorizedThroughAnotherChannel(self::getAmount());\n    }\n    \n    public static function runDebitBankAccount()\n    {\n        return debitBankAccount(self::getAmount()%98+1); //cannot debit more than 100\n    }\n    \n    public static function runChargeTokenizedCreditCard()\n    {\n        return chargeTokenizedCreditCard(self::getAmount());\n    }\n    \n    public static function runCreateAnAcceptPaymentTransaction()\n    {\n        return createAnAcceptPaymentTransaction(self::getAmount());\n    }\n\n    public static function runChargeCreditCard()\n    {\n        return chargeCreditCard(self::getAmount());\n    }\n\n    public static function runCapturePreviouslyAuthorizedAmount()\n    {\n        $response = authorizeCreditCard(self::getAmount());\n        return capturePreviouslyAuthorizedAmount($response->getTransactionResponse()->getTransId());\n    }\n\n    public static function runRefundTransaction()\n    {\n        $response = authorizeCreditCard.run(self::getAmount());\n        $response = capturePreviouslyAuthorizedAmount($response->getTransactionResponse()->getTransId());\n        return refundTransaction(self::getAmount());\n    }\n\n    public static function runVoidTransaction()\n    {\n        $response = authorizeCreditCard(self::getAmount());\n        return voidTransaction($response->getTransactionResponse()->getTransId());\n    }\n\n    public static function runCreditBankAccount()\n    {\n        return creditBankAccount(self::getAmount());\n    }\n\n    public static function runChargeCustomerProfile()\n    {\n        $response = createCustomerProfile(self::getEmail());\n        $paymentProfileResponse = createCustomerPaymentProfile(\n            $response->getCustomerProfileId(),\n            self::getPhoneNumber()\n        );\n        $chargeResponse = chargeCustomerProfile(\n            $response->getCustomerProfileId(),\n            $paymentProfileResponse->getCustomerPaymentProfileId(),\n            self::getAmount()\n        );\n        deleteCustomerProfile($response->getCustomerProfileId());\n\n        return $chargeResponse;\n    }\n\n    private static function runPayPalVoid()\n    {\n        $response = payPalAuthorizeCapture(self::getAmount());\n        return payPalVoid($response->getTransactionResponse()->getTransId());\n    }\n\n    private static function runPayPalAuthorizeCapture()\n    {\n            return payPalAuthorizeCapture(self::getAmount());\n    }\n\n    private static function runPayPalAuthorizeCaptureContinued()\n    {\n            $response = payPalAuthorizeCapture(self::getAmount());\n            return payPalAuthorizeCaptureContinued($response->getTransactionResponse()->getTransId(), self::$payerID);\n    }\n\n    public static function runPayPalAuthorizeOnlyContinued()\n    {\n            return payPalAuthorizeOnlyContinued(self::$transactionID, self::$payerID);\n    }\n\n    public static function runPayPalCredit()\n    {\n            return payPalCredit(self::$transactionID);\n    }\n\n    public static function runPayPalAuthorizeOnly()\n    {\n            return payPalAuthorizeOnly(self::getAmount());\n    }\n\n    public static function runPayPalGetDetails()\n    {\n            $response = payPalAuthorizeCapture(self::getAmount());\n            return payPalGetDetails($response->getTransactionResponse()->getTransId());\n    }\n\n    public static function runPayPalPriorAuthorizationCapture()\n    {\n            $response = payPalAuthorizeCapture(self::getAmount());\n            return payPalPriorAuthorizationCapture($response->getTransactionResponse()->getTransId());\n    }\n\n\n    // ****ARB Subscription methods******\n    public static function runCreateSubscription()\n    {\n            $response = createSubscription(self::getDay());\n            cancelSubscription($response->getSubscriptionId());\n\n            return $response;\n    }\n\n    public static function runCreateSubscriptionFromCustomerProfile()\n    {\n            $responseCustomerProfile = createCustomerProfile(self::getEmail());\n            $responseCustomerPaymentProfile = createCustomerPaymentProfile(\n                $responseCustomerProfile->getCustomerProfileId(),\n                self::getPhoneNumber()\n            );\n            $responseCustomerShippingAddress = createCustomerShippingAddress(\n                $responseCustomerProfile->getCustomerProfileId(),\n                self::getPhoneNumber()\n            );\n\n            $response = createSubscription(\n                self::getDay(),\n                $responseCustomerProfile->getCustomerProfileId(),\n                $responseCustomerPaymentProfile->getCustomerPaymentProfileId(),\n                $responseCustomerShippingAddress->getCustomerAddressId()\n            );\n\n            cancelSubscription($response->getSubscriptionId());\n            deleteCustomerProfile($responseCustomerProfile->getCustomerProfileId());\n\n            return $response;\n    }\n\n    public static function runCancelSubscription()\n    {\n            $response = createSubscription(self::getDay());\n            return cancelSubscription($response->getSubscriptionId());\n    }\n\n    public static function runGetSubscriptionStatus()\n    {\n            $response = createSubscription(self::getDay());\n            $status_response = getSubscriptionStatus($response->getSubscriptionId());\n            cancelSubscription($response->getSubscriptionId());\n\n            return $status_response;\n    }\n\n    public static function runGetSubscription()\n    {\n            $response = createSubscription(self::getDay());\n            $status_response = getSubscription($response->getSubscriptionId());\n            cancelSubscription($response->getSubscriptionId());\n\n            return $status_response;\n    }\n\n    public static function runUpdateSubscription()\n    {\n            $response = createSubscription(self::getDay());\n            $update_response = updateSubscription($response->getSubscriptionId());\n            cancelSubscription($response->getSubscriptionId());\n\n            return $update_response;\n    }\n\n       //*****Customer Profiles methods********\n    public static function runCreateCustomerProfile()\n    {\n\n        $response = createCustomerProfile(self::getEmail());\n        deleteCustomerProfile($response->getCustomerProfileId());\n        return $response;\n    }\n\n    public static function runDeleteCustomerProfile()\n    {\n\n        $responseCustomerProfile = createCustomerProfile(self::getEmail());\n        return deleteCustomerProfile($responseCustomerProfile->getCustomerProfileId());\n    }\n\n    public static function runGetCustomerProfile()\n    {\n\n        $responseCustomerProfile = createCustomerProfile(self::getEmail());\n        $response = getCustomerProfile($responseCustomerProfile->getCustomerProfileId());\n        deleteCustomerProfile($responseCustomerProfile->getCustomerProfileId());\n        return $response;\n    }\n\n    // *******Customer Profiles - Payment Profiles methods******\n\n    public static function runCreateCustomerPaymentProfile()\n    {\n        $responseCustomerProfile = createCustomerProfile(self::getEmail());\n        $response=createCustomerPaymentProfile(\n            $responseCustomerProfile->getCustomerProfileId(),\n            self::getPhoneNumber()\n        );\n        deleteCustomerProfile($responseCustomerProfile->getCustomerProfileId());\n        return $response;\n    }\n\n    public static function runGetCustomerPaymentProfile()\n    {\n        $customerProfileId = createCustomerProfile(self::getEmail())->getCustomerProfileId();\n        $customerPaymentProfileId = createCustomerPaymentProfile(\n            $customerProfileId,\n            self::getPhoneNumber()\n        )->getCustomerPaymentProfileId();\n        $response= getCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId);\n        deleteCustomerProfile($customerProfileId);\n        return $response;\n    }\n\n    public static function runValidateCustomerPaymentProfile()\n    {\n        $customerProfileId = createCustomerProfile(self::getEmail())->getCustomerProfileId();\n        $customerPaymentProfileId = createCustomerPaymentProfile(\n            $customerProfileId,\n            self::getPhoneNumber()\n        )->getCustomerPaymentProfileId();\n        $response = validateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId);\n        deleteCustomerProfile($customerProfileId);\n        return $response;\n    }\n\n    public static function runUpdateCustomerPaymentProfile()\n    {\n        $customerProfileId = createCustomerProfile(self::getEmail())->getCustomerProfileId();\n        $customerPaymentProfileId = createCustomerPaymentProfile(\n            $customerProfileId,\n            self::getPhoneNumber()\n        )->getCustomerPaymentProfileId();\n        $response = updateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId);\n        deleteCustomerProfile($customerProfileId);\n        return $response;\n    }\n\n    public static function runDeleteCustomerPaymentProfile()\n    {\n        $customerProfileId = createCustomerProfile(self::getEmail())->getCustomerProfileId();\n        $customerPaymentProfileId = createCustomerPaymentProfile(\n            $customerProfileId,\n            self::getPhoneNumber()\n        )->getCustomerPaymentProfileId();\n        $response = deleteCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId);\n        deleteCustomerProfile($customerProfileId);\n        return $response;\n    }\n\n    // ****Customer Profiles - Shipping Address*****\n    public static function runCreateCustomerShippingAddress()\n    {\n        $customerProfileId = createCustomerProfile(self::getEmail())->getCustomerProfileId();\n        $response = createCustomerShippingAddress($customerProfileId, self::getPhoneNumber());\n        deleteCustomerProfile($customerProfileId);\n        return $response;\n    }\n\n    public static function runDeleteCustomerShippingAddress()\n    {\n        $customerProfileId = createCustomerProfile(self::getEmail())->getCustomerProfileId();\n        $responseCreateShipping = createCustomerShippingAddress($customerProfileId, self::getPhoneNumber());\n        $response = deleteCustomerShippingAddress($customerProfileId, $responseCreateShipping->getCustomerAddressId());\n        deleteCustomerProfile($customerProfileId);\n        return $response;\n    }\n\n    public static function runUpdateCustomerShippingAddress()\n    {\n        $response = createCustomerProfile(self::getEmail());\n        $shippingResponse = createCustomerShippingAddress($response->getCustomerProfileId());\n        $updateResponse = updateCustomerShippingAddress(\n            $response->getCustomerProfileId(),\n            $shippingResponse->getCustomerAddressId()\n        );\n        deleteCustomerProfile($response->getCustomerProfileId());\n\n        return $updateResponse;\n    }\n\n    public static function runGetCustomerShippingAddress()\n    {\n        $response = createCustomerProfile(self::getEmail());\n        $shippingResponse = createCustomerShippingAddress($response->getCustomerProfileId());\n\n        $getResponse = getCustomerShippingAddress(\n            $response->getCustomerProfileId(),\n            $shippingResponse->getCustomerAddressId()\n        );\n\n        deleteCustomerProfile($response->getCustomerProfileId());\n\n        return $getResponse;\n    }\n    //*****Accept - Accept Customer Profile Page********\n    public static function runGetAcceptCustomerProfilePage()\n    {\n        $response = createCustomerProfile(self::getEmail());\n        $profileResponse = GetAcceptCustomerProfilePage($response->getCustomerProfileId());\n        deleteCustomerProfile($response->getCustomerProfileId());\n\n        return $profileResponse;\n    }\n    \n    // *****Transaction Reporting methods********\n    public static function runGetTransactionDetails()\n    {\n            $response = authorizeCreditCard(self::getAmount());\n            return getTransactionDetails($response->getTransactionResponse()->getTransId());\n    }\n    \n    public static function runGetSettledBatchList()\n    {\n        $lastSettlementDate=new DateTime();  // current time\n        $lastSettlementDate->format(\"Y-m-d\\TH:i:s\\Z\");\n        $lastSettlementDate->setTimezone(new DateTimeZone('UTC'));\n        \n        $firstSettlementDate=new DateTime();\n        $firstSettlementDate->format(\"Y-m-d\\TH:i:s\\Z\");\n        $firstSettlementDate->setTimezone(new DateTimeZone('UTC'));\n        $firstSettlementDate->sub(new DateInterval('P28D'));\n        \n        return getSettledBatchList($firstSettlementDate, $lastSettlementDate);\n    }\n    \n    public static function runGetBatchStatistics()\n    {\n        $response = getBatchStatistics(self::runGetSettledBatchList()->getBatchList()[0]->getBatchId());\n        return $response;\n    }\n}\n"
  },
  {
    "path": "TransactionReporting/get-account-updater-job-details.php",
    "content": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api\\contract\\v1 as AnetAPI;\n    use net\\authorize\\api\\controller as AnetController;\n  \ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getAccountUpdaterJobDetails()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the request's refId\n    $refId = 'ref' . time();\n\n    // Set a valid month (and other parameters) for the request\n    $month = \"2017-07\";\n    $modifedTypeFilter = \"all\";\n    $paging = new AnetAPI\\PagingType;\n    $paging->setLimit(\"1000\");\n    $paging->setOffset(\"1\");\n\n    // Build tbe request object\n    $request = new AnetAPI\\GetAUJobDetailsRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setMonth($month);\n    $request->setModifiedTypeFilter($modifedTypeFilter);\n    $request->setPaging($paging);\n\n    $controller = new AnetController\\GetAUJobDetailsController($request);\n\n    // Retrieving details for the given month and parameters\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\")) {\n        echo \"SUCCESS: Get Account Updater Details for Month : \" . $month  . \"\\n\\n\";\n        if ($response->getAuDetails() == null) {\n            echo \"No Account Updater Details for this month.\\n\";\n            return ;\n        } else {\n            $details = new AnetAPI\\ListOfAUDetailsType;\n            $details = $response->getAuDetails();\n            if (($details->getAuUpdate() == null) && ($details->getAuDelete() == null)) {\n                echo \"No Account Updater Details for this month.\\n\";\n                return ;\n            }\n        }\n\n        // Displaying the details of each response in the list\n        echo \"Total Num in Result Set : \" . $response->getTotalNumInResultSet() . \"\\n\\n\";\n        $details = new AnetAPI\\ListOfAUDetailsType;\n        $details = $response->getAuDetails();\n        echo \"Updates:\\n\";\n        foreach ($details->getAuUpdate() as $update) {\n            echo \"\t\tProfile ID / Payment Profile ID\t: \" . $update->getCustomerProfileID() . \" / \" . $update->getCustomerPaymentProfileID() . \"\\n\";\n            echo \"\t\tUpdate Time (UTC) : \" . $update->getUpdateTimeUTC() . \"\\n\";\n            echo \"\t\tReason Code\t: \" . $update->getAuReasonCode() . \"\\n\";\n            echo \"\t\tReason Description : \" . $update->getReasonDescription() . \"\\n\";\n            echo \"\\n\";\n        }\n        echo \"\\nDeletes:\\n\";\n        foreach ($details->getAuDelete() as $delete) {\n            echo \"\t\tProfile ID / Payment Profile ID\t: \" . $delete->getCustomerProfileID() . \" / \" . $delete->getCustomerPaymentProfileID() . \"\\n\";\n            echo \"\t\tUpdate Time (UTC) : \" . $delete->getUpdateTimeUTC() . \"\\n\";\n            echo \"\t\tReason Code\t: \" . $delete->getAuReasonCode() . \"\\n\";\n            echo \"\t\tReason Description : \" . $delete->getReasonDescription() . \"\\n\";\n            echo \"\\n\";\n        }\n    } else {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    getAccountUpdaterJobDetails();\n}\n"
  },
  {
    "path": "TransactionReporting/get-account-updater-job-summary.php",
    "content": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api\\contract\\v1 as AnetAPI;\n    use net\\authorize\\api\\controller as AnetController;\n\ndefine(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getAccountUpdaterJobSummary()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the request's refId\n    $refId = 'ref' . time();\n\n    // Set a valid month for the request\n    $month = \"2017-07\";\n\n    // Build tbe request object\n    $request = new AnetAPI\\GetAUJobSummaryRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setMonth($month);\n\n    $controller = new AnetController\\GetAUJobSummaryController($request);\n\n    // Get the response from the service (errors contained if any)\n    $response = $controller->executeWithApiResponse(\\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\")) {\n        echo \"SUCCESS: Get Account Updater Summary for Month : \" . $month  . \"\\n\\n\";\n        if ($response->getAuSummary() == null) {\n            echo \"No Account Updater summary for this month.\\n\";\n            return ;\n        }\n\n        // Displaying the summary of each response in the list\n        foreach ($response->getAuSummary() as $result) {\n            echo \"\t\tReason Code        : \" . $result->getAuReasonCode() . \"\\n\";\n            echo \"\t\tReason Description : \" . $result->getReasonDescription() . \"\\n\";\n            echo \"\t\t# of Profiles updated for this reason : \" . $result->getProfileCount() . \"\\n\";\n        }\n    } else {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n}\n\nif (!defined('DONT_RUN_SAMPLES')) {\n    getAccountUpdaterJobSummary();\n}\n"
  },
  {
    "path": "TransactionReporting/get-batch-statistics.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getBatchStatistics($batchId = \"7927817\") //only shows results for batches not older than 6 months\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n    \n    // Creating a request \n    $request = new AnetAPI\\GetBatchStatisticsRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setBatchId($batchId);\n      \n    //Creating the controller\n    $controller = new AnetController\\GetBatchStatisticsController($request);\n\n    //Retrieving response\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n    \t\techo \"SUCCESS: Successfully got the list of subscriptions : \\n\\n\";\n  \t\techo \"Batch ID : \" . $response->getBatch()->getBatchId() . \"\\n\";\n  \t\techo \"Settlement Time : \" . date_format($response->getBatch()->getSettlementTimeUTC(),\"Y/m/d H:i:s\") . \"\\n\";\n  \t\techo \"Settlement state : \" . $response->getBatch()->getSettlementState() . \"\\n\";\n  \t\techo \"Payment Method : \" . $response->getBatch()->getPaymentMethod() . \"\\n\";\n  \t\techo \"Statistic Details:\";\n  \t\t//Displaying the details of each transaction in the list\n  \t\tforeach ($response->getBatch()->getStatistics() as $statistics) \n  \t\t{\n  \t\t\techo \"\t\tAccount Type\t: \" . $statistics->getAccountType() . \"\\n\"; \n  \t\t\techo \"\t\tCharge Amount\t: \" . $statistics->getChargeAmount() . \"\\n\";\n  \t\t\techo \"\t\tCharge Count\t: \" . $statistics->getChargeCount() . \"\\n\";\n  \t\t\techo \"\t\tRefund Amount\t: \" . $statistics->getRefundAmount() . \"\\n\";\n  \t\t\techo \"\t\tRefund Count\t: \" . $statistics->getRefundCount() . \"\\n\";\n  \t\t\techo \"\t\tVoid Count\t\t: \" . $statistics->getRefundCount() . \"\\n\";\n  \t\t\techo \"\t\tDecline Count\t: \" . $statistics->getRefundCount() . \"\\n\";\n  \t\t\techo \"\t\tError Count\t\t: \" . $statistics->getRefundCount() . \"\\n\";\n  \t\t}\n    }\n    else\n    {\n        echo \"ERROR :  Failed to get the batch statistics\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getBatchStatistics();\n\n?>\n"
  },
  {
    "path": "TransactionReporting/get-customer-profile-transaction-list.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getTransactionListForCustomerRequest($customerProfileId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\GetTransactionListForCustomerRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setCustomerProfileId($customerProfileId);\n\n    $controller = new AnetController\\GetTransactionListForCustomerController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n    \n\tif (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        if(null != $response->getTransactions())\n\t\t{\n\t\t\tforeach($response->getTransactions() as $tx)\n\t\t\t{\n\t\t\t  echo \"SUCCESS: TransactionID: \" . $tx->getTransId() . \"\\n\";\n\t\t\t}\n        }\n\t\telse{\n\t\t\techo \"No transactions associated with given customer profile\" . \"\\n\";\n\t\t}\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\t\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getTransactionListForCustomerRequest(\"36152127\");\n?>"
  },
  {
    "path": "TransactionReporting/get-merchant-details.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getMerchantDetails()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\GetMerchantDetailsRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n\n    $controller = new AnetController\\GetMerchantDetailsController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        echo \"SUCCESS: Merchant Name:\" . $response->getMerchantName() . \"\\n\";\n        echo \"                Gateway Id:\" . $response->getGatewayId(). \"\\n\";\n\n\t  foreach ($response->getProcessors() as $processor) {\n\t  \techo \"\t\t->Name\t: \" . $processor->getName() . \"\\n\"; \n\t  }\n\n\t  foreach ($response->getCurrencies() as $currency) {\n\t  \techo \"\t\t->Currency\t: \" . $currency . \"\\n\"; \n\t  }\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getMerchantDetails();\n?>\n"
  },
  {
    "path": "TransactionReporting/get-settled-batch-list.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getSettledBatchList($firstSettlementDate, $lastSettlementDate)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\GetSettledBatchListRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setIncludeStatistics(true);\n    \n    // Both the first and last dates must be in the same time zone\n    // The time between first and last dates, inclusively, cannot exceed 31 days.\n    $request->setFirstSettlementDate($firstSettlementDate);\n    $request->setLastSettlementDate($lastSettlementDate);\n\n    $controller = new AnetController\\GetSettledBatchListController ($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        foreach($response->getBatchList() as $batch)\n        {\n  \t\techo \"\\n\\n\";\n          echo \"Batch ID: \" . $batch->getBatchId() . \"\\n\";\n  \t\techo \"Batch settled on (UTC): \" . $batch->getSettlementTimeUTC()->format('r') . \"\\n\";\n  \t\techo \"Batch settled on (Local): \" . $batch->getSettlementTimeLocal()->format('D, d M Y H:i:s') . \"\\n\";\n  \t\techo \"Batch settlement state: \" . $batch->getSettlementState() . \"\\n\";\n  \t\techo \"Batch market type: \" . $batch->getMarketType() . \"\\n\";\n  \t\techo \"Batch product: \" . $batch->getProduct() . \"\\n\";\n  \t\tforeach($batch->getStatistics() as $statistics)\n  \t\t{\n  \t\t\techo \"Account type: \".$statistics->getAccountType().\"\\n\";\n  \t\t\techo \"Total charge amount: \".$statistics->getChargeAmount().\"\\n\";\n  \t\t\techo \"Charge count: \".$statistics->getChargeCount().\"\\n\";\n  \t\t\techo \"Refund amount: \".$statistics->getRefundAmount().\"\\n\";\n  \t\t\techo \"Refund count: \".$statistics->getRefundCount().\"\\n\";\n  \t\t\techo \"Void count: \".$statistics->getVoidCount().\"\\n\";\n  \t\t\techo \"Decline count: \".$statistics->getDeclineCount().\"\\n\";\n  \t\t\techo \"Error amount: \".$statistics->getErrorCount().\"\\n\";\n  \t\t}\n        }\n    }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n  \n  // both the first and last dates must be in the same time zone\n  // a date constructed from an ISO8601 format date string\n  $firstSettlementDate=new DateTime(\"2018-01-23T06:00:00Z\");\n  // a date constructed manually\n  $lastSettlementDate=new DateTime();\n  $lastSettlementDate->setDate(2018,2,19);\n  $lastSettlementDate->setTime(13,33,59);\n  $lastSettlementDate->setTimezone(new DateTimeZone('UTC'));\n      \n  if(!defined('DONT_RUN_SAMPLES'))\n    getSettledBatchList($firstSettlementDate, $lastSettlementDate);\n\n?>\n"
  },
  {
    "path": "TransactionReporting/get-transaction-details.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getTransactionDetails($transactionId)\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    // The refId is a Merchant-assigned reference ID for the request.\n    // If included in the request, this value is included in the response. \n    // This feature might be especially useful for multi-threaded applications.\n    $refId = 'ref' . time();\n\n    $request = new AnetAPI\\GetTransactionDetailsRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setTransId($transactionId);\n\n    $controller = new AnetController\\GetTransactionDetailsController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        echo \"SUCCESS: Transaction Status:\" . $response->getTransaction()->getTransactionStatus() . \"\\n\";\n        echo \"                Auth Amount:\" . $response->getTransaction()->getAuthAmount() . \"\\n\";\n        echo \"                   Trans ID:\" . $response->getTransaction()->getTransId() . \"\\n\";\n     }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getTransactionDetails(\"2238968786\");\n?>\n"
  },
  {
    "path": "TransactionReporting/get-transaction-list.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getTransactionList()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the request's refId\n    $refId = 'ref' . time();\n\n    //Setting a valid batch Id for the Merchant\n    $batchId = \"4606008\";\n    $request = new AnetAPI\\GetTransactionListRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setBatchId($batchId);\n\n    $controller = new AnetController\\GetTransactionListController($request);\n\n    //Retrieving transaction list for the given Batch Id\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n        echo \"SUCCESS: Get Transaction List for BatchID : \" . $batchId  . \"\\n\\n\";\n        if ($response->getTransactions() == null) {\n            echo \"No Transaction to display in this Batch.\";\n            return $response;\n        }\n        //Displaying the details of each transaction in the list\n        foreach ($response->getTransactions() as $transaction) {\n            echo \"      ->Transaction Id    : \" . $transaction->getTransId() . \"\\n\"; \n            echo \"      Submitted on (Local)    : \" . date_format($transaction->getSubmitTimeLocal(), 'Y-m-d H:i:s') . \"\\n\";\n            echo \"      Status          : \" . $transaction->getTransactionStatus() . \"\\n\";\n            echo \"      Settle amount      : \" . number_format($transaction->getSettleAmount(), 2, '.', '') . \"\\n\";\n        }\n    }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getTransactionList();\n?>"
  },
  {
    "path": "TransactionReporting/get-unsettled-transaction-list.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n  \n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction getUnsettledTransactionList()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n\n    $request = new AnetAPI\\GetUnsettledTransactionListRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n\n\n    $controller = new AnetController\\GetUnsettledTransactionListController($request);\n\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if (($response != null) && ($response->getMessages()->getResultCode() == \"Ok\"))\n    {\n\t\tif(null != $response->getTransactions())\n\t\t{\n\t\t\tforeach($response->getTransactions() as $tx)\n\t\t\t{\n\t\t\t  echo \"SUCCESS: TransactionID: \" . $tx->getTransId() . \"\\n\";\n\t\t\t}\n        }\n\t\telse{\n\t\t\techo \"No unsettled transactions for the merchant.\" . \"\\n\";\n\t\t}\n    }\n    else\n    {\n        echo \"ERROR :  Invalid response\\n\";\n        $errorMessages = $response->getMessages()->getMessage();\n        echo \"Response : \" . $errorMessages[0]->getCode() . \"  \" .$errorMessages[0]->getText() . \"\\n\";\n    }\n\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    getUnsettledTransactionList();\n\n?>\n"
  },
  {
    "path": "VisaCheckout/create-visa-src-transaction.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction createVisaSrcTransaction()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data from a Visa Checkout blob\n    $op = new AnetAPI\\OpaqueDataType();\n    $op->setDataDescriptor(\"COMMON.VCO.ONLINE.PAYMENT\");\n    $op->setDataValue(\"4Ng5pzJ6DXfAvLSzVauN9KTufx5lTHhFlnuIr248N3fjtyHrHqMuhOkB1BLiSjKWeTM9+BNj3+9nY56d7CsUfIuvVSTaJRhQQSex1dS2Y2Y+/cA5U+3D1pg5YtTmDVUGlsu1simAd3huwPnwD+CG6O8Ml0AmXvYHntmL3vFaJomadMQBy27k8Dbh5eplPBwyawKUVJ7GqTyKLe8aOYkBUHT5ANWkq2hlGps44BOoDHZ26JWjHdorBZtVIqMK1SIyW4Dih5c/Y//w2toA8WBTPILIvt4h6HPPvWZMZCHCqom9D2k4WGH5+BCEY2jHI7gfYV6xRx54i5vitsYTKm3CyA0C5+l0FNDkfUFHDvVUG9FVzRWVd0TXYhDwfa2pcfI68eYvkEfeT+ZNJ24ZXKPrJo6KZ3x6eZAhzgAMFiC+tPsiygb2zQy5PVoYoBIGj/NGNRqmhZTOEajcO3ZjWxfAnLZAmvMi+pEwJCMmuIY4qRU3RfcaXhAoaUPpDxqrSxR1m+CUKYVdt3nnnQeVaVqf+RaeV9cyFJvILeBPXTBVC50AckVLS37UuBWgWaWcchjRPk9mriDu2KlHQwdR4zu0jnLh4i3tbxV416QBcYLO6AF2Ixlm3GzqGE6QcVssgFCUAhklBWGNLP62O1jtyV4NgTD36QhvHEHby7o4XBB+mjlY6xSEXR+IW9u64AzfDCsTxWiAOE65le6cSk4NDV8DrtYeIozILivWu6wFSpy1gMfiDot4Ndv3C9xCFvH0Bzlky7NoZrvSolKTVNTs8W8UqMFV19qGl6SRaNUEhCqgso/FkdO0eGXFMdQPuP11wQzK/9F3yB9gS2rpXi9sy8DrCqnJ9EXMmliSstKuQl5+yfGc8K3Urot3t+BmNoOvzM9Aha/PzmbLnuKBN6/DUbIw5mhNMCvIA1ByispKpjeV682jl4uslkRsitGLcIOBREFXvGaLxRb37HJkXCHk+jorpDz7LUQhVkClN+hW0vXtgdHQFCIOL7uREdbvk6BZbQlFsuVEKGZxPbKPEJfqMbH54B4a4P5XNQHm4Yt4haH4T0JuYgzoSo76uuXD3g5IuUvy7x8Ykuja1rwW/k//SZAiGaZraRIIAEnzHiUP8dcufb/RonHGnJcYXIEWeIF1lX980bDA+H4vlO8/nN/Mj+EL6tT95MfRDiQHUW69qkqotQd7FJ5uWT+NtetzqDsN5s3sIhwkLKIn9EDLIav5v4SXKxkG+ycMJmGFcfhs7Td9O6hl+Om/JD3he3rgfClaFi/ZR7AVY6fWbAAm9QftKijQ6rskPDYL9Y3gVSA9rdduSg97fUHC+FdfyQXGH552cDLs2ZgzYw6KluXHEuwhACgNotxToPYTTdZxxNr1vPoqYCqHDL2dL8dkuO59/sbZE1m4ektKvUC2wz0UdTDVbHN8HSrLPn2hf/xQp5bKeDDjYkWvNKuwy+aug9H+Uu/m1LuPK/YdogVv9l25y/c2Qbj3dAJ9xTuKjmiJLKlRh4SUI9+05HjDF+i84AoUZ8LuC7LGtrN8ReYIktLhaXq9+XDh5fv4NYhnuYgWkUioKtx1dmfOMHjpLm4aE8Ra1gpJQcZAgwnqYubQvnYy0nY4VaykNix7m3vZwItpKOLqxDYxa3q0qUw25X9zafAM61kPW6EP+4idPzHNww6r1FD4Ihq644dCnCXwoSQ531DW6oAPot8iLZ/xXwoWwrW05k9t2RHjjLbw1L5r1CKgShJQfX7nkJxfGyuw1RmqoQDuNt/tj9M/dHOnoPnOYZZN0JX+Al8PI5zs+LLajw1imu9YcSpwMz3ZlfQqTfI0fjSCc8Is6qVYDMvKD0TweY4hiIxkzs+RyQmPgIeIWqf7Su5+RcnXitb3OuFibBGCjdDeG0ESG8qeiBQKZ3wEyZG09eDAfhuUR5kfZCG4Q01u2YDoRzObxLd8Ruf7HNvtefucFLubciWvOSzbDUisoz0wwOSgJGHucC3IR+1mb/4gz/dI2wvWFInhKcQz4ivkuHaFj8XwvZMcpkwPKtg3pRGTleX/gfjbHcx2VcWRcMPdlDMgTgst9ouN763TZUHHLxjECyB9pkLrR1nhG0cS/aig8Bq1+AH7tvl1wLVxm1Z77DVX4aUIxBH2YUcOgpe6mrWFi6LK3im4/grZECsL/XC4tsTEHjO/U3SazUuhP+6LiCYqp50+3zZf3RpWlxZoYjm5SJ9VIWabocO/Ef26G38lKottW1XsSQUan7myYFFyeyon2hnufzMuxpyXTJ7TLekXCi2gLYbGjldgiRmGShPXzSar+hC2\");\n    $op->setDataKey(\"JxAB39A9yUsf6wMD0jwGKCuY7mmzWaeEj85MH02AfKGUxOkJ00JK+o8vGG55cUF9voYU4QQ1Jec4p6nKmsxXmTREEaJwmQErotD4fpcFOyoqWTLMZfslrkHgiqbwru/V\");\n    $paymentOne = new AnetAPI\\PaymentType();\n    $paymentOne->setOpaqueData($op);\n\n    //create a transaction\n    $transactionRequestType = new AnetAPI\\TransactionRequestType();\n    $transactionRequestType->setTransactionType( \"authCaptureTransaction\"); \n    $transactionRequestType->setAmount(76);\n    $transactionRequestType->setCallId(\"9004180129978687101\");\n    $transactionRequestType->setPayment($paymentOne);\n\n    $request = new AnetAPI\\CreateTransactionRequest();\n    $request->setMerchantAuthentication($merchantAuthentication);\n    $request->setRefId( $refId);\n    $request->setTransactionRequest( $transactionRequestType);\n\n    $controller = new AnetController\\CreateTransactionController($request);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if($response->getMessages()->getResultCode() == \"Ok\")\n      {\n        $tresponse = $response->getTransactionResponse();\n        if ($tresponse != null && $tresponse->getMessages() != null)\n        {\n          echo \" Transaction Response code : \" . $tresponse->getResponseCode() . \"\\n\";\n          echo \" AUTH CODE : \" . $tresponse->getAuthCode() . \"\\n\";\n          echo \" TRANS ID  : \" . $tresponse->getTransId() . \"\\n\";\n          echo \" Code : \" . $tresponse->getMessages()[0]->getCode() . \"\\n\"; \n\t        echo \" Description : \" . $tresponse->getMessages()[0]->getDescription() . \"\\n\";\n        }\n        else\n        {\n          echo \"Transaction Failed \\n\";\n          if($tresponse->getErrors() != null)\n          {\n            echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n            echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";            \n          }\n        }\n      }\n      else\n      {\n        echo \"Transaction Failed \\n\";\n        $tresponse = $response->getTransactionResponse();\n        if($tresponse != null && $tresponse->getErrors() != null)\n        {\n          echo \" Error code  : \" . $tresponse->getErrors()[0]->getErrorCode() . \"\\n\";\n          echo \" Error message : \" . $tresponse->getErrors()[0]->getErrorText() . \"\\n\";                      \n        }\n        else\n        {\n          echo \" Error code  : \" . $response->getMessages()->getMessage()[0]->getCode() . \"\\n\";\n          echo \" Error message : \" . $response->getMessages()->getMessage()[0]->getText() . \"\\n\";\n        }\n      }      \n    }\n    else\n    {\n      echo  \"No response returned \\n\";\n    }\n\n    return $response;\n  }\n  \n  if(!defined('DONT_RUN_SAMPLES'))\n    createVisaSrcTransaction();\n\n?>\n"
  },
  {
    "path": "VisaCheckout/decrypt-visa-src-data.php",
    "content": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contract\\v1 as AnetAPI;\n  use net\\authorize\\api\\controller as AnetController;\n\n  define(\"AUTHORIZENET_LOG_FILE\", \"phplog\");\n\nfunction decryptVisaSrcData()\n{\n    /* Create a merchantAuthenticationType object with authentication details\n       retrieved from the constants file */\n    $merchantAuthentication = new AnetAPI\\MerchantAuthenticationType();\n    $merchantAuthentication->setName(\\SampleCodeConstants::MERCHANT_LOGIN_ID);\n    $merchantAuthentication->setTransactionKey(\\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);\n    \n    // Set the transaction's refId\n    $refId = 'ref' . time();\n\n    // Create the payment data from a Visa Checkout blob\n    $op = new AnetAPI\\OpaqueDataType();\n    $op->setDataDescriptor(\"COMMON.VCO.ONLINE.PAYMENT\");\n    $op->setDataValue(\"4Ng5pzJ6DXfAvLSzVauN9KTufx5lTHhFlnuIr248N3fjtyHrHqMuhOkB1BLiSjKWeTM9+BNj3+9nY56d7CsUfIuvVSTaJRhQQSex1dS2Y2Y+/cA5U+3D1pg5YtTmDVUGlsu1simAd3huwPnwD+CG6O8Ml0AmXvYHntmL3vFaJomadMQBy27k8Dbh5eplPBwyawKUVJ7GqTyKLe8aOYkBUHT5ANWkq2hlGps44BOoDHZ26JWjHdorBZtVIqMK1SIyW4Dih5c/Y//w2toA8WBTPILIvt4h6HPPvWZMZCHCqom9D2k4WGH5+BCEY2jHI7gfYV6xRx54i5vitsYTKm3CyA0C5+l0FNDkfUFHDvVUG9FVzRWVd0TXYhDwfa2pcfI68eYvkEfeT+ZNJ24ZXKPrJo6KZ3x6eZAhzgAMFiC+tPsiygb2zQy5PVoYoBIGj/NGNRqmhZTOEajcO3ZjWxfAnLZAmvMi+pEwJCMmuIY4qRU3RfcaXhAoaUPpDxqrSxR1m+CUKYVdt3nnnQeVaVqf+RaeV9cyFJvILeBPXTBVC50AckVLS37UuBWgWaWcchjRPk9mriDu2KlHQwdR4zu0jnLh4i3tbxV416QBcYLO6AF2Ixlm3GzqGE6QcVssgFCUAhklBWGNLP62O1jtyV4NgTD36QhvHEHby7o4XBB+mjlY6xSEXR+IW9u64AzfDCsTxWiAOE65le6cSk4NDV8DrtYeIozILivWu6wFSpy1gMfiDot4Ndv3C9xCFvH0Bzlky7NoZrvSolKTVNTs8W8UqMFV19qGl6SRaNUEhCqgso/FkdO0eGXFMdQPuP11wQzK/9F3yB9gS2rpXi9sy8DrCqnJ9EXMmliSstKuQl5+yfGc8K3Urot3t+BmNoOvzM9Aha/PzmbLnuKBN6/DUbIw5mhNMCvIA1ByispKpjeV682jl4uslkRsitGLcIOBREFXvGaLxRb37HJkXCHk+jorpDz7LUQhVkClN+hW0vXtgdHQFCIOL7uREdbvk6BZbQlFsuVEKGZxPbKPEJfqMbH54B4a4P5XNQHm4Yt4haH4T0JuYgzoSo76uuXD3g5IuUvy7x8Ykuja1rwW/k//SZAiGaZraRIIAEnzHiUP8dcufb/RonHGnJcYXIEWeIF1lX980bDA+H4vlO8/nN/Mj+EL6tT95MfRDiQHUW69qkqotQd7FJ5uWT+NtetzqDsN5s3sIhwkLKIn9EDLIav5v4SXKxkG+ycMJmGFcfhs7Td9O6hl+Om/JD3he3rgfClaFi/ZR7AVY6fWbAAm9QftKijQ6rskPDYL9Y3gVSA9rdduSg97fUHC+FdfyQXGH552cDLs2ZgzYw6KluXHEuwhACgNotxToPYTTdZxxNr1vPoqYCqHDL2dL8dkuO59/sbZE1m4ektKvUC2wz0UdTDVbHN8HSrLPn2hf/xQp5bKeDDjYkWvNKuwy+aug9H+Uu/m1LuPK/YdogVv9l25y/c2Qbj3dAJ9xTuKjmiJLKlRh4SUI9+05HjDF+i84AoUZ8LuC7LGtrN8ReYIktLhaXq9+XDh5fv4NYhnuYgWkUioKtx1dmfOMHjpLm4aE8Ra1gpJQcZAgwnqYubQvnYy0nY4VaykNix7m3vZwItpKOLqxDYxa3q0qUw25X9zafAM61kPW6EP+4idPzHNww6r1FD4Ihq644dCnCXwoSQ531DW6oAPot8iLZ/xXwoWwrW05k9t2RHjjLbw1L5r1CKgShJQfX7nkJxfGyuw1RmqoQDuNt/tj9M/dHOnoPnOYZZN0JX+Al8PI5zs+LLajw1imu9YcSpwMz3ZlfQqTfI0fjSCc8Is6qVYDMvKD0TweY4hiIxkzs+RyQmPgIeIWqf7Su5+RcnXitb3OuFibBGCjdDeG0ESG8qeiBQKZ3wEyZG09eDAfhuUR5kfZCG4Q01u2YDoRzObxLd8Ruf7HNvtefucFLubciWvOSzbDUisoz0wwOSgJGHucC3IR+1mb/4gz/dI2wvWFInhKcQz4ivkuHaFj8XwvZMcpkwPKtg3pRGTleX/gfjbHcx2VcWRcMPdlDMgTgst9ouN763TZUHHLxjECyB9pkLrR1nhG0cS/aig8Bq1+AH7tvl1wLVxm1Z77DVX4aUIxBH2YUcOgpe6mrWFi6LK3im4/grZECsL/XC4tsTEHjO/U3SazUuhP+6LiCYqp50+3zZf3RpWlxZoYjm5SJ9VIWabocO/Ef26G38lKottW1XsSQUan7myYFFyeyon2hnufzMuxpyXTJ7TLekXCi2gLYbGjldgiRmGShPXzSar+hC2\");\n    $op->setDataKey(\"JxAB39A9yUsf6wMD0jwGKCuY7mmzWaeEj85MH02AfKGUxOkJ00JK+o8vGG55cUF9voYU4QQ1Jec4p6nKmsxXmTREEaJwmQErotD4fpcFOyoqWTLMZfslrkHgiqbwru/V\");\n    \n    //create a decrypt request\n    $decryptRequest = new AnetAPI\\DecryptPaymentDataRequest();\n    $decryptRequest->setRefId( $refId);\n    $decryptRequest->setMerchantAuthentication($merchantAuthentication);\n    $decryptRequest->setOpaqueData($op);\n    $decryptRequest->setCallId(\"9004180129978687101\");\n\n\n    $controller = new AnetController\\DecryptPaymentDataController($decryptRequest);\n    $response = $controller->executeWithApiResponse( \\net\\authorize\\api\\constants\\ANetEnvironment::SANDBOX);\n\n    if ($response != null)\n    {\n      if ($response->getMessages()->getResultCode() == \"Ok\")\n      {\n          echo \"Card Number  : \" . $response->getCardInfo()->getCardNumber() . \"\\n\";\n          echo \"Amount : \" . $response->getPaymentDetails()->getAmount() . \"\\n\";\n      }\n    }\n    return $response;\n  }\n\n  if(!defined('DONT_RUN_SAMPLES'))\n    decryptVisaSrcData();\n\n?>\n"
  },
  {
    "path": "composer.json",
    "content": "{\n  \"require\": {\n  \"php\": \">=5.6\",\n  \"ext-curl\": \"*\",\n  \"authorizenet/authorizenet\": \">=2.0 || <2.1\" \n  }\n}\n"
  },
  {
    "path": "composer.json.sdk-dev",
    "content": "{\n  \"require\": {\n  \"php\": \">=5.6\",\n  \"ext-curl\": \"*\",\n  \"phpunit/phpunit\": \"~9.0||~9.5\",\n  \"authorizenet/authorizenet\": \">=2.0 || <2.1\" \n  },\n  \"autoload\": {\n    \"classmap\": [\"constants\", \"lib\"]\n  }\n}\n"
  },
  {
    "path": "constants/SampleCodeConstants.php",
    "content": "<?php\nclass SampleCodeConstants\n{\n\t//merchant credentials\n\tconst MERCHANT_LOGIN_ID = \"5KP3u95bQpv\";\n\tconst MERCHANT_TRANSACTION_KEY = \"346HZ32z3fP4hTG2\";\n}\n?>\n\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:noNamespaceSchemaLocation=\"http://phpunit.de/phpunit.xsd\"\n    backupGlobals=\"false\"\n    verbose=\"true\" colors=\"true\">\n\n    <testsuites>\n        <testsuite name=\"AuthorizeNet Integration Tests\">\n            <directory suffix=\"Test.php\">.</directory>\n        </testsuite>\n    </testsuites>\n\n    <filter>\n        <whitelist processUncoveredFilesFromWhitelist=\"true\">\n            <directory suffix=\".php\">./lib</directory>\n            <exclude>\n                <directory>./vendor</directory>\n                <directory>./tests</directory>\n                <directory>./build</directory>\n            </exclude>\n        </whitelist>\n    </filter>\n\n    <php>\n        <const name=\"PHPUNIT_TESTSUITE\" value=\"true\" />\n        \n        <!-- Enter your test account credentials to run tests against sandbox. -->\n        <const name=\"AUTHORIZENET_API_LOGIN_ID\" value=\"5KP3u95bQpv\" />\n        <const name=\"AUTHORIZENET_TRANSACTION_KEY\" value=\"346HZ32z3fP4hTG2\" />\n        <const name=\"AUTHORIZENET_MD5_SETTING\" value=\"\" />\n        \n        <!-- Enter your live account credentials to run tests against production gateway. -->\n        <const name=\"MERCHANT_LIVE_API_LOGIN_ID\" value=\"\" />\n        <const name=\"MERCHANT_LIVE_TRANSACTION_KEY\" value=\"\" />\n        \n        <!-- Card Present Sandbox Credentials -->\n        <const name=\"CP_API_LOGIN_ID\" value=\"\" />\n        <const name=\"CP_TRANSACTION_KEY\" value=\"\" />\n        \n        <const name=\"AUTHORIZENET_LOG_FILE\" value=\"./testslog\" />\n    </php>\n\n</phpunit>\n"
  }
]