Hello everybody, our company is supporting a custom shop in Germany that has to be upgraded to PayPalPLUS. I integrated the new SDK and changed the payment method to 'pay_upon_invoice'. When I request an approval url the API sends me an exception with 'For credit_card payment method, the supported funding instrument is credit_card or cardit_card_token'. - Why does the API needs the credit card information for the invoice pay? - Do we need a special PayPalPLUS Sandbox for the integration test? Here some code with my implementation: $finalAmount = number_format($ordering->getPaymentAmount(), 2, ".", ",");
$payer = new PayPal\Api\Payer();
$payer->setPaymentMethod('pay_upon_invoice');
$amount = new \PayPal\Api\Amount();
$amount->setTotal($finalAmount);
$amount->setCurrency('EUR');
$shipping_address = new PayPal\Api\ShippingAddress();
$shipping_address->setRecipientName($ordering->getShippingAddressFirstname() . " " . $ordering->getShippingAddressLastname());
$shipping_address->setLine1($ordering->getShippingAddressStreet() . " " . $ordering->getShippingAddressStreetNumber());
$shipping_address->setCity($ordering->getShippingAddressCity());
$shipping_address->setPostalCode($ordering->getShippingAddressZip());
$shipping_address->setCountryCode($ordering->getShippingAddressCountryCode());
$items = [];
$orderingPositions = $ordering->getOrderingPositions();
$orderingPositionsSize = count($orderingPositions);
for ($i = 0; $i < $orderingPositionsSize; $i++) {
$orderingPosition = $orderingPositions[$i];
$item = new \PayPal\Api\Item();
$item->setName($orderingPosition->getPositionTitle())
->setCurrency('EUR')
->setPrice(number_format($orderingPosition->getPriceIncVat(), 2, ".", ","))
->setQuantity($orderingPosition->getAmount());
$items[] = $item;
}
$shipping = new \PayPal\Api\Item();
$shipping->setName('Versandkosten')
->setCurrency('EUR')
->setPrice(number_format($ordering->getShippingCostIncVat(), 2, ".", ","))
->setQuantity(1);
$items[] = $shipping;
$discount = new \PayPal\Api\Item();
$discount->setName('Rabatt')
->setCurrency('EUR')
->setPrice(number_format($ordering->getPaymentDiscount() * (-1), 2, ".", ","))
->setQuantity(1);
$items[] = $discount;
$item_list = new \PayPal\Api\ItemList();
$item_list->setShippingAddress($shipping_address)
->setItems($items);
$transaction = new \PayPal\Api\Transaction();
$transaction->setAmount($amount)
->setItemList($item_list);
$redirectUrls = new \PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl($this->getReturnUrl())
->setCancelUrl($this->getCancelUrl());
$payment = new \PayPal\Api\Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions(array($transaction))
->setRedirectUrls($redirectUrls);
$payment->create($this->payPalApiContext);
$approvalUrl = $payment->getApprovalLink(); Maybe I can find some help here, thank you for your answers! Greetings Daniel
... View more