Magento PayPal Plus Integration

created February 12, 2016, last updated February 13, 2016.

.
closeThis post was last updated 8 years 1 month 10 days ago, some of the information contained here may no longer be actual and any referenced software versions may have been updated!

If you are an online retailer in Germany using PayPal chances are you have or will be getting a call from PayPal encouraging you to migrate your PayPal payment methods to PayPal Plus.

What is PayPal Plus?

PayPal introduced PayPal Plus in February 2015 as an all in one payment solution for online retailers in Germany. It differs from the normal Magento PayPal methods – standard and express in a few ways.

  • it uses PayPal’s RESTful API
  • payment methods are embedded in a checkout “payment wall” using an iFrame
  • multiple payment options are available
    • credit card, direct debit  (Lastschrift), invoice payment (Kaufaufrechnung)
  • a paypal account is not required to pay

Why is PayPal Plus only available in Germany

The Germans are very careful when it comes to online data protection, especially where money is concerned. I would guess that the requirement for other payment methods in Germany such as Lastschrift (direct debit) which is a very popular way of paying for all sorts of things in Germany has prompted Paypal to develop a solution tailored specifically toward German consumer requirements.

How to implement PayPal Plus

Magento module

PayPal will send you an open source PayPal Plus module developed by iWays. The module will run on Magento CE 1.7 or greater using the default checkout. It also supports some other one page checkout modules.

Module installation is pretty straight forward – I didn’t find a GitHub version so created my own as I prefer to manage my module installations with modman.

After installation refresh your caches and a new payment method is created, configure PayPal Plus from system > config > sales > payment methods > paypalplus settings.

The Merchant Country for your store must be set to Germany, PayPal Plus is (at the time of writing) only available in Germany, the module settings will not be displayed if your Merchant Country is not set to Germany.

Configure your PayPal app client and client secret and turn on the sandbox mode for testing.

Note – if you have OPCACHE enabled and the opcache.save_comments option disabled you Magento will throw an exception with a “class should have a proper return type” error. Enable save_comments and reload Apache to continue.

REST API

In REST the classic API signature is replaced with client_ID and client secret. These need to be generated by creating a PayPal app. To create a PayPal app log in to the PayPal Developer portal with your PayPal account and navigate to the My REST apps page. Click Create App to begin the application-creation process. The app will automatically be in sandbox mode.

testing

With valid sandbox API credentials and the module enabled you will see your payment methods have been replaced by the PayPalPlus payment methods templates (base/default/template/paypalplus). The template embeds the PayPal Plus payment wall iFrame into your checkout page including the 4 standard payment methods.

Note – if you have already extended and customised the base payment method template it has now also been extended by the iWays modules templates. You will need to extend the iWays templates and modify them with your customisations.

The default payment wall is white as shown above, at the time of writing there are no options available to change the style. colours etc of the payment wall.

The module quite cleverly detects your existing PayPal payment methods – express, standard etc. And knows to replace them with PayPal plus. Your other payment methods will appear below the PayPal Plus options nicely styled to match the payment wall. You should leave all your existing PayPal payment options enabled, should there be any problems with PayPal Plus your shop will automatically fall back to your normal payment methods.

You can also integrate your other payment methods directly into the payment wall by enabling them in the  “allow third party modules” module settings.

In sandbox mode you can now test out all the payment options. To test Kauf auf Rechnung (Invoice) you need to set the “Show PuI in Sandbox” option to Yes in the module development settings options. PuI is Payment Upon Invoice – a rather literal translation of the German Kauf auf Rechnung.

Kauf auf Rechnung

PayPal Plus lets customers order and pay by invoice. The merchant receives the payment directly from Paypal like any other PayPal transaction. The goods can be shipped as soon as the merchant is paid by PayPal and the customer has up to 30 days to pay the invoice, paying the outstanding amount directly to PayPal.

