Liferay Commerce Connector to PayPal SDK
Liferay DXP 2024.Q4+/Portal 7.4 GA129+
Liferay provides a client extension that integrates with the PayPal JavaScript SDK to provide more payment options like Google Pay, Apple Pay, Venmo, Pay Later, etc. during checkout. This uses the payment integration client extension as a base.
Liferay also provides PayPal as a payment method out-of-the-box. This directs the user to PayPal to complete payment, whereas this SDK processes the payment without the user having to navigate away from Liferay. See Configuring Payment Methods to read more about the payment methods available out-of-the-box with Liferay.
Currently, the PayPal SDK client extension is only compatible with Liferay SaaS.
To use this client extension, you must have a merchant ID and also generate a PayPal client ID and client secret. Visit the PayPal Developer Dashboard for more information.
Install and Deploy the PayPal SDK Client Extension
-
Go to Liferay Marketplace and search for
Liferay Commerce Connector to PayPal SDK
. -
Click Get App, select your account or create one, and accept the end user license agreement and terms of service.
-
Click Continue.
-
Select a project from the ones available to you.
-
Click Get App.
-
Note the order ID. You must use it to install the app from your Cloud dashboard.
-
Click Go to Console.
-
Go to Services, and click New App.
-
Enter the order ID from before and complete the installation.
-
Log in as an administrator and verify that two OAuth Application User Agents and two OAuth Application Headless Servers were added to Liferay. Open the Global Menu () and go to Control Panel → OAuth2 Administration.
-
Open the Global Menu () and navigate to Commerce → Channels.
-
Select the channel and scroll down to the Payment Methods section.
-
Click Liferay PayPal Commerce Payment Integration.
-
Use the Active toggle to activate the payment method and click Save. Two new tabs for Eligibility and Configuration appear.
Click the Eligibility tab to select specific order types or payment terms to be eligible for the payment integration. By default, it is eligible for all order types and payment terms.
The Configuration tab contains can accept key-value pairs from your PayPal Developer Dashboard.
Field Description clientId
The Client ID field from your PayPal dashboard. clientSecret
The Client Secret field from your PayPal dashboard. merchantId
The Account ID field from your PayPal dashboard. mode
Use sandbox
orlive
depending on your configuration.webhookId
The ID of the webhook created on your PayPal dashboard. This is optional. -
Click Save.
PayPal is now enabled for your store.
-
Open your site and use the account selector to create a new account.
-
Add a few items to your cart.
-
Open the mini cart and click Submit. This starts the checkout flow.
-
Choose the Liferay PayPal Commerce Payment Integration method in the Payment Method step. If you didn’t have other active payment methods, this step appears directly. Use the desired payment option to complete payment.
The above flow uses PayPal’s sandbox mode. PayPal provides numerous test card numbers to replicate different payment scenarios. See Card Testing for more information.
- Open the Global Menu () and go to Commerce → Payments to verify the payment’s completion.