Full Code of AuthorizeNet/sample-code-php for AI

master 6f14b0f30e30 cached
75 files
236.8 KB
66.0k tokens
114 symbols
1 requests
Download .txt
Showing preview only (258K chars total). Download the full file or copy to clipboard to get everything.
Repository: AuthorizeNet/sample-code-php
Branch: master
Commit: 6f14b0f30e30
Files: 75
Total size: 236.8 KB

Directory structure:
gitextract_p37jv6o6/

├── .gitignore
├── .travis.yml
├── AcceptSuite/
│   ├── create-an-accept-payment-transaction.php
│   ├── get-accept-customer-profile-page.php
│   └── get-an-accept-payment-page.php
├── CustomerProfiles/
│   ├── create-customer-payment-profile.php
│   ├── create-customer-profile-from-transaction.php
│   ├── create-customer-profile-with-accept-nonce.php
│   ├── create-customer-profile.php
│   ├── create-customer-shipping-address.php
│   ├── delete-customer-payment-profile.php
│   ├── delete-customer-profile.php
│   ├── delete-customer-shipping-address.php
│   ├── get-customer-payment-profile-list.php
│   ├── get-customer-payment-profile.php
│   ├── get-customer-profile-ids.php
│   ├── get-customer-profile.php
│   ├── get-customer-shipping-address.php
│   ├── update-customer-payment-profile.php
│   ├── update-customer-profile.php
│   ├── update-customer-shipping-address.php
│   └── validate-customer-payment-profile.php
├── FraudManagement/
│   ├── approve-or-decline-held-transaction.php
│   └── get-held-transaction-list.php
├── LICENSE
├── MobileInAppTransactions/
│   ├── create-an-accept-transaction.php
│   ├── create-an-android-pay-transaction.php
│   ├── create-an-apple-pay-transaction.php
│   └── create-google-pay-transaction.php
├── PayPalExpressCheckout/
│   ├── authorization-and-capture-continued.php
│   ├── authorization-and-capture.php
│   ├── authorization-only-continued.php
│   ├── authorization-only.php
│   ├── credit.php
│   ├── get-details.php
│   ├── prior-authorization-capture.php
│   └── void.php
├── PaymentTransactions/
│   ├── authorize-credit-card.php
│   ├── capture-funds-authorized-through-another-channel.php
│   ├── capture-previously-authorized-amount.php
│   ├── charge-credit-card.php
│   ├── charge-customer-profile.php
│   ├── charge-tokenized-credit-card.php
│   ├── create-chase-pay-transaction.php
│   ├── credit-bank-account.php
│   ├── debit-bank-account.php
│   ├── refund-transaction.php
│   ├── update-split-tender-group.php
│   └── void-transaction.php
├── README.md
├── RecurringBilling/
│   ├── cancel-subscription.php
│   ├── create-subscription-from-customer-profile.php
│   ├── create-subscription.php
│   ├── get-list-of-subscriptions.php
│   ├── get-subscription-status.php
│   ├── get-subscription.php
│   └── update-subscription.php
├── SampleCodeList.txt
├── Sha512/
│   └── compute_trans_hashSHA2.php
├── TestRunner.php
├── TransactionReporting/
│   ├── get-account-updater-job-details.php
│   ├── get-account-updater-job-summary.php
│   ├── get-batch-statistics.php
│   ├── get-customer-profile-transaction-list.php
│   ├── get-merchant-details.php
│   ├── get-settled-batch-list.php
│   ├── get-transaction-details.php
│   ├── get-transaction-list.php
│   └── get-unsettled-transaction-list.php
├── VisaCheckout/
│   ├── create-visa-src-transaction.php
│   └── decrypt-visa-src-data.php
├── composer.json
├── composer.json.sdk-dev
├── constants/
│   └── SampleCodeConstants.php
└── phpunit.xml.dist

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep

# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep

# Parameters
/app/config/parameters.yml
/app/config/parameters.ini

# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/

# Assets and user uploads
/web/bundles/
/web/uploads/

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

# Composer PHAR
/composer.phar
/composer.lock

# log files
/phplog

