Paypal api, get BUSINESS_ERROR


Paypal api, get BUSINESS_ERROR

我使用paypal php sdk与沙箱模式。在它正常工作之前,我在每个请求发票上都有错误。

我从paypal得到这个错误。

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错误。