Many online retailers shy away from offering this kind of payment option due to the problems arising from unpaid invoices and chasing debtors for payment but with PayPal taking over this responsibility there is no reason (apart from the PayPal transaction fees) to not offer it.

One problem with this option is making sure that the customer knows to pay the outstanding invoice amount to Paypal and not the Merchant. You will notice when you test payments that the module shows all payment methods on order confirmations as “PayPal, Lastschrift, Kreditkarte, Kauf auf Rechnung”.

At the time of writing there is actually no way to distinguish between PayPal Plus Paypal, Kreditkarte or Lastschrift payments. You can however identify invoice Kauf auf Rechnung payments.

If you look at a payment made with Kauf auf Rechnung you will see the order has a ppp_pui_instruction_type object set to “PAY_UPON_INVOICE”, this lets you check for invoice payments using something like

	if($_order->getPayment()->getData('ppp_pui_instruction_type')=='PAY_UPON_INVOICE')
	{
		$_isPUI=true;
	}

This is useful because Paypal recommends you make sure the customer is aware that the payment must be made to PayPal. By identifying an invoice payment we can customise the information shown to the customer when they pay using Kauf auf Rechnung.

For example we can customise the new order email to show Kauf auf Rechnung as the payment method, and add the recommended PayPal invoice payment text to the payment information.

Kauf auf Rechnung sales email
Kauf auf Rechnung sales email

 

Similarly we can add the same information to the checkout success page.

To customise your email templates you need to add a new handler to your layout.

<?xml version="1.0"?>
<layout version="0.1.0">
	<!-- sales payment info handler -->
	<my_sales_email_payment_info>
		<block type="core/template" name="addPaymentInfo" template="my/sales/email/payment/info.phtml" />
	</my_sales_email_payment_info>
</layout>

in your sales/email/payment/info.phtml template add the logic and information you want to display in the sales email.

<?php

$_order = $this->getOrder();
$_isPUI=false;

	
	if($_order->getPayment()->getData('ppp_pui_instruction_type')=='PAY_UPON_INVOICE')
	{
		$_isPUI=true;
	}
	

?>
<?php if($_isPUI):?>
		<p>YOUR CUSTOM TEXT</p>
<?php endif;?>

You can now call this handler from anywhere in your sales email templates using

{{layout handle="my_sales_email_payment_info" order=$order}}

to display the information from your template. We can do exactly the same for the checkout success page, you just need to retrieve the order object first.

$_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());

Conclusions

Considering Paypal used to belong to eBay, and eBay now owns Magento it’s likely that PayPal plus will become part of the Magento core code at some point in the future. The iWays module is well written and works well – it will need some customisation to fit into your own specific requirements especially if you have already customised your payment method templates. Time will tell how invoice payments work…

Comments

  1. Henning says:

    Hello gaiter!

    Your current PayPal Plus module on github is version 1.7.0.
    The version available from paypal integration center is only 1.6.1.
    Is your version an official update by Iways or did you change the code yourself to a higher version?

  2. Bhavesh says:

    “I integrate paypal plus with my shop it display only three method ”

    PayPal
    Lastschrift
    Kreditkarte

    I also want Kauf auf Rechnung (Pay_Upon_Invoice) How can enable it ?

  3. Mr. Frakes says:

    Hey there,
    thanks for the info, PPP sure is interesting for smaller shops and the “Kauf auf Rechnung” option is nice to add too. However, when it comes to the magento module it looks rather nasty. It really looks like they just did it quick & dirty. I have read so much about the issues and I myself had trouble with another module (which they claimed to be 100% compatible).

    Your workaround with the mail got me here, it’s very helpful! Just a quick question: You mention to “do exactly the same for the checkout success page”, however I seem to have problems doing that.
    I tried getChildHtml(‘addPaymentInfo’); ?> but it does not seem to work. Can you explain what needs to be done to include the contents of sales/email/payment/info.phtml into the success.phtml file? Thanks!

This site uses Akismet to reduce spam. Learn how your comment data is processed.