How to add PagSeguro as a Payment Method in Magento 2

PagSeguro payment provider is one of the biggest online and mobile payment-based e-commerce service for commercial operations in Brazil. According to ClearSale there are around 80 million online credit card transactions in Brazil every year as 2012 year.

PagSeguro is now available for websites based on Magento 2 platform. Adding this payment option will greatly increase your sales made on your online website. In this tutorial we will show you how to add PagSeguro as a Payment Method on checkout page in Magento 2.

PagSeguro for Magento 2

The first thing you have to do to get started with PagSeguro payment is to register as a vendor at PagSeguro registration page. After successfull registration PagSeguro account page will provide you with Token and Business IDsettings for setting up PagSeguro connection with Magento 2 store.

This is one time setup you will set and forget system. Once you have an active PagSeguro account using the link we provided, read the next step of setting up PagSeguro integration.

PagSeguro Extension

The next step is to actually integrate the PagSeguro as a payment option into your Magento 2 store. Through the PagSeguro Payment module for Magento 2, you can easily install and enable PagSeguro payment method via configuration settings coming together with the module.

Extension Installation

The extension is very easy to install. The are two most popular ways of installation Magento 2 extension. The first one is to use CLI (Command Line Interface) and the second one is to install manually. We recommend to install PagSeguro extension using Command Line Interface. We also take care of installations of Magento 2 extensions, please let us know if you require assistance.

Once PagSeguro module is installed in the Magento 2 system an additional PagSeguro Payment payment option will appear under Magento Admin -> Stores -> Configuration -> Sales -> Payment Methods configuration section.

Pic. 1. PagSeguro Payment method configuration in Magento 2 Admin

From the PagSeguro Payment configuration section you have to add Merchant Token and Merchant Emailinformation obtained from setting up PagSeguro account. In case you don't have one, please make sure to create one.

Payment method configuration setting in Magento 2 Admin

Among other settings you may use to configure PagSeguro as a payment method the Connection Type setting allows you to select desired behavior of the integration.

There are 2 different settings to choose. First one is a standard Redirect type. With this setting enabled customers are redirected to a PagSeguro secure payment server where customers can fill in all necessary Credit Card information and complete purchase. Once completed, customer is redirected back to a Order Success Page Magento 2 store. This option is the most secure for a website as no sensitive Credit Card data is processed by a website itself.

Pic. 3. PagSeguro Payment Method with Redirect Type in Magento 2

The second option is Lightbox type. A PagSeguro payment form opens in a popup window once customer clicks Place Order button on Checkout page. The payment form is loaded via iFrame and data processed directly with PagSeguro PCI Compliant services.

Pic. 4. PagSeguro Payment Method with Lightbox Type in Magento 2

Summary

As you may notice, it's very simple and smooth way to integrate PagSeguro Payment module into your Magento 2 store. If you would like to take care of module installation, fill free to send us an email and we'll help you set it up.

Pronko Consulting offers Magento 2 migration package for eCommerce websites. It includes project planning, existing data migration, custom features development, website design and the successful release. Contact us for any questions about your Magento 2 migration.