PayPal integration for Craft Commerce 3.3+
Credit card payments with the REST gateway are supported only in the US and UK.
PayPal has deprecated PayPal Express as a checkout flow. They have advised that projects should look to implement the PayPal Checkout integration to keep up to date. Therefore this plugin is now deprecated in favour of the new Commerce PayPal Checkout Plugin.
This plugin requires Craft 3.6 and Craft Commerce 3.3 or later.
You can install this plugin from the Plugin Store or with Composer.
Go to the Plugin Store in your project’s Control Panel and search for “PayPal for Craft Commerce”. Then click on the “Install” button in its modal window.
Open your terminal and run the following commands:
# go to the project directory cd /path/to/my-project.test # tell Composer to load the plugin composer require craftcms/commerce-paypal # tell Craft to install the plugin ./craft install/plugin commerce-paypal
To add a PayPal payment gateway, go to Commerce → Settings → Gateways, create a new gateway, and set the gateway type to either “PayPal Pro”, “PayPal REST” or “PayPal Express”.
Tip: PayPal Express API Username, API Password, and API Signature settings can now be set to environment variables. PayPal Pro API Username, API Password, and API Signature settings can now be set to environment variables. PayPal REST Client ID and Secret settings can now be set to environment variables. See Environmental Configuration in the Craft docs to learn more about that.
- Log in to your PayPal Seller Account
- In the top menu bar click "Profile" and choose "Profile and Settings"
- Click "My Selling Preferences"
- Click "API Access" (click "update")
- You want the the NVP/SOAP API Integration (Classic) section
- Then go to "Manage API credentials"
- If you don't have any credentials already then generate some.
Matching the different bits of info up to the fields within the gateway setup can be tricky as sometimes the labels change. This table should help.
|Gateway label||Sandbox Account/Account|
|API Username||Sandbox Account/Account|
|API Password||Client ID|
|API Signature||Secret (click 'Hide' to show it - totally logical)|
|Landing Page||Determines the type of form the user gets at PayPal|
In the gateway settings there is also a dropdown for "Solution Type". We think it may be the difference between personal and business PayPal accounts. In my case “Mark” worked, “Solo” didn’t.
"Landing Page" controls the type of form that is shown when the customer gets directed to PayPal. Selecting "Billing" will show a set of Credit Card fields with an option to login to PayPal (from memory this is a bit hidden). Selecting "Login" presents a PayPal login form without any credit card fields.
Brand Name, Header Image URL, Logo Image URL, and Border Colour are all customisation options for your landing page. Use the full URL to your image assets, including the domain.
If you're going to use the PayPal Express payment gateway you are required to change the default value of
tokenParam in your
Choose any different token name other than
token, for example you could put
craftToken. Otherwise redirects from PayPal will fail.