2

我正在使用 Authorize.net 的 API 并尝试获取客户付款资料信息。我可以获得所有客户 ID 的列表,并且我想遍历这些以获取客户付款资料信息。对于每个客户 ID,我可以转储包含客户信息的数组,其中包括付款资料 ID,但我不知道如何提取是否进行后续搜索:

我的代码是:

$profileIds[] = $response->getIds();
    $num_records = count($profileIds[0]);
    echo "There are " . $num_records . " Customer Profile ID's for this Merchant Name and Transaction Key <br/>";

    for ($i = 0; $i < count($profileIds[0]); $i++) {
        $profile_id = $profileIds['0'][$i];
        echo "<br/><br/>$profile_id <br/>";

        // Retrieve an existing customer profile along with all the associated payment profiles and shipping addresses
        $cust_request = new AnetAPI\GetCustomerProfileRequest();
        $cust_request->setMerchantAuthentication($merchantAuthentication);
        $cust_request->setCustomerProfileId($profile_id);
        $cust_controller = new AnetController\GetCustomerProfileController($cust_request);
        $cust_response = $cust_controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);
        if (($cust_response != null) && ($cust_response->getMessages()->getResultCode() == "Ok") ){
            echo "GetCustomerProfile SUCCESS : " .  "\n";
            $profileSelected = $cust_response->getProfile();
            $paymentProfilesSelected = $profileSelected->getPaymentProfiles();

            echo "Profile Has " . count($paymentProfilesSelected). " Payment Profiles <br/>";
            $paymentProfileID = $paymentProfilesSelected->customerPaymentProfileId;
            echo "Payment Profile ID: $paymentProfileID<br/>";

            print_r($paymentProfilesSelected);
4

0 回答 0