简体   繁体   中英

PayPal Plus - No "Pay upon Invoice" in Sandbox mode

I'm trying to integrate Paypal Plus in an online shop, using the REST API SDK, and so far everything is working fine. Only that the option "Pay upon Invoice" is missing. The funny thing is: Two weeks ago it was working. And to my knowledge nothing has changed in the script.

I tried patching the payment before showing the paywall, as recommended in PayPal Plus Sandbox - Pay upon Invoice . I tried adding the shipping address to the itemlist. I made sure, the shipping address really exists. Even upgraded the SDK. I'm out of ideas.

This is what my PHP code looks like:

$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");
}

And below that my 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>

Does anyone have an idea, that might do the trick?

By default, Pay upon Invoice is offered for total amounts between 1,50 and 1470 EUR.

https://developer.paypal.com/docs/paypal-plus/germany/how-to/pay-upon-invoice/

To test pay upon invoice in Sandbox you can enable the payment method in PLUS by adding the following parameter to the configuration object: showPuiOnSandbox: "true",

https://www.paypalobjects.com/digitalassets/c/website/marketing/emea/de/de/paypal-plus-center/PayPal_PLUS_integration_guide.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM