2

我正在使用 Paypal 的经典 API 进行直接付款。这是代码:

        require('merchant-sdk-php-master/samples/PPBootStrap.php');

        $logger = new PPLoggingManager('DoDirectPayment');

        $address = new AddressType();
        $address->Name = $full_name;
        $address->Street1 = $address_1;
        $address->Street2 = $address_2;
        $address->CityName = $city;
        $address->StateOrProvince = $province;
        $address->PostalCode = $postal_code;
        $address->Country = $country;
        $address->Phone = $phone;

        $paymentDetails = new PaymentDetailsType();
        $paymentDetails->ShipToAddress = $address;
        $paymentDetails->OrderTotal = new BasicAmountType('CAD', $amount);

        $personName = new PersonNameType();
        $personName->FirstName = $first_name;
        $personName->LastName = $last_name;

        $payer = new PayerInfoType();
        $payer->PayerName = $personName;
        $payer->Address = $address;
        $payer->PayerCountry = $country;

        $cardDetails = new CreditCardDetailsType();
        $cardDetails->CreditCardNumber = $card_number;
        $cardDetails->CreditCardType = $card_type;
        $cardDetails->ExpMonth = $expiry_month;
        $cardDetails->ExpYear = $expiry_year;
        $cardDetails->CVV2 = $cvv;
        $cardDetails->CardOwner = $payer;

        $ddReqDetails = new DoDirectPaymentRequestDetailsType();
        $ddReqDetails->CreditCard = $cardDetails;
        $ddReqDetails->PaymentDetails = $paymentDetails;
        $ddReqDetails->PaymentAction = 'Sale';
        $ddReqDetails->IPAddress = $ip_address;
        $ddReqDetails->ReturnFMFDetails = true;

        $doDirectPaymentReq = new DoDirectPaymentReq();
        $doDirectPaymentReq->DoDirectPaymentRequest = new DoDirectPaymentRequestType($ddReqDetails);

        $logger->info("created doDirectPaymentReq Object");

        $paypalService = new PayPalAPIInterfaceServiceService();

        try{
            $doDirectPaymentResponse = $paypalService->DoDirectPayment($doDirectPaymentReq);
            var_dump($doDirectPaymentResponse);
        } 
        catch (Exception $ex){
            var_dump($ex);
        }

这是它返回的对象:

object(DoDirectPaymentResponseType)#84 (15) { ["Amount"]=> NULL ["AVSCode"]=> NULL ["CVV2Code"]=> NULL ["TransactionID"]=> NULL ["PendingReason"]=> NULL ["PaymentStatus"]=> NULL ["FMFDetails"]=> NULL ["ThreeDSecureResponse"]=> NULL ["PaymentAdviceCode"]=> NULL ["Timestamp"]=> NULL ["Ack"]=> NULL ["CorrelationID"]=> NULL ["Errors"]=> NULL ["Version"]=> NULL ["Build"]=> NULL } ­

我是加拿大人,所以我不能使用新的 API,因为它们在这里还没有。我坚持使用经典的 API。为什么我会得到这个结果?

任何帮助表示赞赏!

4

1 回答 1

0

出于某种原因,昨天我得到了一个 NULL 值的对象。但是,今天我收到一条错误消息。我修复了错误并获得了成功。

为什么它今天而不是昨天向我显示错误消息,我不知道。我从未更改过任何代码,所以它一定是 Paypal 的结果。

仍然不知道出了什么问题,但就是这样。

于 2013-03-13T16:17:10.700 回答