PayPal Plus - 否"支付发票"在沙盒模式下

时间:2017-07-20 10:00:45

标签: php paypal paypal-sandbox paypal-rest-sdk paypal-plus

我尝试使用REST API SDK在一个在线商店中集成Paypal Plus,到目前为止一切正常。只有选项" Pay on Invoice"不见了。 有趣的是:两周前它正在运作。据我所知,剧本中没有任何变化。

我按照PayPal Plus Sandbox - Pay upon Invoice的建议,在显示付费专区之前尝试修补付款。我尝试将送货地址添加到项目列表中。我确定,送货地址确实存在。甚至升级了SDK。我没有想法。

这就是我的PHP代码:

$items = array();
$item = new PayPal\Api\Item();
$item->setName("test")
     ->setDescription("test")
     ->setCurrency('EUR')
     ->setQuantity(1)
     ->setPrice(5);
$items[] = $item;

$itemList = new PayPal\Api\ItemList();
$itemList->setItems($items);

$details = new PayPal\Api\Details();
$details->setTax(0.95)
        ->setSubtotal(5);
$amount = new PayPal\Api\Amount();
$amount->setCurrency("EUR")
       ->setTotal(5.95)
       ->setDetails($details);

$transaction = new PayPal\Api\Transaction();
$transaction->setAmount($amount)
            ->setItemList($itemList)
            ->setDescription("Test")
            ->setInvoiceNumber(uniqid());

$payer = new PayPal\Api\Payer();
$payer->setPaymentMethod("paypal");

$redirectUrls = new PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl($CFG["paypal_return"]);
$redirectUrls->setCancelUrl($CFG["paypal_abbruch"]);

$payment = new PayPal\Api\Payment();
$payment->setIntent("sale")
        ->setPayer($payer)
        ->setRedirectUrls($redirectUrls)
        ->setTransactions(array($transaction));

try {
    $payment->create($apiContext);
    $approvalUrl = $payment->getApprovalLink();
    $paymentId = $payment->getId();
} catch (PayPal\Exception\PayPalConnectionException $ex) {d($ex);
    die("Error creating payment");
}

在我的HTML / JS之下:

<div id="ppplus"></div>
<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js" type="text/javascript"></script>
<script type="application/javascript">
    var ppp = PAYPAL.apps.PPP({
        "approvalUrl": "<?=$approvalUrl?>",
        "placeholder": "ppplus",
        "mode": "sandbox",
        "showPuiOnSandbox": "true",
        "country": "DE",
        "language": "de_DE",
        "surcharging": true,
        "useraction": "commit",
        "buttonLocation": "outside"
    });
</script>

有没有人有想法,可能会有这个诀窍?

0 个答案:

没有答案