# PHP Storm
/.idea/*

# Operating system files
.DS_Store
/lib
/*.cache
/testslog


================================================
FILE: .travis.yml
================================================
language: php

matrix:
  include:
    - php: 5.6
      env: PHPUNIT_VERSION=5.6.*
      dist: trusty
    - php: 7.0
      env: PHPUNIT_VERSION=5.6.*
      dist: trusty
    - php: 7.1
      env: PHPUNIT_VERSION=5.7.*
      dist: trusty
    - php: 7.2
      env: PHPUNIT_VERSION=8.5.*
      dist: bionic
    - php: 7.3
      env: PHPUNIT_VERSION=9.5.*
      dist: bionic
    - php: 7.4
      env: PHPUNIT_VERSION=9.5.*
      dist: bionic
    - php: 8.0
      env: PHPUNIT_VERSION=9.5.*
      dist: bionic

sudo: false

before_script:
    - composer require "phpunit/phpunit:${PHPUNIT_VERSION}" --no-update
    - composer update --prefer-dist

script:
    - phpunit TestRunner.php .



================================================
FILE: AcceptSuite/create-an-accept-payment-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function createAnAcceptPaymentTransaction($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment object for a payment nonce
    $opaqueData = new AnetAPI\OpaqueDataType();
    $opaqueData->setDataDescriptor("COMMON.ACCEPT.INAPP.PAYMENT");
    $opaqueData->setDataValue("119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9");


    // Add the payment data to a paymentType object
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setOpaqueData($opaqueData);

    // Create order information
    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("10101");
    $order->setDescription("Golf Shirts");

    // Set the customer's Bill To address
    $customerAddress = new AnetAPI\CustomerAddressType();
    $customerAddress->setFirstName("Ellen");
    $customerAddress->setLastName("Johnson");
    $customerAddress->setCompany("Souveniropolis");
    $customerAddress->setAddress("14 Main Street");
    $customerAddress->setCity("Pecan Springs");
    $customerAddress->setState("TX");
    $customerAddress->setZip("44628");
    $customerAddress->setCountry("USA");

    // Set the customer's identifying information
    $customerData = new AnetAPI\CustomerDataType();
    $customerData->setType("individual");
    $customerData->setId("99999456654");
    $customerData->setEmail("EllenJohnson@example.com");

    // Add values for transaction settings
    $duplicateWindowSetting = new AnetAPI\SettingType();
    $duplicateWindowSetting->setSettingName("duplicateWindow");
    $duplicateWindowSetting->setSettingValue("60");

    // Add some merchant defined fields. These fields won't be stored with the transaction,
    // but will be echoed back in the response.
    $merchantDefinedField1 = new AnetAPI\UserFieldType();
    $merchantDefinedField1->setName("customerLoyaltyNum");
    $merchantDefinedField1->setValue("1128836273");

    $merchantDefinedField2 = new AnetAPI\UserFieldType();
    $merchantDefinedField2->setName("favoriteColor");
    $merchantDefinedField2->setValue("blue");

    // Create a TransactionRequestType object and add the previous objects to it
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction"); 
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setOrder($order);
    $transactionRequestType->setPayment($paymentOne);
    $transactionRequestType->setBillTo($customerAddress);
    $transactionRequestType->setCustomer($customerData);
    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);
    $transactionRequestType->addToUserFields($merchantDefinedField1);
    $transactionRequestType->addToUserFields($merchantDefinedField2);

    // Assemble the complete transaction request
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    // Create the controller and get the response
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
    

    if ($response != null) {
        // Check to see if the API request was successfully received and acted upon
        if ($response->getMessages()->getResultCode() == "Ok") {
            // Since the API request was successful, look for a transaction response
            // and parse it to display the results of authorizing the card
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Successfully created transaction with Transaction ID: " . $tresponse->getTransId() . "\n";
                echo " Transaction Response Code: " . $tresponse->getResponseCode() . "\n";
                echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Auth Code: " . $tresponse->getAuthCode() . "\n";
                echo " Description: " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
            // Or, print errors if the API request wasn't successful
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error Code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error Message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }      
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
      createAnAcceptPaymentTransaction("2.23");
}
?>

================================================
FILE: AcceptSuite/get-accept-customer-profile-page.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getAcceptCustomerProfilePage($customerprofileid = "123212")
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
    
	  // Use an existing payment profile ID for this Merchant name and Transaction key
	  
	  $setting = new AnetAPI\SettingType();
	  $setting->setSettingName("hostedProfileReturnUrl");
	  $setting->setSettingValue("https://returnurl.com/return/");
	  
	  //$alist = new AnetAPI\ArrayOfSettingType();
	  //$alist->addToSetting($setting);
	  
	  $request = new AnetAPI\GetHostedProfilePageRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setCustomerProfileId($customerprofileid);
	  $request->addToHostedProfileSettings($setting);
	  
	  $controller = new AnetController\GetHostedProfilePageController($request);
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		  echo $response->getToken()."\n";
	   }
	  else
	  {
		  echo "ERROR :  Failed to get hosted profile page\n";
		  $errorMessages = $response->getMessages()->getMessage();
		  echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }
	  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      getAcceptCustomerProfilePage();    
?>


================================================
FILE: AcceptSuite/get-an-accept-payment-page.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getAnAcceptPaymentPage()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction");
    $transactionRequestType->setAmount("12.23");

    // Set Hosted Form options
    $setting1 = new AnetAPI\SettingType();
    $setting1->setSettingName("hostedPaymentButtonOptions");
    $setting1->setSettingValue("{\"text\": \"Pay\"}");

    $setting2 = new AnetAPI\SettingType();
    $setting2->setSettingName("hostedPaymentOrderOptions");
    $setting2->setSettingValue("{\"show\": false}");

    $setting3 = new AnetAPI\SettingType();
    $setting3->setSettingName("hostedPaymentReturnOptions");
    $setting3->setSettingValue(
        "{\"url\": \"https://mysite.com/receipt\", \"cancelUrl\": \"https://mysite.com/cancel\", \"showReceipt\": true}"
    );

    // Build transaction request
    $request = new AnetAPI\GetHostedPaymentPageRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    $request->addToHostedPaymentSettings($setting1);
    $request->addToHostedPaymentSettings($setting2);
    $request->addToHostedPaymentSettings($setting3);
    
    //execute request
    $controller = new AnetController\GetHostedPaymentPageController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
        echo $response->getToken()."\n";
    } else {
        echo "ERROR :  Failed to get hosted payment page token\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "RESPONSE : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
}
if (!defined('DONT_RUN_SAMPLES')) {
    getAnAcceptPaymentPage();
}


================================================
FILE: CustomerProfiles/create-customer-payment-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function createCustomerPaymentProfile($existingcustomerprofileid, $phoneNumber)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create a Customer Profile Request
    //  1. (Optionally) create a Payment Profile
    //  2. (Optionally) create a Shipping Profile
    //  3. Create a Customer Profile (or specify an existing profile)
    //  4. Submit a CreateCustomerProfile Request
    //  5. Validate Profile ID returned

    // Set credit card information for payment profile
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4242424242424242");
    $creditCard->setExpirationDate("2038-12");
    $creditCard->setCardCode("142");
    $paymentCreditCard = new AnetAPI\PaymentType();
    $paymentCreditCard->setCreditCard($creditCard);

    // Create the Bill To info for new payment type
    $billto = new AnetAPI\CustomerAddressType();
    $billto->setFirstName("Ellen".$phoneNumber);
    $billto->setLastName("Johnson");
    $billto->setCompany("Souveniropolis");
    $billto->setAddress("14 Main Street");
    $billto->setCity("Pecan Springs");
    $billto->setState("TX");
    $billto->setZip("44628");
    $billto->setCountry("USA");
    $billto->setPhoneNumber($phoneNumber);
    $billto->setfaxNumber("999-999-9999");

    // Create a new Customer Payment Profile object
    $paymentprofile = new AnetAPI\CustomerPaymentProfileType();
    $paymentprofile->setCustomerType('individual');
    $paymentprofile->setBillTo($billto);
    $paymentprofile->setPayment($paymentCreditCard);
    $paymentprofile->setDefaultPaymentProfile(true);

    $paymentprofiles[] = $paymentprofile;

    // Assemble the complete transaction request
    $paymentprofilerequest = new AnetAPI\CreateCustomerPaymentProfileRequest();
    $paymentprofilerequest->setMerchantAuthentication($merchantAuthentication);

    // Add an existing profile id to the request
    $paymentprofilerequest->setCustomerProfileId($existingcustomerprofileid);
    $paymentprofilerequest->setPaymentProfile($paymentprofile);
    $paymentprofilerequest->setValidationMode("liveMode");

    // Create the controller and get the response
    $controller = new AnetController\CreateCustomerPaymentProfileController($paymentprofilerequest);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) {
        echo "Create Customer Payment Profile SUCCESS: " . $response->getCustomerPaymentProfileId() . "\n";
    } else {
        echo "Create Customer Payment Profile: ERROR Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";

    }
    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
      createCustomerPaymentProfile("1929905607", "000-000-0009");
}
?>


================================================
FILE: CustomerProfiles/create-customer-profile-from-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function createCustomerProfileFromTransaction($transId= "2249066517")
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $customerProfile = new AnetAPI\CustomerProfileBaseType();
    $customerProfile->setMerchantCustomerId("123212");
    $customerProfile->setEmail(rand(0, 10000) . "@test" .".com");
    $customerProfile->setDescription(rand(0, 10000) ."sample description");
      
    $request = new AnetAPI\CreateCustomerProfileFromTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setTransId($transId);

    // You can either specify the customer information in form of customerProfileBaseType object
    $request->setCustomer($customerProfile);
    //  OR   
    // You can just provide the customer Profile ID
        //$request->setCustomerProfileId("123343");

    $controller = new AnetController\CreateCustomerProfileFromTransactionController($request);

    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) {
        echo "SUCCESS: PROFILE ID : " . $response->getCustomerProfileId() . "\n";
    } else {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
}

// Provide a transaction that has customer information
if (!defined('DONT_RUN_SAMPLES')) {
      createCustomerProfileFromTransaction("2249066517");
}

?>


================================================
FILE: CustomerProfiles/create-customer-profile-with-accept-nonce.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function createCustomerProfileWithAcceptNonce($email)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create a Customer Profile Request
    //  1. (Optionally) create a Payment Profile
    //  2. (Optionally) create a Shipping Profile
    //  3. Create a Customer Profile (or specify an existing profile)
    //  4. Submit a CreateCustomerProfile Request
    //  5. Validate Profile ID returned

    // Set the payment data for the payment profile to a token obtained from Accept.js
    $op = new AnetAPI\OpaqueDataType();
    $op->setDataDescriptor("COMMON.ACCEPT.INAPP.PAYMENT");
    $op->setDataValue("119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setOpaqueData($op);


    // Create the Bill To info for new payment type
    $billto = new AnetAPI\CustomerAddressType();
    $billto->setFirstName("Ellen");
    $billto->setLastName("Johnson");
    $billto->setCompany("Souveniropolis");
    $billto->setAddress("14 Main Street");
    $billto->setCity("Pecan Springs");
    $billto->setState("TX");
    $billto->setZip("44628");
    $billto->setCountry("USA");
    $billto->setPhoneNumber(123-123-1234);
    $billto->setfaxNumber("999-999-9999");

    // Create a new Customer Payment Profile object
    $paymentprofile = new AnetAPI\CustomerPaymentProfileType();
    $paymentprofile->setCustomerType('individual');
    $paymentprofile->setBillTo($billto);
    $paymentprofile->setPayment($paymentOne);
    $paymentprofile->setDefaultPaymentProfile(true);

    $paymentprofiles[] = $paymentprofile;

    // Create a new CustomerProfileType and add the payment profile object
    $customerprofile = new AnetAPI\CustomerProfileType();
    $customerprofile->setDescription("Customer Test PHP Accept Test");

    $customerprofile->setMerchantCustomerId("M_".$email);
    $customerprofile->setEmail($email);
    $customerprofile->setPaymentProfiles($paymentprofiles);

    // Assemble the complete transaction request
    $request = new AnetAPI\CreateCustomerProfileRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setProfile($customerprofile);

    // Create the controller and get the response
    $controller = new AnetController\CreateCustomerProfileController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) {
        echo "Succesfully created customer profile : " . $response->getCustomerProfileId() . "\n";
        $paymentProfiles = $response->getCustomerPaymentProfileIdList();
        echo "SUCCESS: PAYMENT PROFILE ID : " . $paymentProfiles[0] . "\n";
    } else {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    createCustomerProfileWithAcceptNonce("test123@test.com");
}
?>


================================================
FILE: CustomerProfiles/create-customer-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function createCustomerProfile($email)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create a Customer Profile Request
    //  1. (Optionally) create a Payment Profile
    //  2. (Optionally) create a Shipping Profile
    //  3. Create a Customer Profile (or specify an existing profile)
    //  4. Submit a CreateCustomerProfile Request
    //  5. Validate Profile ID returned

    // Set credit card information for payment profile
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4242424242424242");
    $creditCard->setExpirationDate("2038-12");
    $creditCard->setCardCode("142");
    $paymentCreditCard = new AnetAPI\PaymentType();
    $paymentCreditCard->setCreditCard($creditCard);

    // Create the Bill To info for new payment type
    $billTo = new AnetAPI\CustomerAddressType();
    $billTo->setFirstName("Ellen");
    $billTo->setLastName("Johnson");
    $billTo->setCompany("Souveniropolis");
    $billTo->setAddress("14 Main Street");
    $billTo->setCity("Pecan Springs");
    $billTo->setState("TX");
    $billTo->setZip("44628");
    $billTo->setCountry("USA");
    $billTo->setPhoneNumber("888-888-8888");
    $billTo->setfaxNumber("999-999-9999");

    // Create a customer shipping address
    $customerShippingAddress = new AnetAPI\CustomerAddressType();
    $customerShippingAddress->setFirstName("James");
    $customerShippingAddress->setLastName("White");
    $customerShippingAddress->setCompany("Addresses R Us");
    $customerShippingAddress->setAddress(rand() . " North Spring Street");
    $customerShippingAddress->setCity("Toms River");
    $customerShippingAddress->setState("NJ");
    $customerShippingAddress->setZip("08753");
    $customerShippingAddress->setCountry("USA");
    $customerShippingAddress->setPhoneNumber("888-888-8888");
    $customerShippingAddress->setFaxNumber("999-999-9999");

    // Create an array of any shipping addresses
    $shippingProfiles[] = $customerShippingAddress;


    // Create a new CustomerPaymentProfile object
    $paymentProfile = new AnetAPI\CustomerPaymentProfileType();
    $paymentProfile->setCustomerType('individual');
    $paymentProfile->setBillTo($billTo);
    $paymentProfile->setPayment($paymentCreditCard);
    $paymentProfiles[] = $paymentProfile;


    // Create a new CustomerProfileType and add the payment profile object
    $customerProfile = new AnetAPI\CustomerProfileType();
    $customerProfile->setDescription("Customer 2 Test PHP");
    $customerProfile->setMerchantCustomerId("M_" . time());
    $customerProfile->setEmail($email);
    $customerProfile->setpaymentProfiles($paymentProfiles);
    $customerProfile->setShipToList($shippingProfiles);


    // Assemble the complete transaction request
    $request = new AnetAPI\CreateCustomerProfileRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setProfile($customerProfile);

    // Create the controller and get the response
    $controller = new AnetController\CreateCustomerProfileController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
  
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
        echo "Succesfully created customer profile : " . $response->getCustomerProfileId() . "\n";
        $paymentProfiles = $response->getCustomerPaymentProfileIdList();
        echo "SUCCESS: PAYMENT PROFILE ID : " . $paymentProfiles[0] . "\n";
    } else {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    createCustomerProfile("test123@test.com");
}


================================================
FILE: CustomerProfiles/create-customer-shipping-address.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function createCustomerShippingAddress($existingcustomerprofileid = "1929905607", 
    $phoneNumber="000-000-0000"
) {
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
    
    // Use An existing customer profile id for this merchant name and transaction key

    // Create the customer shipping address
    $customershippingaddress = new AnetAPI\CustomerAddressType();
    $customershippingaddress->setFirstName("James");
    $customershippingaddress->setLastName("White");
    $customershippingaddress->setCompany("Addresses R Us");
    $customershippingaddress->setAddress(rand() . " North Spring Street");
    $customershippingaddress->setCity("Toms River");
    $customershippingaddress->setState("NJ");
    $customershippingaddress->setZip("08753");
    $customershippingaddress->setCountry("USA");
    $customershippingaddress->setPhoneNumber($phoneNumber);
    $customershippingaddress->setFaxNumber("999-999-9999");

    // Create a new customer shipping address for an existing customer profile

    $request = new AnetAPI\CreateCustomerShippingAddressRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setCustomerProfileId($existingcustomerprofileid);
    $request->setAddress($customershippingaddress);
    $controller = new AnetController\CreateCustomerShippingAddressController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) {
        echo "Create Customer Shipping Address SUCCESS: ADDRESS ID : " . $response-> getCustomerAddressId() . "\n";
    } else {
        echo "Create Customer Shipping Address  ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
}
if (!defined('DONT_RUN_SAMPLES')) {
      createCustomerShippingAddress();
}
?>


================================================
FILE: CustomerProfiles/delete-customer-payment-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function deleteCustomerPaymentProfile($customerProfileId= "1929905607", 
    $customerpaymentprofileid = "1842074814"
) {
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
    
	  // Use an existing payment profile ID for this Merchant name and Transaction key
	  
	  $request = new AnetAPI\DeleteCustomerPaymentProfileRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setCustomerProfileId($customerProfileId);
	  $request->setCustomerPaymentProfileId($customerpaymentprofileid);
	  $controller = new AnetController\DeleteCustomerPaymentProfileController($request);
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		  echo "SUCCESS: Delete Customer Payment Profile  SUCCESS  :" . "\n";
	   }
	  else
	  {
		  echo "ERROR :  Delete Customer Payment Profile: Invalid response\n";
		  $errorMessages = $response->getMessages()->getMessage();
		  echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }
	  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      deleteCustomerPaymentProfile();
 ?>


================================================
FILE: CustomerProfiles/delete-customer-profile.php
================================================
<?php
	require 'vendor/autoload.php';
	require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function deleteCustomerProfile($customerProfileId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

	  // Delete an existing customer profile  
	  $request = new AnetAPI\DeleteCustomerProfileRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setCustomerProfileId( $customerProfileId );

	  $controller = new AnetController\DeleteCustomerProfileController($request);
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		echo "DeleteCustomerProfile SUCCESS : " .  "\n";
	  }
	  else
	  {
		echo "ERROR :  DeleteCustomerProfile: Invalid response\n";
		$errorMessages = $response->getMessages()->getMessage();
		echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }

	  return $response;
  }
  
  if(!defined('DONT_RUN_SAMPLES'))
      deleteCustomerProfile("1929905651");
?>


================================================
FILE: CustomerProfiles/delete-customer-shipping-address.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function deleteCustomerShippingAddress($customerprofileid = "1929905607", $customeraddressid = "901116911")
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
    
	  // Use an existing customer profile and address id for this merchant name and transaction key
	  // Delete an existing customer shipping address for an existing customer profile
	  $request = new AnetAPI\DeleteCustomerShippingAddressRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setCustomerProfileId($customerprofileid);
	  $request->setCustomerAddressId($customeraddressid);

	  $controller = new AnetController\DeleteCustomerShippingAddressController($request);
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		  echo "Delete Customer Shipping Address SUCCESS" . "\n";
	   }
	  else
	  {
		  echo "Delete Customer Shipping Address  ERROR :  Invalid response\n";
		  $errorMessages = $response->getMessages()->getMessage();
		  echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }
	  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      deleteCustomerShippingAddress();
?>


================================================
FILE: CustomerProfiles/get-customer-payment-profile-list.php
================================================
<?php

require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getCustomerPaymentProfileList()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
        
        //Setting the paging
        $paging = new AnetAPI\PagingType();
        $paging->setLimit("1000");
        $paging->setOffset("1");
        
        //Setting the sorting
        $sorting = new AnetAPI\CustomerPaymentProfileSortingType();
        $sorting->setOrderBy("id");
        $sorting->setOrderDescending(false);
        
        //Creating the request with the required parameters
        $request = new AnetAPI\GetCustomerPaymentProfileListRequest();
        $request->setMerchantAuthentication($merchantAuthentication);
        $request->setRefId($refId);
        $request->setPaging($paging);
        $request->setSorting($sorting);
        $request->setSearchType("cardsExpiringInMonth");
        $request->setMonth("2020-12");
    
        // Controller
        $controller = new AnetController\GetCustomerPaymentProfileListController($request);
        // Getting the response
        $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
        
    if (($response != null)) {
        if ($response->getMessages()->getResultCode() == "Ok") {
            // Success
            echo "GetCustomerPaymentProfileList SUCCESS: " . "\n";
            $errorMessages = $response->getMessages()->getMessage();
            echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
            echo "Total number of Results in the result set" . $response->getTotalNumInResultSet() . "\n";
            // Displaying the customer payment profile list
            foreach ($response->getPaymentProfiles() as $paymentProfile) {
                echo "\nCustomer Profile ID: " . $paymentProfile->getCustomerProfileId() . "\n";
                echo "Payment profile ID: " . $paymentProfile->getCustomerPaymentProfileId() . "\n";
                echo "Credit Card Number: " . $paymentProfile->getPayment()->getCreditCard()->getCardNumber() . "\n";
                if ($paymentProfile->getBillTo() != null) {
                    echo "First Name in Billing Address: " . $paymentProfile->getBillTo()->getFirstName() . "\n";
                }
            }
        } else {
            // Error
            echo "GetCustomerPaymentProfileList ERROR :  Invalid response\n";
            $errorMessages = $response->getMessages()->getMessage();
            echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
        }
    } else {
        // Failed to get the response
        echo "NULL Response Error";
    }
    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    getCustomerPaymentProfileList();
}


================================================
FILE: CustomerProfiles/get-customer-payment-profile.php
================================================
<?php

require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getCustomerPaymentProfile($customerProfileId="1929905607", 
    $customerPaymentProfileId= "1842074814"
) {
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

	//request requires customerProfileId and customerPaymentProfileId
	$request = new AnetAPI\GetCustomerPaymentProfileRequest();
	$request->setMerchantAuthentication($merchantAuthentication);
	$request->setRefId( $refId);
	$request->setCustomerProfileId($customerProfileId);
	$request->setCustomerPaymentProfileId($customerPaymentProfileId);

	$controller = new AnetController\GetCustomerPaymentProfileController($request);
	$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	if(($response != null)){
		if ($response->getMessages()->getResultCode() == "Ok")
		{
			echo "GetCustomerPaymentProfile SUCCESS: " . "\n";
			echo "Customer Payment Profile Id: " . $response->getPaymentProfile()->getCustomerPaymentProfileId() . "\n";
			echo "Customer Payment Profile Billing Address: " . $response->getPaymentProfile()->getbillTo()->getAddress(). "\n";
			echo "Customer Payment Profile Card Last 4 " . $response->getPaymentProfile()->getPayment()->getCreditCard()->getCardNumber(). "\n";

			if($response->getPaymentProfile()->getSubscriptionIds() != null) 
			{
				if($response->getPaymentProfile()->getSubscriptionIds() != null)
				{

					echo "List of subscriptions:";
					foreach($response->getPaymentProfile()->getSubscriptionIds() as $subscriptionid)
						echo $subscriptionid . "\n";
				}
			}
		}
		else
		{
			echo "GetCustomerPaymentProfile ERROR :  Invalid response\n";
			$errorMessages = $response->getMessages()->getMessage();
		    echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
		}
	}
	else{
		echo "NULL Response Error";
	}
	return $response;
}
if(!defined('DONT_RUN_SAMPLES'))
    getCustomerPaymentProfile();
?>


================================================
FILE: CustomerProfiles/get-customer-profile-ids.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getCustomerProfileIds()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Get all existing customer profile ID's
    $request = new AnetAPI\GetCustomerProfileIdsRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $controller = new AnetController\GetCustomerProfileIdsController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    {
        echo "GetCustomerProfileId's SUCCESS: " . "\n";
        $profileIds[] = $response->getIds();
        echo "There are " . count($profileIds[0]) . " Customer Profile ID's for this Merchant Name and Transaction Key" . "\n";
     }
    else
    {
        echo "GetCustomerProfileId's ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      getCustomerProfileIds();
?>


================================================
FILE: CustomerProfiles/get-customer-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getCustomerProfile()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

		// Create the payment data for a credit card
	  $creditCard = new AnetAPI\CreditCardType();
	  $creditCard->setCardNumber( "4111111111111111" );
	  $creditCard->setExpirationDate("2038-12");
	  $paymentCreditCard = new AnetAPI\PaymentType();
	  $paymentCreditCard->setCreditCard($creditCard);

	  // Create the Bill To info
	  $billto = new AnetAPI\CustomerAddressType();
	  $billto->setFirstName("Ellen");
	  $billto->setLastName("Johnson");
	  $billto->setCompany("Souveniropolis");
	  $billto->setAddress("14 Main Street");
	  $billto->setCity("Pecan Springs");
	  $billto->setState("TX");
	  $billto->setZip("44628");
	  $billto->setCountry("USA");
  
	  // Create a Customer Profile Request
	  //  1. create a Payment Profile
	  //  2. create a Customer Profile   
	  //  3. Submit a CreateCustomerProfile Request
	  //  4. Validate Profiiel ID returned

	  $paymentprofile = new AnetAPI\CustomerPaymentProfileType();

	  $paymentprofile->setCustomerType('individual');
	  $paymentprofile->setBillTo($billto);
	  $paymentprofile->setPayment($paymentCreditCard);
	  $paymentprofiles[] = $paymentprofile;
	  $customerprofile = new AnetAPI\CustomerProfileType();
	  $customerprofile->setDescription("Customer 2 Test PHP");
	  $merchantCustomerId = time().rand(1,150);
	  $customerprofile->setMerchantCustomerId($merchantCustomerId);
	  $customerprofile->setEmail("test2@domain.com");
	  $customerprofile->setPaymentProfiles($paymentprofiles);

	  $request = new AnetAPI\CreateCustomerProfileRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setRefId( $refId);
	  $request->setProfile($customerprofile);
	  $controller = new AnetController\CreateCustomerProfileController($request);
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		  echo "SUCCESS: CreateCustomerProfile PROFILE ID : " . $response->getCustomerProfileId() . "\n";

		  $profileIdRequested = $response->getCustomerProfileId();
	   }
	  else
	  {
		  echo "ERROR :  CreateCustomerProfile: Invalid response\n";
		  $errorMessages = $response->getMessages()->getMessage();
		  echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }
	  // Retrieve an existing customer profile along with all the associated payment profiles and shipping addresses

	  $request = new AnetAPI\GetCustomerProfileRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setCustomerProfileId($profileIdRequested);
	  $controller = new AnetController\GetCustomerProfileController($request);
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		echo "GetCustomerProfile SUCCESS : " .  "\n";
		$profileSelected = $response->getProfile();
		$paymentProfilesSelected = $profileSelected->getPaymentProfiles();
		echo "Profile Has " . count($paymentProfilesSelected). " Payment Profiles" . "\n";

		if($response->getSubscriptionIds() != null) 
		{
			if($response->getSubscriptionIds() != null)
			{

				echo "List of subscriptions:";
				foreach($response->getSubscriptionIds() as $subscriptionid)
					echo $subscriptionid . "\n";
			}
		}
	  }
	  else
	  {
		echo "ERROR :  GetCustomerProfile: Invalid response\n";
		$errorMessages = $response->getMessages()->getMessage();
		echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }
	  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
  {
	getCustomerProfile();
  }
?>


================================================
FILE: CustomerProfiles/get-customer-shipping-address.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function getCustomerShippingAddress($customerprofileid, $customeraddressid)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
    
	  // An existing customer profile id and shipping address id for this merchant name and transaction key
	  $customerProfileId = $customerprofileid;
	  $customerAddressId = $customeraddressid;

	  $request = new AnetAPI\GetCustomerShippingAddressRequest();
	  $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setCustomerProfileId($customerProfileId);
	  $request->setCustomerAddressId($customerAddressId);
	  
	  $controller = new AnetController\GetCustomerShippingAddressController($request);
	  
	  //Retrieving existing customer shipping address
	  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
	  {
		  echo "Get Customer Shipping Address SUCCESS" . "\n";
		  echo "	FirstName 	: " . $response->getAddress()->getFirstName() . "\n";
		  echo "	LastName 	: " . $response->getAddress()->getLastName() . "\n";
		  echo "	Company 	: " . $response->getAddress()->getCompany() . "\n";
		  echo "	Address 	: " . $response->getAddress()->getAddress() . "\n";
		  echo "	City 		: " . $response->getAddress()->getCity() . "\n";
		  echo "	State 		: " . $response->getAddress()->getState() . "\n";
		  echo "	Zip 		: " . $response->getAddress()->getZip() . "\n";
		  echo "	Country 	: " . $response->getAddress()->getCountry() . "\n";
		  echo "	Phone Number 	: " . $response->getAddress()->getPhoneNumber() . "\n";
		  echo "	FAX Number 	: " . $response->getAddress()->getFaxNumber() . "\n";
		  echo "Customer AddressId 	: " . $response->getAddress()->getCustomerAddressId() . "\n";

		if($response->getSubscriptionIds() != null) 
		{
			if($response->getSubscriptionIds() != null)
			{

				echo "List of subscriptions:";
				foreach($response->getSubscriptionIds() as $subscriptionid)
					echo $subscriptionid . "\n";
			}
		}
	   }
	  else
	  {
		  echo "Get Customer Shipping Address  ERROR :  Invalid response\n";
		  $errorMessages = $response->getMessages()->getMessage();
		  echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	  }
	  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      getCustomerShippingAddress("36152127","36976566");
?>


================================================
FILE: CustomerProfiles/update-customer-payment-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function updateCustomerPaymentProfile($customerProfileId = "1916322670",
    $customerPaymentProfileId = "1829639667") 
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

	$request = new AnetAPI\GetCustomerPaymentProfileRequest();
	$request->setMerchantAuthentication($merchantAuthentication);
	$request->setRefId( $refId);
	$request->setCustomerProfileId($customerProfileId);
	$request->setCustomerPaymentProfileId($customerPaymentProfileId);
	  
	$controller = new AnetController\GetCustomerPaymentProfileController($request);
	$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
	if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
	{
		$billto = new AnetAPI\CustomerAddressType();
		$billto = $response->getPaymentProfile()->getbillTo();
		
		$creditCard = new AnetAPI\CreditCardType();
		$creditCard->setCardNumber( "4111111111111111" );
		$creditCard->setExpirationDate("2038-12");
		
		$paymentCreditCard = new AnetAPI\PaymentType();
		$paymentCreditCard->setCreditCard($creditCard);
		$paymentprofile = new AnetAPI\CustomerPaymentProfileExType();
		$paymentprofile->setBillTo($billto);
		$paymentprofile->setCustomerPaymentProfileId($customerPaymentProfileId);
		$paymentprofile->setPayment($paymentCreditCard);	

		// We're updating the billing address but everything has to be passed in an update
		// For card information you can pass exactly what comes back from an GetCustomerPaymentProfile
		// if you don't need to update that info
		  
		// Update the Bill To info for new payment type
		$billto->setFirstName("Mrs Mary");
		$billto->setLastName("Doe");
		$billto->setAddress("9 New St.");
		$billto->setCity("Brand New City");
		$billto->setState("WA");
		$billto->setZip("98004");
		$billto->setPhoneNumber("000-000-0000");
		$billto->setfaxNumber("999-999-9999");
		$billto->setCountry("USA");
		 
		// Update the Customer Payment Profile object
		$paymentprofile->setBillTo($billto);

		// Submit a UpdatePaymentProfileRequest
		$request = new AnetAPI\UpdateCustomerPaymentProfileRequest();
		$request->setMerchantAuthentication($merchantAuthentication);
		$request->setCustomerProfileId($customerProfileId);
		$request->setPaymentProfile( $paymentprofile );

		$controller = new AnetController\UpdateCustomerPaymentProfileController($request);
		$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
		if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
		{
			$Message = $response->getMessages()->getMessage();
			print_r($response);
			echo "Update Customer Payment Profile SUCCESS: " . $Message[0]->getCode() . "  " .$Message[0]->getText() . "\n";
		}
		else if ($response != null)
		{
			$errorMessages = $response->getMessages()->getMessage();
			echo "Failed to Update Customer Payment Profile :  " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
		}
	
		return $response;
	}
	else
	{
		echo "Failed to Get Customer Payment Profile :  " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
	}

	return $response;
}

if(!defined('DONT_RUN_SAMPLES'))
    updateCustomerPaymentProfile();
?>


================================================
FILE: CustomerProfiles/update-customer-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function updateCustomerProfile()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

      // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber( "4111111111111111" );
    $creditCard->setExpirationDate("2038-12");
    $paymentCreditCard = new AnetAPI\PaymentType();
    $paymentCreditCard->setCreditCard($creditCard);

    // Create the Bill To info
    $billto = new AnetAPI\CustomerAddressType();
    $billto->setFirstName("Ellen");
    $billto->setLastName("Johnson");
    $billto->setCompany("Souveniropolis");
    $billto->setAddress("14 Main Street");
    $billto->setCity("Pecan Springs");
    $billto->setState("TX");
    $billto->setZip("44628");
    $billto->setCountry("USA");
    
   // Create a Customer Profile Request
   //  1. create a Payment Profile
   //  2. create a Customer Profile   
   //  3. Submit a CreateCustomerProfile Request
   //  4. Validate Profiiel ID returned

    $paymentprofile = new AnetAPI\CustomerPaymentProfileType();

    $paymentprofile->setCustomerType('individual');
    $paymentprofile->setBillTo($billto);
    $paymentprofile->setPayment($paymentCreditCard);
    $paymentprofiles[] = $paymentprofile;
    $customerprofile = new AnetAPI\CustomerProfileType();
    $customerprofile->setDescription("Update Customer Profile Request Test for PHP");
    $merchantCustomerId = time().rand(1,150);
    $customerprofile->setMerchantCustomerId($merchantCustomerId);
    $customerprofile->setEmail(rand(0,10000) . "@test.com");
    $customerprofile->setPaymentProfiles($paymentprofiles);

    $request = new AnetAPI\CreateCustomerProfileRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setProfile($customerprofile);
    $controller = new AnetController\CreateCustomerProfileController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    {
        echo "SUCCESS: CreateCustomerProfile PROFILE ID : " . $response->getCustomerProfileId() . "\n";

        $profileidcreated = $response->getCustomerProfileId();
     }
    else
    {
        echo "ERROR :  CreateCustomerProfile: Invalid response\n";
    }
    // Update an existing customer profile

    $updatecustomerprofile = new AnetAPI\CustomerProfileExType();
    $updatecustomerprofile->setCustomerProfileId($profileidcreated);
    $updatecustomerprofile->setDescription("Updated existing Profile Request");
    $updatecustomerprofile->setEmail("updated".rand(0,10000)."@test.com");

    $request = new AnetAPI\UpdateCustomerProfileRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setProfile($updatecustomerprofile);

    $controller = new AnetController\UpdateCustomerProfileController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    {
      echo "UpdateCustomerProfile SUCCESS : " .  "\n";
    // Validate the description and e-mail that was updated
        $request = new AnetAPI\GetCustomerProfileRequest();
        $request->setMerchantAuthentication($merchantAuthentication);
        $request->setCustomerProfileId($profileidcreated );
        $controller = new AnetController\GetCustomerProfileController($request);
        $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
        if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
        {
            echo "Get updated CustomerProfile  SUCCESS : " .  "\n";
            $profileselected = $response->getProfile();
            echo "Updated Customer Profile Customer description : " . $profileselected->getDescription() . "\n";
            echo "Updated Customer Profile EMail description : " . $profileselected->getEmail() . "\n";
        }
        else
        {
          echo "ERROR :  GetCustomerProfile: Invalid response\n";
          $errorMessages = $response->getMessages()->getMessage();
          echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
        }
    }
    else
    {
      echo "ERROR :  UpdateCustomerProfile: Invalid response\n";
      $errorMessages = $response->getMessages()->getMessage();
      echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
    updateCustomerProfile();
?>


================================================
FILE: CustomerProfiles/update-customer-shipping-address.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function updateCustomerShippingAddress($customerprofileid, $customeraddressid)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

  // An existing customer profile id for this merchant name and transaction key
  $existingcustomerprofileid = $customerprofileid;

  // Create the customer shipping address
  $customershippingaddress = new AnetAPI\CustomerAddressExType();
  $customershippingaddress->setFirstName("Jane");
  $customershippingaddress->setLastName("White");
  $customershippingaddress->setCompany("Addresses R Us");
  $customershippingaddress->setAddress("14 North Spring Street Suite 240");
  $customershippingaddress->setCity("Toms River");
  $customershippingaddress->setState("NJ");
  $customershippingaddress->setZip("08753");
  $customershippingaddress->setCountry("USA");
  $customershippingaddress->setPhoneNumber("201-000-0000");
  $customershippingaddress->setFaxNumber("973-999-9999");
  $customershippingaddress->setCustomerAddressId($customeraddressid);

  // Update an existing customer shipping address for an existing customer profile
  $request = new AnetAPI\UpdateCustomerShippingAddressRequest();
  $request->setMerchantAuthentication($merchantAuthentication);
  $request->setCustomerProfileId($existingcustomerprofileid);
  $request->setAddress($customershippingaddress);
  $controller = new AnetController\UpdateCustomerShippingAddressController($request);
  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
  {
      echo "Update Customer Shipping Address SUCCESS.\n";
   }
  else
  {
      echo "Update Customer Shipping Address  ERROR :  Invalid response\n";
      $errorMessages = $response->getMessages()->getMessage();
      echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
  }
  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      updateCustomerShippingAddress( "1929905607","901116911");
?>


================================================
FILE: CustomerProfiles/validate-customer-payment-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");
  
function validateCustomerPaymentProfile($customerProfileId= "1929905607",
    $customerPaymentProfileId= "1842074814"
) {
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
  
  // Use an existing payment profile ID for this Merchant name and Transaction key
  //validationmode tests , does not send an email receipt
  $validationmode = "testMode";

  $request = new AnetAPI\ValidateCustomerPaymentProfileRequest();
  
  $request->setMerchantAuthentication($merchantAuthentication);
  $request->setCustomerProfileId($customerProfileId);
  $request->setCustomerPaymentProfileId($customerPaymentProfileId);
  $request->setValidationMode($validationmode);
  
  $controller = new AnetController\ValidateCustomerPaymentProfileController($request);
  $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
  
  if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
  {
      $validationMessages = $response->getMessages()->getMessage();
      echo "Response : " . $validationMessages[0]->getCode() . "  " .$validationMessages[0]->getText() . "\n";
   }
  else
  {
      echo "ERROR :  Validate Customer Payment Profile: Invalid response\n";
      $errorMessages = $response->getMessages()->getMessage();
      echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
  }
  return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      validateCustomerPaymentProfile();
 ?>


================================================
FILE: FraudManagement/approve-or-decline-held-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function approveOrDeclineHeldTransaction()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

      //create a transaction
      $transactionRequestType = new AnetAPI\HeldTransactionRequestType();
      $transactionRequestType->setAction("approve"); //other possible value: decline
      $transactionRequestType->setRefTransId("60012148205");
      

      $request = new AnetAPI\UpdateHeldTransactionRequest();
      $request->setMerchantAuthentication($merchantAuthentication);
      $request->setHeldTransactionRequest( $transactionRequestType);
      $controller = new AnetController\UpdateHeldTransactionController($request);
      $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
      

      if ($response != null)
      {
        if($response->getMessages()->getResultCode() == "Ok")
        {
          $tresponse = $response->getTransactionResponse();
          
	        if ($tresponse != null && $tresponse->getMessages() != null)   
          {
            echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
            echo "Charge Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
            echo "Charge Credit Card TRANS ID  : " . $tresponse->getTransId() . "\n";
            echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
          }
          else
          {
            echo "Transaction Failed \n";
            if($tresponse->getErrors() != null)
            {
              echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
              echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
            }
          }
        }
        else
        {
          echo "Transaction Failed \n";
          $tresponse = $response->getTransactionResponse();
          if($tresponse != null && $tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
          }
          else
          {
            echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
            echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
          }
        }      
      }
      else
      {
        echo  "No response returned \n";
      }

      return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
      approveOrDeclineHeldTransaction();
?>


================================================
FILE: FraudManagement/get-held-transaction-list.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function getHeldTransactionList() 
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();


    $request = new AnetAPI\GetUnsettledTransactionListRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setStatus("pendingApproval");


    $controller = new AnetController\GetUnsettledTransactionListController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
    {
		if(null != $response->getTransactions())
		{
			foreach($response->getTransactions() as $tx)
			{
			  echo "SUCCESS: TransactionID: " . $tx->getTransId() . "\n";
			}
        }
		else{
			echo "No suspicious transactions for the merchant." . "\n";
		}
    }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    getHeldTransactionList();

?>


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 Authorize.Net

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: MobileInAppTransactions/create-an-accept-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function createAnAcceptTransaction($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment object for a payment nonce
    $opaqueData = new AnetAPI\OpaqueDataType();
    $opaqueData->setDataDescriptor("COMMON.ACCEPT.INAPP.PAYMENT");
    $opaqueData->setDataValue("119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9");
    
    // Add the payment data to a paymentType object
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setOpaqueData($opaqueData);

    // Create order information
    $order = new AnetAPI\OrderType();
    $order->invoiceNumber("10101");
    $order->setDescription("Golf Shirts");

    // Set the customer's Bill To address
    $customerAddress = new AnetAPI\CustomerAddressType();
    $customerAddress->setFirstName("Ellen");
    $customerAddress->setLastName("Johnson");
    $customerAddress->setCompany("Souveniropolis");
    $customerAddress->setAddress("14 Main Street");
    $customerAddress->setCity("Pecan Springs");
    $customerAddress->setState("TX");
    $customerAddress->setZip("44628");
    $customerAddress->setCountry("USA");

    // Set the customer's identifying information
    $customerData = new AnetAPI\CustomerDataType();
    $customerData->setType("individual");
    $customerData->setId("99999456654");
    $customerData->setEmail("EllenJohnson@example.com");

    //Add values for transaction settings
    $duplicateWindowSetting = new AnetAPI\SettingType();
    $duplicateWindowSetting->setSettingName("duplicateWindow");
    $duplicateWindowSetting->setSettingValue("600");

    // Create a transactionRequestType object and add the previous objects to it
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType( "authCaptureTransaction"); 
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setOrder($order);
    $transactionRequestType->setPayment($paymentOne);
    $transactionRequestType->setBillTo($customerAddress);
    $transactionRequestType->setCustomer($customerData);
    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);

    // Assemble the complete transaction request
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    // Create the controller and get the response
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
    

    if ($response != null) {
        // Check to see if the API request was successfully received and acted upon
        if ($response->getMessages()->getResultCode() == "Ok") {
            // Since the API request was successful, look for a transaction response
            // and parse it to display the results of authorizing the card
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Successfully created transaction with Transaction ID: " . $tresponse->getTransId() . "\n";
                echo " Transaction Response Code: " . $tresponse->getResponseCode() . "\n";
                echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Auth Code: " . $tresponse->getAuthCode() . "\n";
                echo " Description: " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
            // Or, print errors if the API request wasn't successful
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error Code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error Message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }      
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
      CreateAnAcceptTransaction("2.23");
}
?>


================================================
FILE: MobileInAppTransactions/create-an-android-pay-transaction.php
================================================
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");

function createAnAndroidPayTransaction()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $op = new AnetAPI\OpaqueDataType();
    $op->setDataDescriptor("COMMON.ANDROID.INAPP.PAYMENT");
    $op->setDataValue("eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoiOTRlZTA1OTMzNWU1ODdlNTAxY2M0YmY5MDYxM2UwODE0ZjAwYTdiMDhiYzdjNjQ4ZmQ4NjVhMmFmNmEyMmNjMiIsInRyYW5zYWN0aW9uSWQiOiJjMWNhZjVhZTcyZjAwMzlhODJiYWQ5MmI4MjgzNjM3MzRmODViZjJmOWNhZGYxOTNkMWJhZDlkZGNiNjBhNzk1IiwiZXBoZW1lcmFsUHVibGljS2V5IjoiTUlJQlN6Q0NBUU1HQnlxR1NNNDlBZ0V3Z2ZjQ0FRRXdMQVlIS29aSXpqMEJBUUloQVBcL1wvXC9cLzhBQUFBQkFBQUFBQUFBQUFBQUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL01Gc0VJUFwvXC9cL1wvOEFBQUFCQUFBQUFBQUFBQUFBQUFBQVwvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cLzhCQ0JheGpYWXFqcVQ1N1BydlZWMm1JYThaUjBHc014VHNQWTd6ancrSjlKZ1N3TVZBTVNkTmdpRzV3U1RhbVo0NFJPZEpyZUJuMzZRQkVFRWF4ZlI4dUVzUWtmNHZPYmxZNlJBOG5jRGZZRXQ2ek9nOUtFNVJkaVl3cFpQNDBMaVwvaHBcL200N242MHA4RDU0V0s4NHpWMnN4WHM3THRrQm9ONzlSOVFJaEFQXC9cL1wvXC84QUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cLys4NXZxdHB4ZWVoUE81eXNMOFl5VlJBZ0VCQTBJQUJHbStnc2wwUFpGVFwva0RkVVNreHd5Zm84SnB3VFFRekJtOWxKSm5tVGw0REdVdkFENEdzZUdqXC9wc2hCWjBLM1RldXFEdFwvdERMYkUrOFwvbTB5Q21veHc9IiwicHVibGljS2V5SGFzaCI6IlwvYmI5Q05DMzZ1QmhlSEZQYm1vaEI3T28xT3NYMkora0pxdjQ4ek9WVmlRPSJ9LCJzaWduYXR1cmUiOiJNSUlEUWdZSktvWklodmNOQVFjQ29JSURNekNDQXk4Q0FRRXhDekFKQmdVckRnTUNHZ1VBTUFzR0NTcUdTSWIzRFFFSEFhQ0NBaXN3Z2dJbk1JSUJsS0FEQWdFQ0FoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQXdKekVsTUNNR0ExVUVBeDRjQUdNQWFBQnRBR0VBYVFCQUFIWUFhUUJ6QUdFQUxnQmpBRzhBYlRBZUZ3MHhOREF4TURFd05qQXdNREJhRncweU5EQXhNREV3TmpBd01EQmFNQ2N4SlRBakJnTlZCQU1lSEFCakFHZ0FiUUJoQUdrQVFBQjJBR2tBY3dCaEFDNEFZd0J2QUcwd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFOQzgra2d0Z212V0YxT3pqZ0ROcmpURUJSdW9cLzVNS3ZsTTE0NnBBZjdHeDQxYmxFOXc0ZklYSkFEN0ZmTzdRS2pJWFlOdDM5ckx5eTd4RHdiXC81SWtaTTYwVFoyaUkxcGo1NVVjOGZkNGZ6T3BrM2Z0WmFRR1hOTFlwdEcxZDlWN0lTODJPdXA5TU1vMUJQVnJYVFBITmNzTTk5RVBVblBxZGJlR2M4N20wckFnTUJBQUdqWERCYU1GZ0dBMVVkQVFSUk1FK0FFSFpXUHJXdEpkN1laNDMxaENnN1lGU2hLVEFuTVNVd0l3WURWUVFESGh3QVl3Qm9BRzBBWVFCcEFFQUFkZ0JwQUhNQVlRQXVBR01BYndCdGdoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQURnWUVBYlVLWUNrdUlLUzlRUTJtRmNNWVJFSW0ybCtYZzhcL0pYditHQlZRSmtPS29zY1k0aU5ERkFcL2JRbG9nZjlMTFU4NFRId05SbnN2VjNQcnY3UlRZODFncTBkdEM4elljQWFBa0NISUkzeXFNbko0QU91NkVPVzlrSmsyMzJnU0U3V2xDdEhiZkxTS2Z1U2dRWDhLWFFZdVpMazJScjYzTjhBcFhzWHdCTDNjSjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0=");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setOpaqueData($op);

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

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo " AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo " TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
}

if(!defined('DONT_RUN_SAMPLES'))
    createAnAndroidPayTransaction();
?>


================================================
FILE: MobileInAppTransactions/create-an-apple-pay-transaction.php
================================================
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");

function createAnApplePayTransaction()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $op = new AnetAPI\OpaqueDataType();
    $op->setDataDescriptor("COMMON.APPLE.INAPP.PAYMENT");
    $op->setDataValue("eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoiOTRlZTA1OTMzNWU1ODdlNTAxY2M0YmY5MDYxM2UwODE0ZjAwYTdiMDhiYzdjNjQ4ZmQ4NjVhMmFmNmEyMmNjMiIsInRyYW5zYWN0aW9uSWQiOiJjMWNhZjVhZTcyZjAwMzlhODJiYWQ5MmI4MjgzNjM3MzRmODViZjJmOWNhZGYxOTNkMWJhZDlkZGNiNjBhNzk1IiwiZXBoZW1lcmFsUHVibGljS2V5IjoiTUlJQlN6Q0NBUU1HQnlxR1NNNDlBZ0V3Z2ZjQ0FRRXdMQVlIS29aSXpqMEJBUUloQVBcL1wvXC9cLzhBQUFBQkFBQUFBQUFBQUFBQUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL01Gc0VJUFwvXC9cL1wvOEFBQUFCQUFBQUFBQUFBQUFBQUFBQVwvXC9cL1wvXC9cL1wvXC9cL1wvXC9cL1wvXC9cLzhCQ0JheGpYWXFqcVQ1N1BydlZWMm1JYThaUjBHc014VHNQWTd6ancrSjlKZ1N3TVZBTVNkTmdpRzV3U1RhbVo0NFJPZEpyZUJuMzZRQkVFRWF4ZlI4dUVzUWtmNHZPYmxZNlJBOG5jRGZZRXQ2ek9nOUtFNVJkaVl3cFpQNDBMaVwvaHBcL200N242MHA4RDU0V0s4NHpWMnN4WHM3THRrQm9ONzlSOVFJaEFQXC9cL1wvXC84QUFBQUFcL1wvXC9cL1wvXC9cL1wvXC9cLys4NXZxdHB4ZWVoUE81eXNMOFl5VlJBZ0VCQTBJQUJHbStnc2wwUFpGVFwva0RkVVNreHd5Zm84SnB3VFFRekJtOWxKSm5tVGw0REdVdkFENEdzZUdqXC9wc2hCWjBLM1RldXFEdFwvdERMYkUrOFwvbTB5Q21veHc9IiwicHVibGljS2V5SGFzaCI6IlwvYmI5Q05DMzZ1QmhlSEZQYm1vaEI3T28xT3NYMkora0pxdjQ4ek9WVmlRPSJ9LCJzaWduYXR1cmUiOiJNSUlEUWdZSktvWklodmNOQVFjQ29JSURNekNDQXk4Q0FRRXhDekFKQmdVckRnTUNHZ1VBTUFzR0NTcUdTSWIzRFFFSEFhQ0NBaXN3Z2dJbk1JSUJsS0FEQWdFQ0FoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQXdKekVsTUNNR0ExVUVBeDRjQUdNQWFBQnRBR0VBYVFCQUFIWUFhUUJ6QUdFQUxnQmpBRzhBYlRBZUZ3MHhOREF4TURFd05qQXdNREJhRncweU5EQXhNREV3TmpBd01EQmFNQ2N4SlRBakJnTlZCQU1lSEFCakFHZ0FiUUJoQUdrQVFBQjJBR2tBY3dCaEFDNEFZd0J2QUcwd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFOQzgra2d0Z212V0YxT3pqZ0ROcmpURUJSdW9cLzVNS3ZsTTE0NnBBZjdHeDQxYmxFOXc0ZklYSkFEN0ZmTzdRS2pJWFlOdDM5ckx5eTd4RHdiXC81SWtaTTYwVFoyaUkxcGo1NVVjOGZkNGZ6T3BrM2Z0WmFRR1hOTFlwdEcxZDlWN0lTODJPdXA5TU1vMUJQVnJYVFBITmNzTTk5RVBVblBxZGJlR2M4N20wckFnTUJBQUdqWERCYU1GZ0dBMVVkQVFSUk1FK0FFSFpXUHJXdEpkN1laNDMxaENnN1lGU2hLVEFuTVNVd0l3WURWUVFESGh3QVl3Qm9BRzBBWVFCcEFFQUFkZ0JwQUhNQVlRQXVBR01BYndCdGdoQmNsK1BmMytVNHBrMTNuVkQ5bndRUU1Ba0dCU3NPQXdJZEJRQURnWUVBYlVLWUNrdUlLUzlRUTJtRmNNWVJFSW0ybCtYZzhcL0pYditHQlZRSmtPS29zY1k0aU5ERkFcL2JRbG9nZjlMTFU4NFRId05SbnN2VjNQcnY3UlRZODFncTBkdEM4elljQWFBa0NISUkzeXFNbko0QU91NkVPVzlrSmsyMzJnU0U3V2xDdEhiZkxTS2Z1U2dRWDhLWFFZdVpMazJScjYzTjhBcFhzWHdCTDNjSjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0=");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setOpaqueData($op);

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

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);


    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo " AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo " TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
}

if(!defined('DONT_RUN_SAMPLES'))
    createAnApplePayTransaction();
?>


================================================
FILE: MobileInAppTransactions/create-google-pay-transaction.php
================================================
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");

function createGooglePayTransaction()
{
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    $refId = 'ref' . time();

    $opaqueData = new AnetAPI\OpaqueDataType();
    $opaqueData->setDataDescriptor("COMMON.GOOGLE.INAPP.PAYMENT");
    $opaqueData->setDataValue("1234567890ABCDEF1111AAAA2222BBBB3333CCCC4444DDDD5555EEEE6666FFFF7777888899990000");
    $paymentType = new AnetAPI\PaymentType();
    $paymentType->setOpaqueData($opaqueData);

    $lineItem = new AnetAPI\LineItemType();
    $lineItem->setItemId("1");
    $lineItem->setName("vase");
    $lineItem->setDescription("Cannes logo");
    $lineItem->setQuantity(18);
    $lineItem->setUnitPrice(45.00);

    $lineItemsArray = array();
    $lineItemsArray[0] = $lineItem;

    $tax = new AnetAPI\ExtendedAmountType();
    $tax->setAmount(5.00);
    $tax->setName("level2 tax name");
    $tax->setDescription("level2 tax");

    $userField = new AnetAPI\UserFieldType();
    $userFields = array();

    $userField->setName("UserDefinedFieldName1");
    $userField->setValue("UserDefinedFieldValue1");
    $userFields[0] = $userField;

    $userField->setName("UserDefinedFieldName2");
    $userField->setValue("UserDefinedFieldValue2");
    $userFields[1] = $userField;

    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction");
    $transactionRequestType->setAmount(151);
    $transactionRequestType->setPayment($paymentType);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);


    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo " AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo " TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
}

if(!defined('DONT_RUN_SAMPLES'))
    createGooglePayTransaction();
?>


================================================
FILE: PayPalExpressCheckout/authorization-and-capture-continued.php
================================================
<?php
    require 'vendor/autoload.php';
    require_once 'constants/SampleCodeConstants.php';
    use net\authorize\api\contract\v1 as AnetAPI;
    use net\authorize\api\controller as AnetController;

    define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalAuthorizeCaptureContinued($refTransId, $payerID)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Set PayPal compatible merchant credentials
    $payPalType=new AnetAPI\PayPalType();
    $payPalType->setPayerID($payerID);

    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setPayPal($payPalType);

    // Create an authorize and capture continued transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureContinueTransaction");
    $transactionRequestType->setPayment($paymentOne);
    $transactionRequestType->setRefTransId($refTransId);

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

    if ($response != null) {
        if ($response->getMessages()->getResultCode() == "Ok") {
            $tresponse = $response->getTransactionResponse();
          
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo "Transaction Response...\n";
                echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
                //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent
                echo "Secure acceptance URL: ".$tresponse->getSecureAcceptance()->getSecureAcceptanceUrl()."\n";
                echo "Transaction ID: ".$tresponse->getTransId()."\n";
                echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    payPalAuthorizeCaptureContinued("2241708986", "6ZSCSYG33VP8Q");
}


================================================
FILE: PayPalExpressCheckout/authorization-and-capture.php
================================================
<?php
	require 'vendor/autoload.php';
	require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

    define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalAuthorizeCapture($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $payPalType=new AnetAPI\PayPalType();
    $payPalType->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $payPalType->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");

    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setPayPal($payPalType);

		// Create an authorize and capture transaction
		$transactionRequestType = new AnetAPI\TransactionRequestType();
		$transactionRequestType->setTransactionType( "authCaptureTransaction");
		$transactionRequestType->setPayment($paymentOne);
		$transactionRequestType->setAmount($amount);

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

	    if ($response != null)
	    {
	      if($response->getMessages()->getResultCode() == "Ok")
	      {
	        $tresponse = $response->getTransactionResponse();
	        
	        if ($tresponse != null && $tresponse->getMessages() != null)   
	        {
          		echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
				//Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent
				echo "Secure acceptance URL: ".$tresponse->getSecureAcceptance()->getSecureAcceptanceUrl()."\n";
				echo "Transaction ID: ".$tresponse->getTransId()."\n";
				
	          	echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	          	echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
	        }
	        else
	        {
	          echo "Transaction Failed \n";
	          if($tresponse->getErrors() != null)
	          {
	            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
	            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
	          }
	        }
	      }
	      else
	      {
	        echo "Transaction Failed \n";
	        $tresponse = $response->getTransactionResponse();
	        

	        if($tresponse != null && $tresponse->getErrors() != null)
	        {
	          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
	          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
	        }
	        else
	        {
	          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
	          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
	        }
	      }      
	    }
	    else
	    {
	      echo  "No response returned \n";
	    }

		return $response;
	}

  	if(!defined('DONT_RUN_SAMPLES'))
    	payPalAuthorizeCapture(12.322);
?>


================================================
FILE: PayPalExpressCheckout/authorization-only-continued.php
================================================
<?php
    require 'vendor/autoload.php';
    require_once 'constants/SampleCodeConstants.php';
    use net\authorize\api\contract\v1 as AnetAPI;
    use net\authorize\api\controller as AnetController;

    define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalAuthorizeOnlyContinued($transactionId, $payerId)
{

    echo "PayPal Authorize Only Continued Transaction\n";
    
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Set PayPal compatible merchant credentials
    $payPalType=new AnetAPI\PayPalType();
    $payPalType->setPayerID($payerID);

    $paypal_type->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $paypal_type->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    
    $payment_type = new AnetAPI\PaymentType();
    $payment_type->setPayPal($paypal_type);

    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authOnlyContinueTransaction");
    $transactionRequestType->setRefTransId($transactionId);
    $transactionRequestType->setAmount(125.34);
    $transactionRequestType->setPayment($payment_type);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);

    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null) {
        if ($response->getMessages()->getResultCode() == "Ok") {
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
                echo "TRANS ID  : " . $tresponse->getTransId() . "\n";
                echo "Payer ID : " . $tresponse->getSecureAcceptance()->getPayerID();
                echo "Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }
    } else {
        echo  "No response returned \n";
    }

    return $response;
}
  
if (!defined('DONT_RUN_SAMPLES')) {
    payPalAuthorizeOnlyContinued("2241711631", "JJLRRB29QC7RU");
}


================================================
FILE: PayPalExpressCheckout/authorization-only.php
================================================
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalAuthorizeOnly($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment data for a paypal account
    $payPalType = new AnetAPI\PayPalType();
    $payPalType->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $payPalType->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setPayPal($payPalType);

    //create a auth-only transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType( "authOnlyTransaction");
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setPayment($paymentOne);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
            echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
            echo "Received response code: ".$tresponse->getResponseCode()."\n";
            //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent\n";
            echo "Secure acceptance URL: ".$tresponse->getSecureAcceptance()->getSecureAcceptanceUrl()."\n";
            echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
}

if(!defined('DONT_RUN_SAMPLES'))
    payPalAuthorizeOnly(23.34);

?>


================================================
FILE: PayPalExpressCheckout/credit.php
================================================
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalCredit($transactionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    //use transaction of already settled paypal checkout transaction
    $refTransId = $transactionId;

    // Create the payment data for a paypal account
    $payPalType = new AnetAPI\PayPalType();
    $payPalType->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $payPalType->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setPayPal($payPalType);

    //create a refund transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType( "refundTransaction");
    $transactionRequestType->setAmount(181);
    $transactionRequestType->setPayment($paymentOne);
    ///refTransId of successfully settled transaction
    $transactionRequestType->setRefTransId($refTransId);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
            echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
            echo "Credit SUCCESS AUTH CODE : " . $tresponse->getAuthCode() . "\n";
            echo "Credit TRANS ID  : " . $tresponse->getTransId() . "\n";
            echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo "No response returned \n";
    }

    return $response;
}

if(!defined('DONT_RUN_SAMPLES')){
	//use transaction id of already settled transaction
  payPalCredit("2241762126");
}
?>


================================================
FILE: PayPalExpressCheckout/get-details.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalGetDetails($transactionId)
{

    echo "PayPal Get Details Transaction\n";
    
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    //create a transaction of type get details
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType( "getDetailsTransaction"); 
    
    //replace following transaction ID with your transaction ID for which the details are required
    $transactionRequestType->setRefTransId($transactionId);

    // Create the payment data for a paypal account
    $payPalType = new AnetAPI\PayPalType();
    $payPalType->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $payPalType->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setPayPal($payPalType);

    $transactionRequestType->setPayment($paymentOne);

    //create a transaction request
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);

    //execute the api call to get transaction details
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Transaction Response...\n";
          echo "Received response code: ".$tresponse->getResponseCode()."\n";
          echo "Transaction ID: ".$tresponse->getTransId()."\n";
          //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent
          if(null != $tresponse->getSecureAcceptance())
          {
            echo "Payer ID : " . $tresponse->getSecureAcceptance()->getPayerID() . "\n";
          }
          
          //parse the shipping information from response
          $shipping_response = $tresponse->getShipTo();
          if(null != $shipping_response)
          {
            echo "Shipping address : " . $shipping_response->getAddress() . ", " . $shipping_response->getCity()
              . ", " . $shipping_response->getState() . ", " . $shipping_response->getCountry() . "\n";
          }          

          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	        echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }

if(!defined('DONT_RUN_SAMPLES'))
  payPalGetDetails("60007107304");

?>

================================================
FILE: PayPalExpressCheckout/prior-authorization-capture.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalPriorAuthorizationCapture($transactionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $payPalType = new AnetAPI\PayPalType();
    $payPalType->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $payPalType->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");

    $paymentType = new AnetAPI\PaymentType();
    $paymentType->setPayPal($payPalType);

    $transactionRequest = new AnetAPI\TransactionRequestType();
    $transactionRequest->setTransactionType("priorAuthCaptureTransaction");
    $transactionRequest->setPayment($paymentType);
    $transactionRequest->setAmount(floatval(19.45));
    $transactionRequest->setRefTransId($transactionId);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest($transactionRequest);
    
    $controller = new AnetController\CreateTransactionController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Prior Authorization capture AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	        echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
  {
    payPalPriorAuthorizationCapture("2249863278");
  }
?>

================================================
FILE: PayPalExpressCheckout/void.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function payPalVoid($transactionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $payPalType = new AnetAPI\PayPalType();
    $payPalType->setSuccessUrl("");
    $payPalType->setCancelUrl("");

    $paymentType = new AnetAPI\PaymentType();
    $paymentType->setPayPal($payPalType);

    $transactionRequest = new AnetAPI\TransactionRequestType();
    $transactionRequest->setTransactionType("voidTransaction");
    $transactionRequest->setPayment($paymentType);
    $transactionRequest->setRefTransId($transactionId);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest($transactionRequest);
    
    $controller = new AnetController\CreateTransactionController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Void transaction SUCCESS TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	        echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    payPalVoid("2241706281");

  ?>

================================================
FILE: PaymentTransactions/authorize-credit-card.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function authorizeCreditCard($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");
    $creditCard->setCardCode("123");

    // Add the payment data to a paymentType object
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setCreditCard($creditCard);

    // Create order information
    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("10101");
    $order->setDescription("Golf Shirts");

    // Set the customer's Bill To address
    $customerAddress = new AnetAPI\CustomerAddressType();
    $customerAddress->setFirstName("Ellen");
    $customerAddress->setLastName("Johnson");
    $customerAddress->setCompany("Souveniropolis");
    $customerAddress->setAddress("14 Main Street");
    $customerAddress->setCity("Pecan Springs");
    $customerAddress->setState("TX");
    $customerAddress->setZip("44628");
    $customerAddress->setCountry("USA");

    // Set the customer's identifying information
    $customerData = new AnetAPI\CustomerDataType();
    $customerData->setType("individual");
    $customerData->setId("99999456654");
    $customerData->setEmail("EllenJohnson@example.com");

    // Add values for transaction settings
    $duplicateWindowSetting = new AnetAPI\SettingType();
    $duplicateWindowSetting->setSettingName("duplicateWindow");
    $duplicateWindowSetting->setSettingValue("60");

    // Add some merchant defined fields. These fields won't be stored with the transaction,
    // but will be echoed back in the response.
    $merchantDefinedField1 = new AnetAPI\UserFieldType();
    $merchantDefinedField1->setName("customerLoyaltyNum");
    $merchantDefinedField1->setValue("1128836273");

    $merchantDefinedField2 = new AnetAPI\UserFieldType();
    $merchantDefinedField2->setName("favoriteColor");
    $merchantDefinedField2->setValue("blue");

    // Create a TransactionRequestType object and add the previous objects to it
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authOnlyTransaction"); 
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setOrder($order);
    $transactionRequestType->setPayment($paymentOne);
    $transactionRequestType->setBillTo($customerAddress);
    $transactionRequestType->setCustomer($customerData);
    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);
    $transactionRequestType->addToUserFields($merchantDefinedField1);
    $transactionRequestType->addToUserFields($merchantDefinedField2);

    // Assemble the complete transaction request
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    // Create the controller and get the response
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);


    if ($response != null) {
        // Check to see if the API request was successfully received and acted upon
        if ($response->getMessages()->getResultCode() == "Ok") {
            // Since the API request was successful, look for a transaction response
            // and parse it to display the results of authorizing the card
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Successfully created transaction with Transaction ID: " . $tresponse->getTransId() . "\n";
                echo " Transaction Response Code: " . $tresponse->getResponseCode() . "\n";
                echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Auth Code: " . $tresponse->getAuthCode() . "\n";
                echo " Description: " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
            // Or, print errors if the API request wasn't successful
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error Code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error Message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }      
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    authorizeCreditCard("2.23");
}
?>

================================================
FILE: PaymentTransactions/capture-funds-authorized-through-another-channel.php
================================================
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE", "phplog");

function captureFundsAuthorizedThroughAnotherChannel($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");

    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setCreditCard($creditCard);

    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("captureOnlyTransaction");
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setPayment($paymentOne);

    //Auth code of the previously authorized  amount
    $transactionRequestType->setAuthCode("ROHNFQ");

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Successful." . "\n";
          echo "Capture funds authorized through another channel TRANS ID  : " . $tresponse->getTransId() . " Amount : $amount \n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
}
if(!defined('DONT_RUN_SAMPLES'))
    captureFundsAuthorizedThroughAnotherChannel((rand(1, 999)/12*12));
?>


================================================
FILE: PaymentTransactions/capture-previously-authorized-amount.php
================================================
<?php
 require 'vendor/autoload.php';
 require_once 'constants/SampleCodeConstants.php';
 use net\authorize\api\contract\v1 as AnetAPI;
 use net\authorize\api\controller as AnetController;

 define("AUTHORIZENET_LOG_FILE", "phplog");

 function capturePreviouslyAuthorizedAmount($transactionid)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Now capture the previously authorized  amount
    echo "Capturing the Authorization with transaction ID : " . $transactionid . "\n";
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("priorAuthCaptureTransaction");
    $transactionRequestType->setRefTransId($transactionid);

    
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setTransactionRequest( $transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
            echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
            echo "Successful." . "\n";
            echo "Capture Previously Authorized Amount, Trans ID : " . $tresponse->getRefTransId() . "\n";
            echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }
 if(!defined('DONT_RUN_SAMPLES'))
    capturePreviouslyAuthorizedAmount(60007076002);
?>


================================================
FILE: PaymentTransactions/charge-credit-card.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function chargeCreditCard($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");
    $creditCard->setCardCode("123");

    // Add the payment data to a paymentType object
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setCreditCard($creditCard);

    // Create order information
    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("10101");
    $order->setDescription("Golf Shirts");

    // Set the customer's Bill To address
    $customerAddress = new AnetAPI\CustomerAddressType();
    $customerAddress->setFirstName("Ellen");
    $customerAddress->setLastName("Johnson");
    $customerAddress->setCompany("Souveniropolis");
    $customerAddress->setAddress("14 Main Street");
    $customerAddress->setCity("Pecan Springs");
    $customerAddress->setState("TX");
    $customerAddress->setZip("44628");
    $customerAddress->setCountry("USA");

    // Set the customer's identifying information
    $customerData = new AnetAPI\CustomerDataType();
    $customerData->setType("individual");
    $customerData->setId("99999456654");
    $customerData->setEmail("EllenJohnson@example.com");

    // Add values for transaction settings
    $duplicateWindowSetting = new AnetAPI\SettingType();
    $duplicateWindowSetting->setSettingName("duplicateWindow");
    $duplicateWindowSetting->setSettingValue("60");

    // Add some merchant defined fields. These fields won't be stored with the transaction,
    // but will be echoed back in the response.
    $merchantDefinedField1 = new AnetAPI\UserFieldType();
    $merchantDefinedField1->setName("customerLoyaltyNum");
    $merchantDefinedField1->setValue("1128836273");

    $merchantDefinedField2 = new AnetAPI\UserFieldType();
    $merchantDefinedField2->setName("favoriteColor");
    $merchantDefinedField2->setValue("blue");

    // Create a TransactionRequestType object and add the previous objects to it
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction");
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setOrder($order);
    $transactionRequestType->setPayment($paymentOne);
    $transactionRequestType->setBillTo($customerAddress);
    $transactionRequestType->setCustomer($customerData);
    $transactionRequestType->addToTransactionSettings($duplicateWindowSetting);
    $transactionRequestType->addToUserFields($merchantDefinedField1);
    $transactionRequestType->addToUserFields($merchantDefinedField2);

    // Assemble the complete transaction request
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    // Create the controller and get the response
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
    

    if ($response != null) {
        // Check to see if the API request was successfully received and acted upon
        if ($response->getMessages()->getResultCode() == "Ok") {
            // Since the API request was successful, look for a transaction response
            // and parse it to display the results of authorizing the card
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Successfully created transaction with Transaction ID: " . $tresponse->getTransId() . "\n";
                echo " Transaction Response Code: " . $tresponse->getResponseCode() . "\n";
                echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Auth Code: " . $tresponse->getAuthCode() . "\n";
                echo " Description: " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
            // Or, print errors if the API request wasn't successful
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error Code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error Message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error Code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error Message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    chargeCreditCard("2.23");
}


================================================
FILE: PaymentTransactions/charge-customer-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function chargeCustomerProfile($profileid, $paymentprofileid, $amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $profileToCharge = new AnetAPI\CustomerProfilePaymentType();
    $profileToCharge->setCustomerProfileId($profileid);
    $paymentProfile = new AnetAPI\PaymentProfileType();
    $paymentProfile->setPaymentProfileId($paymentprofileid);
    $profileToCharge->setPaymentProfile($paymentProfile);

    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType( "authCaptureTransaction"); 
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setProfile($profileToCharge);

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

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo  "Charge Customer Profile APPROVED  :" . "\n";
          echo " Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo " Charge Customer Profile TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	        echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    chargeCustomerProfile("36731856","32689274",12.23);
?>


================================================
FILE: PaymentTransactions/charge-tokenized-credit-card.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function chargeTokenizedCreditCard($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");
    // Set the token specific info
    $creditCard->setIsPaymentToken(true);
    $creditCard->setCryptogram("EjRWeJASNFZ4kBI0VniQEjRWeJA=");
    
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setCreditCard($creditCard);
    
    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction"); 
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setPayment($paymentOne);


    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
        if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Charge Tokenized Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo "Charge Tokenized Credit Card TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
    chargeTokenizedCreditCard(12.23);
?>


================================================
FILE: PaymentTransactions/create-chase-pay-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function createChasePayTransaction($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");
    $creditCard->setCardCode("999");
    // Set the token specific info
    $creditCard->setIsPaymentToken(true);
    $creditCard->setCryptogram("EjRWeJASNFZ4kBI0VniQEjRWeJA=");
    $creditCard->setTokenRequestorName("CHASE_PAY");
    $creditCard->setTokenRequestorId("12345678901");
    $creditCard->setTokenRequestorEci("07");
    
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setCreditCard($creditCard);
    
    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction"); 
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setPayment($paymentOne);


    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId( $refId);
    $request->setTransactionRequest( $transactionRequestType);
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
        if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Charge Tokenized Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
          echo "Charge Tokenized Credit Card TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
          echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
          echo  "No response returned \n";
    }

    return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
  createChasePayTransaction(12.23);
?>


================================================
FILE: PaymentTransactions/credit-bank-account.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function creditBankAccount($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    //Generate random bank account number
    $randomAccountNumber= rand(100000000,9999999999);

    // Create the payment data for a Bank Account
    $bankAccount = new AnetAPI\BankAccountType();
    $bankAccount->setAccountType('checking');
    // see eCheck documentation for proper echeck type to use for each situation
    //$bankAccount->setEcheckType('WEB');
    $bankAccount->setRoutingNumber('122000661'); //('122235821'); //('125008547');
    $bankAccount->setAccountNumber($randomAccountNumber);
    $bankAccount->setNameOnAccount('John Doe');
    $bankAccount->setBankName('Wells Fargo Bank NA');
    
    $paymentBank= new AnetAPI\PaymentType();
    $paymentBank->setBankAccount($bankAccount);

    // Order info
    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("101");
    $order->setDescription("Golf Shirts");

      //create a bank credit transaction
    
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("refundTransaction");
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setPayment($paymentBank);
    $transactionRequestType->setOrder($order);
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null) {
        if ($response->getMessages()->getResultCode() == "Ok") {
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
                echo  "Credit Bank Account APPROVED  :" . "\n";
                echo  "Credit Bank Account AUTH CODE : " . $tresponse->getAuthCode() . "\n";
                echo  "Credit Bank Account TRANS ID  : " . $tresponse->getTransId() . "\n";
                echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    creditBankAccount(5.29);
}



================================================
FILE: PaymentTransactions/debit-bank-account.php
================================================
 <?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function debitBankAccount($amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    //Generate random bank account number
    $randomAccountNumber= rand(100000000,9999999999);

    // Create the payment data for a Bank Account
    $bankAccount = new AnetAPI\BankAccountType();
    $bankAccount->setAccountType('checking');
    // see eCheck documentation for proper echeck type to use for each situation
    $bankAccount->setEcheckType('WEB');
    $bankAccount->setRoutingNumber('122000661');

    $bankAccount->setAccountNumber(rand(10000,999999999999));

    $bankAccount->setNameOnAccount('John Doe');
    $bankAccount->setBankName('Wells Fargo Bank NA');

    $paymentBank= new AnetAPI\PaymentType();
    $paymentBank->setBankAccount($bankAccount);

    // Order info
    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("101");
    $order->setDescription("Golf Shirts");

    //create a bank debit transaction
    
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authCaptureTransaction");
    $transactionRequestType->setAmount($amount);
    $transactionRequestType->setPayment($paymentBank);
    $transactionRequestType->setOrder($order);
    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null) {
        if ($response->getMessages()->getResultCode() == "Ok") {
            $tresponse = $response->getTransactionResponse();
        
            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
                echo " Debit Bank Account APPROVED  :" . "\n";
                echo " Debit Bank Account AUTH CODE : " . $tresponse->getAuthCode() . "\n";
                echo " Debit Bank Account TRANS ID  : " . $tresponse->getTransId() . "\n";
                echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n";
                echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }
    } else {
        echo  "No response returned \n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    debitBankAccount(5.29);
}


================================================
FILE: PaymentTransactions/refund-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function refundTransaction($refTransId, $amount)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Create the payment data for a credit card
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("0015");
    $creditCard->setExpirationDate("XXXX");
    $paymentOne = new AnetAPI\PaymentType();
    $paymentOne->setCreditCard($creditCard);
    //create a transaction
    $transactionRequest = new AnetAPI\TransactionRequestType();
    $transactionRequest->setTransactionType( "refundTransaction"); 
    $transactionRequest->setAmount($amount);
    $transactionRequest->setPayment($paymentOne);
    $transactionRequest->setRefTransId($refTransId);
 

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

    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo "Refund SUCCESS: " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	        echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
    refundTransaction( "2.23");
?>


================================================
FILE: PaymentTransactions/update-split-tender-group.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");

function updateSplitTenderGroup()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $request = new AnetAPI\UpdateSplitTenderGroupRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setRefId($refId);
    $request->setSplitTenderId("115901");
    $request->setSplitTenderStatus("voided");

    $controller = new AnetController\UpdateSplitTenderGroupController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    { 
        $errorMessages = $response->getMessages()->getMessage();
        echo "SUCCESS  Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }
    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    updateSplitTenderGroup();
  ?>


================================================
FILE: PaymentTransactions/void-transaction.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function voidTransaction($transactionid)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType( "voidTransaction"); 
    $transactionRequestType->setRefTransId($transactionid);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
	  $request->setRefId($refId);
    $request->setTransactionRequest( $transactionRequestType);
    $controller = new AnetController\CreateTransactionController($request);
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if ($response != null)
    {
      if($response->getMessages()->getResultCode() == "Ok")
      {
        $tresponse = $response->getTransactionResponse();
        
	      if ($tresponse != null && $tresponse->getMessages() != null)   
        {
          echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
          echo " Void transaction SUCCESS AUTH CODE: " . $tresponse->getAuthCode() . "\n";
          echo " Void transaction SUCCESS TRANS ID  : " . $tresponse->getTransId() . "\n";
          echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; 
	        echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
        }
        else
        {
          echo "Transaction Failed \n";
          if($tresponse->getErrors() != null)
          {
            echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
            echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";            
          }
        }
      }
      else
      {
        echo "Transaction Failed \n";
        $tresponse = $response->getTransactionResponse();
        if($tresponse != null && $tresponse->getErrors() != null)
        {
          echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
          echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";                      
        }
        else
        {
          echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
          echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
        }
      }      
    }
    else
    {
      echo  "No response returned \n";
    }

    return $response;
  }
  if(!defined('DONT_RUN_SAMPLES'))
    voidTransaction("60009605785");
?>


================================================
FILE: README.md
================================================
# PHP Sample Code for the Authorize.Net SDK
[![Travis CI Status](https://travis-ci.org/AuthorizeNet/sample-code-php.svg?branch=master)](https://travis-ci.org/AuthorizeNet/sample-code-php)

This repository contains working code samples which demonstrate PHP integration with the [Authorize.Net PHP SDK](https://github.com/AuthorizeNet/sdk-php).

The 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.


## Using the Sample Code

The 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.

You can also run each sample directly from the command line.

## Running the Samples From the Command Line
* Clone this repository:
```
    $ git clone https://github.com/AuthorizeNet/sample-code-php.git
```
* Run composer with the "update" option in the root directory of the repository.
```
    $ composer update
```
* Run the individual samples by name. For example:
```
    $ php PaymentTransactions/[CodeSampleName]
```
e.g.
```
    $ php PaymentTransactions/authorize-credit-card.php
```

### Installation Notes
Note: 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:
```
extension=php_openssl.dll
extension=php_curl.dll
```
On Windows systems, you also have to uncomment:
```
extension_dir = "ext"
```
Then run `composer update` again. You might have to restart your machine before the changes take effect.

### What if I'm not using Composer?
We provide a custom `SPL` autoloader. Just [download the SDK](https://github.com/AuthorizeNet/sdk-php/releases) and point to its `autoload.php` file:

```php
require 'path/to/anet_php_sdk/autoload.php';
```


================================================
FILE: RecurringBilling/cancel-subscription.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function cancelSubscription($subscriptionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $request = new AnetAPI\ARBCancelSubscriptionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSubscriptionId($subscriptionId);

    $controller = new AnetController\ARBCancelSubscriptionController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
    {
        $successMessages = $response->getMessages()->getMessage();
        echo "SUCCESS : " . $successMessages[0]->getCode() . "  " .$successMessages[0]->getText() . "\n";
        
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
        
    }

    return $response;

  }

  if(!defined('DONT_RUN_SAMPLES'))
    cancelSubscription("7087965");

?>


================================================
FILE: RecurringBilling/create-subscription-from-customer-profile.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  date_default_timezone_set('America/Los_Angeles');
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function createSubscriptionFromCustomerProfile($intervalLength, $customerProfileId,
    $customerPaymentProfileId, $customerAddressId
) {
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Subscription Type Info
    $subscription = new AnetAPI\ARBSubscriptionType();
    $subscription->setName("Sample Subscription");

    $interval = new AnetAPI\PaymentScheduleType\IntervalAType();
    $interval->setLength($intervalLength);
    $interval->setUnit("days");

    $paymentSchedule = new AnetAPI\PaymentScheduleType();
    $paymentSchedule->setInterval($interval);
    $paymentSchedule->setStartDate(new DateTime('2035-08-30'));
    $paymentSchedule->setTotalOccurrences("12");
    $paymentSchedule->setTrialOccurrences("1");

    $subscription->setPaymentSchedule($paymentSchedule);
    $subscription->setAmount(rand(1,99999)/12.0*12);
    $subscription->setTrialAmount("0.00");
    
    $profile = new AnetAPI\CustomerProfileIdType();
    $profile->setCustomerProfileId($customerProfileId);
    $profile->setCustomerPaymentProfileId($customerPaymentProfileId);
    $profile->setCustomerAddressId($customerAddressId);

    $subscription->setProfile($profile);

    $request = new AnetAPI\ARBCreateSubscriptionRequest();
    $request->setmerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSubscription($subscription);
    $controller = new AnetController\ARBCreateSubscriptionController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    {
        echo "SUCCESS: Subscription ID : " . $response->getSubscriptionId() . "\n";
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    createSubscriptionFromCustomerProfile( \SampleCode\Constants::SUBSCRIPTION_INTERVAL_DAYS, "247150", "215472", "189691");

?>


================================================
FILE: RecurringBilling/create-subscription.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  date_default_timezone_set('America/Los_Angeles');
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function createSubscription($intervalLength)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    // Subscription Type Info
    $subscription = new AnetAPI\ARBSubscriptionType();
    $subscription->setName("Sample Subscription");

    $interval = new AnetAPI\PaymentScheduleType\IntervalAType();
    $interval->setLength($intervalLength);
    $interval->setUnit("days");

    $paymentSchedule = new AnetAPI\PaymentScheduleType();
    $paymentSchedule->setInterval($interval);
    $paymentSchedule->setStartDate(new DateTime('2035-12-30'));
    $paymentSchedule->setTotalOccurrences("12");
    $paymentSchedule->setTrialOccurrences("1");

    $subscription->setPaymentSchedule($paymentSchedule);
    $subscription->setAmount(rand(1,99999)/12.0*12);
    $subscription->setTrialAmount("0.00");
    
    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");

    $payment = new AnetAPI\PaymentType();
    $payment->setCreditCard($creditCard);
    $subscription->setPayment($payment);

    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("1234354");        
    $order->setDescription("Description of the subscription"); 
    $subscription->setOrder($order); 
    
    $billTo = new AnetAPI\NameAndAddressType();
    $billTo->setFirstName("John");
    $billTo->setLastName("Smith");

    $subscription->setBillTo($billTo);

    $request = new AnetAPI\ARBCreateSubscriptionRequest();
    $request->setmerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSubscription($subscription);
    $controller = new AnetController\ARBCreateSubscriptionController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    {
        echo "SUCCESS: Subscription ID : " . $response->getSubscriptionId() . "\n";
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    createSubscription(23);

?>


================================================
FILE: RecurringBilling/get-list-of-subscriptions.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function getListOfSubscriptions()
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $sorting = new AnetAPI\ARBGetSubscriptionListSortingType();
    $sorting->setOrderBy("id");
    $sorting->setOrderDescending(false);

    $paging = new AnetAPI\PagingType();
    $paging->setLimit("10");
    $paging->setOffset("1");

    $request = new AnetAPI\ARBGetSubscriptionListRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSearchType("subscriptionInactive");
    $request->setSorting($sorting);
    $request->setPaging($paging);


    $controller = new AnetController\ARBGetSubscriptionListController($request);

    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
        echo "SUCCESS: Subscription Details:" . "\n";
        echo "Total Number In Results:" . $response->getTotalNumInResultSet() . "\n";
        if ($response->getTotalNumInResultSet() > 0) {
            foreach ($response->getSubscriptionDetails() as $subscriptionDetails) {
                echo "Subscription ID: " . $subscriptionDetails->getId() . "\n";
            }
        }
    } else {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }

    return $response;
}

if (!defined('DONT_RUN_SAMPLES')) {
    getListOfSubscriptions();
}


================================================
FILE: RecurringBilling/get-subscription-status.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function getSubscriptionStatus($subscriptionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $request = new AnetAPI\ARBGetSubscriptionStatusRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSubscriptionId($subscriptionId);

    $controller = new AnetController\ARBGetSubscriptionStatusController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
    {
        echo "SUCCESS: Subscription Status : " . $response->getStatus() . "\n";
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
    getSubscriptionStatus("3056948");

?>


================================================
FILE: RecurringBilling/get-subscription.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

  function getSubscription($subscriptionId)
  {
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();
		
    // Creating the API Request with required parameters
    $request = new AnetAPI\ARBGetSubscriptionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSubscriptionId($subscriptionId);
    $request->setIncludeTransactions(true);
	    
    // Controller
    $controller = new AnetController\ARBGetSubscriptionController($request);
		
    // Getting the response
    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
		
    if ($response != null) 
    {
        if($response->getMessages()->getResultCode() == "Ok")
        {
        	// Success
        	echo "SUCCESS: GetSubscription:" . "\n";
        	// Displaying the details
        	echo "Subscription Name: " . $response->getSubscription()->getName(). "\n";
        	echo "Subscription amount: " . $response->getSubscription()->getAmount(). "\n";
        	echo "Subscription status: " . $response->getSubscription()->getStatus(). "\n";
        	echo "Subscription Description: " . $response->getSubscription()->getProfile()->getDescription(). "\n";
        	echo "Customer Profile ID: " .  $response->getSubscription()->getProfile()->getCustomerProfileId() . "\n";
        	echo "Customer payment Profile ID: ". $response->getSubscription()->getProfile()->getPaymentProfile()->getCustomerPaymentProfileId() . "\n";
                $transactions = $response->getSubscription()->getArbTransactions();
                if($transactions != null){
			foreach ($transactions as $transaction) {
                    		echo "Transaction ID : ".$transaction->getTransId()." -- ".$transaction->getResponse()." -- Pay Number : ".$transaction->getPayNum()."\n";
                	}
		}
        }
        else
        {
        	// Error
        	echo "ERROR :  Invalid response\n";	
        	$errorMessages = $response->getMessages()->getMessage();
          echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
        }
	  }
    else
    {
        // Failed to get response
        echo "Null Response Error";
    }

    return $response;
	}

	if(!defined('DONT_RUN_SAMPLES'))
		getSubscription("2942461");
 ?>


================================================
FILE: RecurringBilling/update-subscription.php
================================================
<?php
  require 'vendor/autoload.php';
  require_once 'constants/SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function updateSubscription($subscriptionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $subscription = new AnetAPI\ARBSubscriptionType();

    $creditCard = new AnetAPI\CreditCardType();
    $creditCard->setCardNumber("4111111111111111");
    $creditCard->setExpirationDate("2038-12");

    $payment = new AnetAPI\PaymentType();
    $payment->setCreditCard($creditCard);

    //set profile information
    $profile = new AnetAPI\CustomerProfileIdType();
    $profile->setCustomerProfileId("121212");
    $profile->setCustomerPaymentProfileId("131313");
    $profile->setCustomerAddressId("141414");

    $subscription->setPayment($payment);

    //set customer profile information
    //$subscription->setProfile($profile);
    
    $request = new AnetAPI\ARBUpdateSubscriptionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setSubscriptionId($subscriptionId);
    $request->setSubscription($subscription);

    $controller = new AnetController\ARBUpdateSubscriptionController($request);

    $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
    
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
    {
        $errorMessages = $response->getMessages()->getMessage();
        echo "SUCCESS Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
        
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response->getMessages()->getMessage();
        echo "Response : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
      updateSubscription("3056948");
?>


================================================
FILE: SampleCodeList.txt
================================================
SampleCodeName,IsDependent,ShouldRun
ChargeCreditCard,1,1
CreateSubscription,1,1
CreateSubscriptionFromCustomerProfile,1,1
GetCustomerPaymentProfileList,0,1
GetTransactionList,0,1
CreateAnApplePayTransaction,0,0
CreateAnAcceptTransaction,0,0
CreateAnAndroidPayTransaction,0,0
decryptVisaSrcData,0,0
createVisaSrcTransaction,0,0
CaptureFundsAuthorizedThroughAnotherChannel,1,1
AuthorizeCreditCard,1,1
DebitBankAccount,1,1
ChargeTokenizedCreditCard,0,0
PayPalAuthorizeOnly,1,1
GetListOfSubscriptions,0,1
GetUnsettledTransactionList,0,1
GetBatchStatistics,1,1
GetSettledBatchList,1,1
UpdateSplitTenderGroup,0,1
UpdateCustomerShippingAddress,1,1
UpdateCustomerProfile,0,1
UpdateCustomerPaymentProfile,1,1
GetCustomerShippingAddress,1,1
GetCustomerProfileIds,0,0
GetCustomerProfile,1,1
GetAcceptCustomerProfilePage,1,1
GetCustomerPaymentProfile,1,1
DeleteCustomerShippingAddress,1,1
DeleteCustomerProfile,1,1
DeleteCustomerPaymentProfile,1,1
CreateCustomerShippingAddress,1,1
CreateCustomerProfileFromTransaction,0,0
GetTransactionDetails,1,1
CapturePreviouslyAuthorizedgetAmount,1,0
RefundTransaction,1,0
VoidTransaction,1,1
CreditBankAccount,1,0
ChargeCustomerProfile,1,1
PayPalVoid,1,0
PayPalAuthorizeCapture,1,1
PayPalAuthorizeCaptureContinued,1,1
PayPalAuthorizeOnlyContinued,1,0
PayPalCredit,1,0
PayPalGetDetails,1,1
PayPalPriorAuthorizationCapture,1,0
CancelSubscription,1,1
GetSubscriptionStatus,1,1
GetSubscription,1,1
UpdateSubscription,1,1
CreateCustomerProfile,1,1
CreateCustomerPaymentProfile,1,1
ValidateCustomerPaymentProfile,1,0
GetMerchantDetails,0,1
UpdateHeldTransaction,1,0
GetAnAcceptPaymentPage,0,1
CreateAnAcceptPaymentTransaction,0,0


================================================
FILE: Sha512/compute_trans_hashSHA2.php
================================================
<?php

$apiLogin="2Kfn5S7x7D";
$transId="60115585081";
$amount='12.00';
$signatureKey='56E529FE6C63D60E545F84686096E6AA01D5E18A119F18A130F7CFB3983104216979E95D84C91BDD382AA0875264A63940A2D0AA5548F6023B4C78A9D52C18DA';
$textToHash="^". $apiLogin."^". $transId ."^". $amount."^";

function generateSH512($textToHash, $signatureKey)
{
    if ($textToHash != null && $signatureKey != null) {
                    $sig = hash_hmac('sha512', $textToHash, hex2bin($signatureKey));
                    echo " Computed SHA512 Hash: " . strtoupper($sig) . "\n";
                } else {
                    echo "Either Signature key or the text to hash is empty \n";
                }
}

generateSH512($textToHash, $signatureKey);
?>


================================================
FILE: TestRunner.php
==================
Download .txt
gitextract_p37jv6o6/

├── .gitignore
├── .travis.yml
├── AcceptSuite/
│   ├── create-an-accept-payment-transaction.php
│   ├── get-accept-customer-profile-page.php
│   └── get-an-accept-payment-page.php
├── CustomerProfiles/
│   ├── create-customer-payment-profile.php
│   ├── create-customer-profile-from-transaction.php
│   ├── create-customer-profile-with-accept-nonce.php
│   ├── create-customer-profile.php
│   ├── create-customer-shipping-address.php
│   ├── delete-customer-payment-profile.php
│   ├── delete-customer-profile.php
│   ├── delete-customer-shipping-address.php
│   ├── get-customer-payment-profile-list.php
│   ├── get-customer-payment-profile.php
│   ├── get-customer-profile-ids.php
│   ├── get-customer-profile.php
│   ├── get-customer-shipping-address.php
│   ├── update-customer-payment-profile.php
│   ├── update-customer-profile.php
│   ├── update-customer-shipping-address.php
│   └── validate-customer-payment-profile.php
├── FraudManagement/
│   ├── approve-or-decline-held-transaction.php
│   └── get-held-transaction-list.php
├── LICENSE
├── MobileInAppTransactions/
│   ├── create-an-accept-transaction.php
│   ├── create-an-android-pay-transaction.php
│   ├── create-an-apple-pay-transaction.php
│   └── create-google-pay-transaction.php
├── PayPalExpressCheckout/
│   ├── authorization-and-capture-continued.php
│   ├── authorization-and-capture.php
│   ├── authorization-only-continued.php
│   ├── authorization-only.php
│   ├── credit.php
│   ├── get-details.php
│   ├── prior-authorization-capture.php
│   └── void.php
├── PaymentTransactions/
│   ├── authorize-credit-card.php
│   ├── capture-funds-authorized-through-another-channel.php
│   ├── capture-previously-authorized-amount.php
│   ├── charge-credit-card.php
│   ├── charge-customer-profile.php
│   ├── charge-tokenized-credit-card.php
│   ├── create-chase-pay-transaction.php
│   ├── credit-bank-account.php
│   ├── debit-bank-account.php
│   ├── refund-transaction.php
│   ├── update-split-tender-group.php
│   └── void-transaction.php
├── README.md
├── RecurringBilling/
│   ├── cancel-subscription.php
│   ├── create-subscription-from-customer-profile.php
│   ├── create-subscription.php
│   ├── get-list-of-subscriptions.php
│   ├── get-subscription-status.php
│   ├── get-subscription.php
│   └── update-subscription.php
├── SampleCodeList.txt
├── Sha512/
│   └── compute_trans_hashSHA2.php
├── TestRunner.php
├── TransactionReporting/
│   ├── get-account-updater-job-details.php
│   ├── get-account-updater-job-summary.php
│   ├── get-batch-statistics.php
│   ├── get-customer-profile-transaction-list.php
│   ├── get-merchant-details.php
│   ├── get-settled-batch-list.php
│   ├── get-transaction-details.php
│   ├── get-transaction-list.php
│   └── get-unsettled-transaction-list.php
├── VisaCheckout/
│   ├── create-visa-src-transaction.php
│   └── decrypt-visa-src-data.php
├── composer.json
├── composer.json.sdk-dev
├── constants/
│   └── SampleCodeConstants.php
└── phpunit.xml.dist
Download .txt
SYMBOL INDEX (114 symbols across 67 files)

FILE: AcceptSuite/create-an-accept-payment-transaction.php
  function createAnAcceptPaymentTransaction (line 9) | function createAnAcceptPaymentTransaction($amount)

FILE: AcceptSuite/get-accept-customer-profile-page.php
  function getAcceptCustomerProfilePage (line 9) | function getAcceptCustomerProfilePage($customerprofileid = "123212")

FILE: AcceptSuite/get-an-accept-payment-page.php
  function getAnAcceptPaymentPage (line 9) | function getAnAcceptPaymentPage()

FILE: CustomerProfiles/create-customer-payment-profile.php
  function createCustomerPaymentProfile (line 9) | function createCustomerPaymentProfile($existingcustomerprofileid, $phone...

FILE: CustomerProfiles/create-customer-profile-from-transaction.php
  function createCustomerProfileFromTransaction (line 9) | function createCustomerProfileFromTransaction($transId= "2249066517")

FILE: CustomerProfiles/create-customer-profile-with-accept-nonce.php
  function createCustomerProfileWithAcceptNonce (line 9) | function createCustomerProfileWithAcceptNonce($email)

FILE: CustomerProfiles/create-customer-profile.php
  function createCustomerProfile (line 9) | function createCustomerProfile($email)

FILE: CustomerProfiles/create-customer-shipping-address.php
  function createCustomerShippingAddress (line 9) | function createCustomerShippingAddress($existingcustomerprofileid = "192...

FILE: CustomerProfiles/delete-customer-payment-profile.php
  function deleteCustomerPaymentProfile (line 9) | function deleteCustomerPaymentProfile($customerProfileId= "1929905607",

FILE: CustomerProfiles/delete-customer-profile.php
  function deleteCustomerProfile (line 9) | function deleteCustomerProfile($customerProfileId)

FILE: CustomerProfiles/delete-customer-shipping-address.php
  function deleteCustomerShippingAddress (line 9) | function deleteCustomerShippingAddress($customerprofileid = "1929905607"...

FILE: CustomerProfiles/get-customer-payment-profile-list.php
  function getCustomerPaymentProfileList (line 10) | function getCustomerPaymentProfileList()

FILE: CustomerProfiles/get-customer-payment-profile.php
  function getCustomerPaymentProfile (line 10) | function getCustomerPaymentProfile($customerProfileId="1929905607",

FILE: CustomerProfiles/get-customer-profile-ids.php
  function getCustomerProfileIds (line 9) | function getCustomerProfileIds()

FILE: CustomerProfiles/get-customer-profile.php
  function getCustomerProfile (line 9) | function getCustomerProfile()

FILE: CustomerProfiles/get-customer-shipping-address.php
  function getCustomerShippingAddress (line 9) | function getCustomerShippingAddress($customerprofileid, $customeraddressid)

FILE: CustomerProfiles/update-customer-payment-profile.php
  function updateCustomerPaymentProfile (line 9) | function updateCustomerPaymentProfile($customerProfileId = "1916322670",

FILE: CustomerProfiles/update-customer-profile.php
  function updateCustomerProfile (line 9) | function updateCustomerProfile()

FILE: CustomerProfiles/update-customer-shipping-address.php
  function updateCustomerShippingAddress (line 9) | function updateCustomerShippingAddress($customerprofileid, $customeraddr...

FILE: CustomerProfiles/validate-customer-payment-profile.php
  function validateCustomerPaymentProfile (line 9) | function validateCustomerPaymentProfile($customerProfileId= "1929905607",

FILE: FraudManagement/approve-or-decline-held-transaction.php
  function approveOrDeclineHeldTransaction (line 9) | function approveOrDeclineHeldTransaction()

FILE: FraudManagement/get-held-transaction-list.php
  function getHeldTransactionList (line 9) | function getHeldTransactionList()

FILE: MobileInAppTransactions/create-an-accept-transaction.php
  function createAnAcceptTransaction (line 9) | function createAnAcceptTransaction($amount)

FILE: MobileInAppTransactions/create-an-android-pay-transaction.php
  function createAnAndroidPayTransaction (line 9) | function createAnAndroidPayTransaction()

FILE: MobileInAppTransactions/create-an-apple-pay-transaction.php
  function createAnApplePayTransaction (line 9) | function createAnApplePayTransaction()

FILE: MobileInAppTransactions/create-google-pay-transaction.php
  function createGooglePayTransaction (line 9) | function createGooglePayTransaction()

FILE: PayPalExpressCheckout/authorization-and-capture-continued.php
  function payPalAuthorizeCaptureContinued (line 9) | function payPalAuthorizeCaptureContinued($refTransId, $payerID)

FILE: PayPalExpressCheckout/authorization-and-capture.php
  function payPalAuthorizeCapture (line 9) | function payPalAuthorizeCapture($amount)

FILE: PayPalExpressCheckout/authorization-only-continued.php
  function payPalAuthorizeOnlyContinued (line 9) | function payPalAuthorizeOnlyContinued($transactionId, $payerId)

FILE: PayPalExpressCheckout/authorization-only.php
  function payPalAuthorizeOnly (line 9) | function payPalAuthorizeOnly($amount)

FILE: PayPalExpressCheckout/credit.php
  function payPalCredit (line 9) | function payPalCredit($transactionId)

FILE: PayPalExpressCheckout/get-details.php
  function payPalGetDetails (line 9) | function payPalGetDetails($transactionId)

FILE: PayPalExpressCheckout/prior-authorization-capture.php
  function payPalPriorAuthorizationCapture (line 9) | function payPalPriorAuthorizationCapture($transactionId)

FILE: PayPalExpressCheckout/void.php
  function payPalVoid (line 9) | function payPalVoid($transactionId)

FILE: PaymentTransactions/authorize-credit-card.php
  function authorizeCreditCard (line 9) | function authorizeCreditCard($amount)

FILE: PaymentTransactions/capture-funds-authorized-through-another-channel.php
  function captureFundsAuthorizedThroughAnotherChannel (line 9) | function captureFundsAuthorizedThroughAnotherChannel($amount)

FILE: PaymentTransactions/capture-previously-authorized-amount.php
  function capturePreviouslyAuthorizedAmount (line 9) | function capturePreviouslyAuthorizedAmount($transactionid)

FILE: PaymentTransactions/charge-credit-card.php
  function chargeCreditCard (line 9) | function chargeCreditCard($amount)

FILE: PaymentTransactions/charge-customer-profile.php
  function chargeCustomerProfile (line 9) | function chargeCustomerProfile($profileid, $paymentprofileid, $amount)

FILE: PaymentTransactions/charge-tokenized-credit-card.php
  function chargeTokenizedCreditCard (line 9) | function chargeTokenizedCreditCard($amount)

FILE: PaymentTransactions/create-chase-pay-transaction.php
  function createChasePayTransaction (line 9) | function createChasePayTransaction($amount)

FILE: PaymentTransactions/credit-bank-account.php
  function creditBankAccount (line 9) | function creditBankAccount($amount)

FILE: PaymentTransactions/debit-bank-account.php
  function debitBankAccount (line 9) | function debitBankAccount($amount)

FILE: PaymentTransactions/refund-transaction.php
  function refundTransaction (line 9) | function refundTransaction($refTransId, $amount)

FILE: PaymentTransactions/update-split-tender-group.php
  function updateSplitTenderGroup (line 9) | function updateSplitTenderGroup()

FILE: PaymentTransactions/void-transaction.php
  function voidTransaction (line 9) | function voidTransaction($transactionid)

FILE: RecurringBilling/cancel-subscription.php
  function cancelSubscription (line 9) | function cancelSubscription($subscriptionId)

FILE: RecurringBilling/create-subscription-from-customer-profile.php
  function createSubscriptionFromCustomerProfile (line 10) | function createSubscriptionFromCustomerProfile($intervalLength, $custome...

FILE: RecurringBilling/create-subscription.php
  function createSubscription (line 10) | function createSubscription($intervalLength)

FILE: RecurringBilling/get-list-of-subscriptions.php
  function getListOfSubscriptions (line 9) | function getListOfSubscriptions()

FILE: RecurringBilling/get-subscription-status.php
  function getSubscriptionStatus (line 9) | function getSubscriptionStatus($subscriptionId)

FILE: RecurringBilling/get-subscription.php
  function getSubscription (line 9) | function getSubscription($subscriptionId)

FILE: RecurringBilling/update-subscription.php
  function updateSubscription (line 9) | function updateSubscription($subscriptionId)

FILE: Sha512/compute_trans_hashSHA2.php
  function generateSH512 (line 9) | function generateSH512($textToHash, $signatureKey)

FILE: TestRunner.php
  class TestRunner (line 37) | class TestRunner extends PHPUnit\Framework\TestCase
    method getAmount (line 44) | public static function getAmount()
    method getEmail (line 49) | public static function getEmail()
    method getPhoneNumber (line 54) | public static function getPhoneNumber()
    method getDay (line 58) | public static function getDay()
    method testAllSampleCodes (line 62) | public function testAllSampleCodes()
    method toPhoneNumber (line 115) | private static function toPhoneNumber($num)
    method runAuthorizeCreditCard (line 121) | public static function runAuthorizeCreditCard()
    method runCaptureFundsAuthorizedThroughAnotherChannel (line 126) | public static function runCaptureFundsAuthorizedThroughAnotherChannel()
    method runDebitBankAccount (line 131) | public static function runDebitBankAccount()
    method runChargeTokenizedCreditCard (line 136) | public static function runChargeTokenizedCreditCard()
    method runCreateAnAcceptPaymentTransaction (line 141) | public static function runCreateAnAcceptPaymentTransaction()
    method runChargeCreditCard (line 146) | public static function runChargeCreditCard()
    method runCapturePreviouslyAuthorizedAmount (line 151) | public static function runCapturePreviouslyAuthorizedAmount()
    method runRefundTransaction (line 157) | public static function runRefundTransaction()
    method runVoidTransaction (line 164) | public static function runVoidTransaction()
    method runCreditBankAccount (line 170) | public static function runCreditBankAccount()
    method runChargeCustomerProfile (line 175) | public static function runChargeCustomerProfile()
    method runPayPalVoid (line 192) | private static function runPayPalVoid()
    method runPayPalAuthorizeCapture (line 198) | private static function runPayPalAuthorizeCapture()
    method runPayPalAuthorizeCaptureContinued (line 203) | private static function runPayPalAuthorizeCaptureContinued()
    method runPayPalAuthorizeOnlyContinued (line 209) | public static function runPayPalAuthorizeOnlyContinued()
    method runPayPalCredit (line 214) | public static function runPayPalCredit()
    method runPayPalAuthorizeOnly (line 219) | public static function runPayPalAuthorizeOnly()
    method runPayPalGetDetails (line 224) | public static function runPayPalGetDetails()
    method runPayPalPriorAuthorizationCapture (line 230) | public static function runPayPalPriorAuthorizationCapture()
    method runCreateSubscription (line 238) | public static function runCreateSubscription()
    method runCreateSubscriptionFromCustomerProfile (line 246) | public static function runCreateSubscriptionFromCustomerProfile()
    method runCancelSubscription (line 271) | public static function runCancelSubscription()
    method runGetSubscriptionStatus (line 277) | public static function runGetSubscriptionStatus()
    method runGetSubscription (line 286) | public static function runGetSubscription()
    method runUpdateSubscription (line 295) | public static function runUpdateSubscription()
    method runCreateCustomerProfile (line 305) | public static function runCreateCustomerProfile()
    method runDeleteCustomerProfile (line 313) | public static function runDeleteCustomerProfile()
    method runGetCustomerProfile (line 320) | public static function runGetCustomerProfile()
    method runCreateCustomerPaymentProfile (line 331) | public static function runCreateCustomerPaymentProfile()
    method runGetCustomerPaymentProfile (line 342) | public static function runGetCustomerPaymentProfile()
    method runValidateCustomerPaymentProfile (line 354) | public static function runValidateCustomerPaymentProfile()
    method runUpdateCustomerPaymentProfile (line 366) | public static function runUpdateCustomerPaymentProfile()
    method runDeleteCustomerPaymentProfile (line 378) | public static function runDeleteCustomerPaymentProfile()
    method runCreateCustomerShippingAddress (line 391) | public static function runCreateCustomerShippingAddress()
    method runDeleteCustomerShippingAddress (line 399) | public static function runDeleteCustomerShippingAddress()
    method runUpdateCustomerShippingAddress (line 408) | public static function runUpdateCustomerShippingAddress()
    method runGetCustomerShippingAddress (line 421) | public static function runGetCustomerShippingAddress()
    method runGetAcceptCustomerProfilePage (line 436) | public static function runGetAcceptCustomerProfilePage()
    method runGetTransactionDetails (line 446) | public static function runGetTransactionDetails()
    method runGetSettledBatchList (line 452) | public static function runGetSettledBatchList()
    method runGetBatchStatistics (line 466) | public static function runGetBatchStatistics()

FILE: TransactionReporting/get-account-updater-job-details.php
  function getAccountUpdaterJobDetails (line 9) | function getAccountUpdaterJobDetails()

FILE: TransactionReporting/get-account-updater-job-summary.php
  function getAccountUpdaterJobSummary (line 9) | function getAccountUpdaterJobSummary()

FILE: TransactionReporting/get-batch-statistics.php
  function getBatchStatistics (line 9) | function getBatchStatistics($batchId = "7927817") //only shows results f...

FILE: TransactionReporting/get-customer-profile-transaction-list.php
  function getTransactionListForCustomerRequest (line 9) | function getTransactionListForCustomerRequest($customerProfileId)

FILE: TransactionReporting/get-merchant-details.php
  function getMerchantDetails (line 9) | function getMerchantDetails()

FILE: TransactionReporting/get-settled-batch-list.php
  function getSettledBatchList (line 9) | function getSettledBatchList($firstSettlementDate, $lastSettlementDate)

FILE: TransactionReporting/get-transaction-details.php
  function getTransactionDetails (line 9) | function getTransactionDetails($transactionId)

FILE: TransactionReporting/get-transaction-list.php
  function getTransactionList (line 9) | function getTransactionList()

FILE: TransactionReporting/get-unsettled-transaction-list.php
  function getUnsettledTransactionList (line 9) | function getUnsettledTransactionList()

FILE: VisaCheckout/create-visa-src-transaction.php
  function createVisaSrcTransaction (line 9) | function createVisaSrcTransaction()

FILE: VisaCheckout/decrypt-visa-src-data.php
  function decryptVisaSrcData (line 9) | function decryptVisaSrcData()

FILE: constants/SampleCodeConstants.php
  class SampleCodeConstants (line 2) | class SampleCodeConstants
Condensed preview — 75 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (260K chars).
[
  {
    "path": ".gitignore",
    "chars": 649,
    "preview": "# Cache and logs (Symfony2)\n/app/cache/*\n/app/logs/*\n!app/cache/.gitkeep\n!app/logs/.gitkeep\n\n# Cache and logs (Symfony3)"
  },
  {
    "path": ".travis.yml",
    "chars": 681,
    "preview": "language: php\n\nmatrix:\n  include:\n    - php: 5.6\n      env: PHPUNIT_VERSION=5.6.*\n      dist: trusty\n    - php: 7.0\n    "
  },
  {
    "path": "AcceptSuite/create-an-accept-payment-transaction.php",
    "chars": 6242,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "AcceptSuite/get-accept-customer-profile-page.php",
    "chars": 1990,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "AcceptSuite/get-an-accept-payment-page.php",
    "chars": 2653,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/create-customer-payment-profile.php",
    "chars": 3567,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/create-customer-profile-from-transaction.php",
    "chars": 2244,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/create-customer-profile-with-accept-nonce.php",
    "chars": 3929,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/create-customer-profile.php",
    "chars": 4496,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/create-customer-shipping-address.php",
    "chars": 2656,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/delete-customer-payment-profile.php",
    "chars": 1865,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/delete-customer-profile.php",
    "chars": 1636,
    "preview": "<?php\n\trequire 'vendor/autoload.php';\n\trequire_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contrac"
  },
  {
    "path": "CustomerProfiles/delete-customer-shipping-address.php",
    "chars": 1924,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/get-customer-payment-profile-list.php",
    "chars": 3365,
    "preview": "<?php\n\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v"
  },
  {
    "path": "CustomerProfiles/get-customer-payment-profile.php",
    "chars": 2523,
    "preview": "<?php\n\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v"
  },
  {
    "path": "CustomerProfiles/get-customer-profile-ids.php",
    "chars": 1756,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/get-customer-profile.php",
    "chars": 4436,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/get-customer-shipping-address.php",
    "chars": 3033,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/update-customer-payment-profile.php",
    "chars": 3861,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/update-customer-profile.php",
    "chars": 5335,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/update-customer-shipping-address.php",
    "chars": 2662,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "CustomerProfiles/validate-customer-payment-profile.php",
    "chars": 2114,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "FraudManagement/approve-or-decline-held-transaction.php",
    "chars": 3302,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "FraudManagement/get-held-transaction-list.php",
    "chars": 1774,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "LICENSE",
    "chars": 1081,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Authorize.Net\n\nPermission is hereby granted, free of charge, to any person obt"
  },
  {
    "path": "MobileInAppTransactions/create-an-accept-transaction.php",
    "chars": 5621,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "MobileInAppTransactions/create-an-android-pay-transaction.php",
    "chars": 6579,
    "preview": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1"
  },
  {
    "path": "MobileInAppTransactions/create-an-apple-pay-transaction.php",
    "chars": 6665,
    "preview": "<?php\r\nrequire 'vendor/autoload.php';\r\nrequire_once 'constants/SampleCodeConstants.php';\r\nuse net\\authorize\\api\\contract"
  },
  {
    "path": "MobileInAppTransactions/create-google-pay-transaction.php",
    "chars": 4096,
    "preview": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1"
  },
  {
    "path": "PayPalExpressCheckout/authorization-and-capture-continued.php",
    "chars": 3678,
    "preview": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api"
  },
  {
    "path": "PayPalExpressCheckout/authorization-and-capture.php",
    "chars": 3639,
    "preview": "<?php\n\trequire 'vendor/autoload.php';\n\trequire_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contrac"
  },
  {
    "path": "PayPalExpressCheckout/authorization-only-continued.php",
    "chars": 3722,
    "preview": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api"
  },
  {
    "path": "PayPalExpressCheckout/authorization-only.php",
    "chars": 3694,
    "preview": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1"
  },
  {
    "path": "PayPalExpressCheckout/credit.php",
    "chars": 3826,
    "preview": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1"
  },
  {
    "path": "PayPalExpressCheckout/get-details.php",
    "chars": 4554,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PayPalExpressCheckout/prior-authorization-capture.php",
    "chars": 3527,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PayPalExpressCheckout/void.php",
    "chars": 3307,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/authorize-credit-card.php",
    "chars": 6017,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/capture-funds-authorized-through-another-channel.php",
    "chars": 3555,
    "preview": "<?php\nrequire 'vendor/autoload.php';\nrequire_once 'constants/SampleCodeConstants.php';\nuse net\\authorize\\api\\contract\\v1"
  },
  {
    "path": "PaymentTransactions/capture-previously-authorized-amount.php",
    "chars": 3290,
    "preview": "<?php\n require 'vendor/autoload.php';\n require_once 'constants/SampleCodeConstants.php';\n use net\\authorize\\api\\contract"
  },
  {
    "path": "PaymentTransactions/charge-credit-card.php",
    "chars": 6009,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/charge-customer-profile.php",
    "chars": 3622,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/charge-tokenized-credit-card.php",
    "chars": 3674,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/create-chase-pay-transaction.php",
    "chars": 3864,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/credit-bank-account.php",
    "chars": 4190,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/debit-bank-account.php",
    "chars": 4153,
    "preview": " <?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\cont"
  },
  {
    "path": "PaymentTransactions/refund-transaction.php",
    "chars": 3432,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/update-split-tender-group.php",
    "chars": 1763,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "PaymentTransactions/void-transaction.php",
    "chars": 3195,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "README.md",
    "chars": 2195,
    "preview": "# PHP Sample Code for the Authorize.Net SDK\n[![Travis CI Status](https://travis-ci.org/AuthorizeNet/sample-code-php.svg?"
  },
  {
    "path": "RecurringBilling/cancel-subscription.php",
    "chars": 1751,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "RecurringBilling/create-subscription-from-customer-profile.php",
    "chars": 2855,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "RecurringBilling/create-subscription.php",
    "chars": 3017,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "RecurringBilling/get-list-of-subscriptions.php",
    "chars": 2223,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "RecurringBilling/get-subscription-status.php",
    "chars": 1651,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "RecurringBilling/get-subscription.php",
    "chars": 2958,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "RecurringBilling/update-subscription.php",
    "chars": 2442,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "SampleCodeList.txt",
    "chars": 1654,
    "preview": "SampleCodeName,IsDependent,ShouldRun\nChargeCreditCard,1,1\nCreateSubscription,1,1\nCreateSubscriptionFromCustomerProfile,"
  },
  {
    "path": "Sha512/compute_trans_hashSHA2.php",
    "chars": 724,
    "preview": "<?php\n\n$apiLogin=\"2Kfn5S7x7D\";\n$transId=\"60115585081\";\n$amount='12.00';\n$signatureKey='56E529FE6C63D60E545F84686096E6AA0"
  },
  {
    "path": "TestRunner.php",
    "chars": 17279,
    "preview": "<?php\ndefine(\"DONT_RUN_SAMPLES\", \"true\");\ndefine(\"SAMPLE_CODE_NAME_HEADING\", \"SampleCodeName\");\nrequire 'vendor/autoload"
  },
  {
    "path": "TransactionReporting/get-account-updater-job-details.php",
    "chars": 3688,
    "preview": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api"
  },
  {
    "path": "TransactionReporting/get-account-updater-job-summary.php",
    "chars": 2264,
    "preview": "<?php\n    require 'vendor/autoload.php';\n    require_once 'constants/SampleCodeConstants.php';\n    use net\\authorize\\api"
  },
  {
    "path": "TransactionReporting/get-batch-statistics.php",
    "chars": 2829,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "TransactionReporting/get-customer-profile-transaction-list.php",
    "chars": 1860,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "TransactionReporting/get-merchant-details.php",
    "chars": 1829,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "TransactionReporting/get-settled-batch-list.php",
    "chars": 3377,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "TransactionReporting/get-transaction-details.php",
    "chars": 2053,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "TransactionReporting/get-transaction-list.php",
    "chars": 2400,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "TransactionReporting/get-unsettled-transaction-list.php",
    "chars": 1738,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "VisaCheckout/create-visa-src-transaction.php",
    "chars": 5956,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "VisaCheckout/decrypt-visa-src-data.php",
    "chars": 4227,
    "preview": "<?php\n  require 'vendor/autoload.php';\n  require_once 'constants/SampleCodeConstants.php';\n  use net\\authorize\\api\\contr"
  },
  {
    "path": "composer.json",
    "chars": 108,
    "preview": "{\n  \"require\": {\n  \"php\": \">=5.6\",\n  \"ext-curl\": \"*\",\n  \"authorizenet/authorizenet\": \">=2.0 || <2.1\" \n  }\n}\n"
  },
  {
    "path": "composer.json.sdk-dev",
    "chars": 201,
    "preview": "{\n  \"require\": {\n  \"php\": \">=5.6\",\n  \"ext-curl\": \"*\",\n  \"phpunit/phpunit\": \"~9.0||~9.5\",\n  \"authorizenet/authorizenet\": "
  },
  {
    "path": "constants/SampleCodeConstants.php",
    "chars": 160,
    "preview": "<?php\nclass SampleCodeConstants\n{\n\t//merchant credentials\n\tconst MERCHANT_LOGIN_ID = \"5KP3u95bQpv\";\n\tconst MERCHANT_TRAN"
  },
  {
    "path": "phpunit.xml.dist",
    "chars": 1607,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:noNamespac"
  }
]

About this extraction

This page contains the full source code of the AuthorizeNet/sample-code-php GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 75 files (236.8 KB), approximately 66.0k tokens, and a symbol index with 114 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!