PayPal PLUS Integration in custom shop with pay upon invoice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @mintellity,
I will advise you to send "payment_method": "paypal" as payment method.
As we can see in the flow below that in a case of Payment upon Invoice, the response of the execute payment request will indicates the following variable : "instruction_type": "PAY_UPON_INVOICE""
Here is a sample of flow :
Request Body: { "redirect_urls": { "cancel_url": "http://www.mypage.de/index.php?s=119&a=return&r=false", "return_url": "http://www.mypage.de/index.php?s=119&a=return&r=true" }, "experience_profile_id": "XX-XXXX-XXXX-XXXX-XXXX", "intent": "sale", "payer": { "payment_method": "paypal" }, "transactions": [ { "item_list": { "items": [ { "currency": "EUR", "price": "3.95", "name": "Lucky Paw", "quantity": 50 }, { "currency": "EUR", "price": "17", "name": "Lucky Tail", "quantity": 1 } ] }, "amount": { "currency": "EUR", "total": "214.50", "details": { "shipping_discount": "0", "handling_fee": "0", "subtotal": "214.50", "tax": "0", "shipping": "0" } }, "description": "Payment" } ] }
------------------------------------- Response Body: { "links": [ { "href": "https://api.paypal.com/v1/payments/payment/PAY-1111111111111111111111111", "method": "GET", "rel": "self" }, { "href": "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-11111111111111111111", "method": "REDIRECT", "rel": "approval_url" }, { "href": "https://api.paypal.com/v1/payments/payment/PAY-1111111111111111111111111/execute", "method": "POST", "rel": "execute" } ], "payer": { "payment_method": "paypal" }, "transactions": [ { "item_list": { "items": [ { "currency": "EUR", "price": "3.95", "name": "Lucky Paw", "quantity": 50 }, { "currency": "EUR", "price": "17.00", "name": "Lucky Tail", "quantity": 1 } ] }, "related_resources": [], "amount": { "currency": "EUR", "total": "214.50", "details": { "subtotal": "214.50", "handling_fee": "0.00", "tax": "0.00", "shipping": "0.00", "shipping_discount": "0.00" } }, "description": "Payment" } ], "state": "created", "experience_profile_id": "XX-XXXX-XXXX-XXXX-XXXX", "create_time": "2018-02-15T20:15:42Z", "intent": "sale", "id": "PAY-111111111111111111111111111" }
----------------- Execute Payment ----------- Response Headers: Date: Thu, 15 Feb 2018 12:18:07 PST Paypal-Debug-Id: 11111111111111 APPLICATION_ID: APP-1111111111111111111 Content-Language: * CALLER_ACCT_NUM: 11111111111111 Request Body: { "payer_id": "11111111111111", "transactions": [ { "amount": { "currency": "EUR", "total": "214.50", "details": { "shipping_discount": "0", "handling_fee": "0", "subtotal": "214.50", "tax": "0", "shipping": "0" } } } ] }
Response Body: { "links": [ { "href": "https://api.paypal.com/v1/payments/payment/PAY-1111111111111111111111111", "method": "GET", "rel": "self" } ], "payer": { "payment_method": "paypal", "status": "UNVERIFIED", "payer_info": { "first_name": "Finlee", "last_name": "Tanks", "payer_id": "1111111111111", "billing_address": { "city": "Berlin", "line2": "", "line1": "Michaelkirchplatz 24", "state": "", "postal_code": "10179", "country_code": "DE" }, "country_code": "DE", "shipping_address": { "city": "Berlin", "line1": "******", "recipient_name": "Finlee Tanks", "state": "", "postal_code": "10179", "country_code": "DE" }, "email": "my.buyer@mail.de" } }, "transactions": [ { "item_list": { "items": [ { "currency": "EUR", "price": "3.95", "name": "Lucky Paw", "quantity": 50 }, { "currency": "EUR", "price": "17.00", "name": "Lucky Tail", "quantity": 1 } ], "shipping_address": { "city": "Berlin", "line1": "******", "recipient_name": "Finlee Tanks", "state": "", "postal_code": "10179", "country_code": "DE" } }, "related_resources": [ { "sale": { "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE", "update_time": "2018-02-15T20:18:06Z", "links": [ { "href": "https://api.paypal.com/v1/payments/sale/11111111111111111", "method": "GET", "rel": "self" }, { "href": "https://api.paypal.com/v1/payments/sale/11111111111111111/refund", "method": "POST", "rel": "refund" }, { "href": "https://api.paypal.com/v1/payments/payment/PAY-1111111111111111111111111", "method": "GET", "rel": "parent_payment" }, { "href": "https://api.paypal.com/v1/payments/payment/PAY-1111111111111111111111111/payment-instruction", "method": "GET", "rel": "payment_instruction" } ], "receipt_id": "1808455015873704", "protection_eligibility": "ELIGIBLE", "state": "completed", "parent_payment": "PAY-1111111111111111111111111", "amount": { "currency": "EUR", "total": "214.50", "details": { "subtotal": "214.50" } }, "create_time": "2018-02-15T20:18:06Z", "payment_mode": "INSTANT_TRANSFER", "id": "11111111111111111", "transaction_fee": { "currency": "EUR", "value": "4.19" } } } ], "description": "Payment", "payee": { "merchant_id": "1111111111111", "email": "info@mypage.de" }, "amount": { "currency": "EUR", "total": "214.50", "details": { "tax": "0.00", "handling_fee": "0.00", "subtotal": "214.50", "shipping": "0.00", "shipping_discount": "0.00" } }, "invoice_number": "111111" } ], "cart": "2HH24344NX5288311", "payment_instruction": { "reference_number": "11111111111111111", "links": [ { "href": "https://api.paypal.com/v1/payments/payment/PAY-1111111111111111111111111/payment-instruction", "method": "GET", "rel": "self" } ], "recipient_banking_instruction": { "bank_identifier_code": "111111111111", "bank_name": "Deutsche Bank", "account_holder_name": "PayPal Europe", "international_bank_account_number": "DE1111111111111111111111" }, "payment_due_date": "2018-03-17", "amount": { "currency": "EUR", "value": "214.50" }, "instruction_type": "PAY_UPON_INVOICE" }, "state": "approved", "create_time": "2018-02-15T20:18:07Z", "intent": "sale", "id": "PAY-1111111111111111111111111" }

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Create Pay Links using PayPal API in REST APIs
- Shopify PayPal integration, customer authorized multiple times in PayPal Payments Standard
- GET /customer/partners/:partner_id/merchant-integrations/:seller_id returning 404 in Sandbox. Help! in Sandbox Environment
- Changing from PayPal Website Payments Pro to PayPal Advanced Debit and Credit Cards in NVP/SOAP APIs
- Integrating PayPal Buy It Now onto a custom website (Ionos) in PayPal Payments Standard