diff --git a/PaymentTransactions/charge-customer-profile.php b/PaymentTransactions/charge-customer-profile.php index 7482001..f26367d 100644 --- a/PaymentTransactions/charge-customer-profile.php +++ b/PaymentTransactions/charge-customer-profile.php @@ -6,7 +6,7 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function chargeCustomerProfile($profileid, $paymentprofileid, $amount) +function chargeCustomerProfile($profileid, $paymentprofileid,$shippingProfileId, $amount) { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ @@ -21,6 +21,8 @@ function chargeCustomerProfile($profileid, $paymentprofileid, $amount) $profileToCharge->setCustomerProfileId($profileid); $paymentProfile = new AnetAPI\PaymentProfileType(); $paymentProfile->setPaymentProfileId($paymentprofileid); + // either ShipTO or ShippingProfileID can be used but not Both. + $profileToCharge->setShippingProfileId($shippingProfileId); $profileToCharge->setPaymentProfile($paymentProfile); $transactionRequestType = new AnetAPI\TransactionRequestType(); @@ -85,5 +87,5 @@ function chargeCustomerProfile($profileid, $paymentprofileid, $amount) } if(!defined('DONT_RUN_SAMPLES')) - chargeCustomerProfile("36731856","32689274",12.23); + chargeCustomerProfile("1917854275","1831010763","1875117981",12.23); ?> diff --git a/test-runner.php b/test-runner.php index 61c981c..44843eb 100644 --- a/test-runner.php +++ b/test-runner.php @@ -182,6 +182,7 @@ public static function runChargeCustomerProfile() $chargeResponse = chargeCustomerProfile( $response->getCustomerProfileId(), $paymentProfileResponse->getCustomerPaymentProfileId(), + $response->getCustomerShippingAddressIdList()[0], self::getAmount() ); deleteCustomerProfile($response->getCustomerProfileId());