Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions PaymentTransactions/charge-customer-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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();
Expand Down Expand Up @@ -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);
?>
1 change: 1 addition & 0 deletions test-runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public static function runChargeCustomerProfile()
$chargeResponse = chargeCustomerProfile(
$response->getCustomerProfileId(),
$paymentProfileResponse->getCustomerPaymentProfileId(),
$response->getCustomerShippingAddressIdList()[0],
self::getAmount()
);
deleteCustomerProfile($response->getCustomerProfileId());
Expand Down