Paypal DoDirectPaymentRequest返回NULL

时间:2013-03-12 20:01:08

标签: paypal

我使用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。为什么我得到这个结果?

感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

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

为什么它今天向我显示错误信息,而不是昨天,我不知道。我从来没有改变任何代码,因此它必须是Paypal的结尾。

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