Skip to content

PR for issue sample-code-php/issues/142 #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
@@ -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);
?>
1 change: 1 addition & 0 deletions test-runner.php
Original file line number Diff line number Diff line change
@@ -182,6 +182,7 @@ public static function runChargeCustomerProfile()
$chargeResponse = chargeCustomerProfile(
$response->getCustomerProfileId(),
$paymentProfileResponse->getCustomerPaymentProfileId(),
$response->getCustomerShippingAddressIdList()[0],
self::getAmount()
);
deleteCustomerProfile($response->getCustomerProfileId());