Php Paypal api,获取业务\u错误
我使用带有沙盒模式的paypal php sdk。我在创建发票的每个请求上都有错误,在它正常工作之前 我从贝宝那里得到这个错误Php Paypal api,获取业务\u错误,php,paypal,Php,Paypal,我使用带有沙盒模式的paypal php sdk。我在创建发票的每个请求上都有错误,在它正常工作之前 我从贝宝那里得到这个错误 code: 500 { "name":"BUSINESS_ERROR", "message":"Internal error.", "debug_id":"71e1394c58958" } 我找不到此错误的描述 更新 php代码 try { $payPalInvoice = new Invoice(); $p
code: 500
{
"name":"BUSINESS_ERROR",
"message":"Internal error.",
"debug_id":"71e1394c58958"
}
我找不到此错误的描述
更新
php代码
try {
$payPalInvoice = new Invoice();
$payPalInvoice
->setMerchantInfo($this->merchantInfo)
->setBillingInfo([
new BillingInfo(
['email' => $invoice->getPaymentOptions()['email']]
)
]);
$payPalInvoice->setItems([
new InvoiceItem(
[
'name' => 'Order #' . $invoice->getOrder()->getId(),
'quantity' => 1,
'unit_price' => [
'currency' => 'USD',
'value' => $invoice->getOrder()->getAmountFormatted()
]
]
)
]);
$payPalInvoice->create($this->apiContext);
$payPalInvoice->send($this->apiContext);
$invoice->setForeignId($payPalInvoice->getId());
$invoice->setStateMessage($payPalInvoice->getStatus());
} catch (\PayPal\Exception\PayPalConnectionException $e) {
$invoice->setNextState('failed');
$error = 'code: ' . $e->getCode() . 'data: ' . json_encode($e->getData()); // Prints the detailed error message
$invoice->setError($error);
} catch (\Exception $e) {
$invoice->setNextState('failed');
$invoice->setError($e->getMessage());
}
我捕获\PayPal\Exception\PayPalConnectionException错误这是PayPal错误。现在可以了。在paypal的沙箱模式下尝试您的代码