gpt4 book ai didi

Paypal DoDirectPayment 请求返回 NULL

转载 作者:太空宇宙 更新时间:2023-11-03 15:51:26 26 4
gpt4 key购买 nike

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

感谢任何帮助!

最佳答案

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

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

仍然不知道哪里出了问题,但仅此而已。

关于Paypal DoDirectPayment 请求返回 NULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15370986/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com