Online shop operators increasingly turn to PayPal as a secure payment option. Its integration, however, is not all that easy. We will explain to you step by step how to implement and test the interface between WooCommerce and PayPal.
We recommend creating a so-called “sandbox account” with PayPal to get started. It allows you to test and verify the payment interface thoroughly, before going live with actual transactions.
Installing the PayPal sandbox
You will need a merchant and a buyer test account to simulate payment transactions in the shop. This is how you create them:
- Create a user account at http://developer.paypal.com (at the top right, using the button Sign Up).
- Navigate to Dashboard → Sandbox → Accounts, where you can then click Create Account to confirm. The following form will appear:
- Start by selecting “Business (merchant account)” under Account type to create your merchant sandbox account.
- Ideally, you should enter a special test email as your Email address that you can later easily recognize as the merchant address.
Tip: It doesn’t have to be an actual email account. The sandbox will dispatch messages only internally; these can be checked in the developer account under Dashboard -> Sandbox notifications.
- Entering a value in the field PayPal balance is optional; it will be referenced for the testing of various payment limits within PayPal only.
- PayPal recommends carrying out these tests with the option Bank verified account set to “Yes” and also set to “No”. This will test accounts with different verification states. If your PayPal transactions only work correctly for some of your customers, then this could be an option to localize the error.
- You will need a so-called “PayPal Payments Pro” account to simulate credit card payments as a subsection of Payment methods. For more information please read the explanations at the end of this document.
- Confirm your input by clicking Create Account and exit.
- Repeat the whole process for the account type “Personal” (buyer account) to create a buyer test account. You will need to enter a different email address than before.
You can find an overview of the accounts you have created via Applications -> Sandbox accounts.
Note: The setup of the PayPal sandbox is not entirely intuitive. Even worse: some of the procedural steps recommended by PayPal are contradictory. More detailed instructions can be found on this page. Alternatively, PayPal offers additional information about the individual fields and their meaning here and here.
Once you have finished creating your PayPal sandbox, you can then access it via https://www.sandbox.paypal.com. On that page, you simply log in with your buyer or your merchant account, depending on the type of transaction to simulate or test. It will take a few minutes after the test accounts have been created, before you can access them with the user information (email address and password) you have provided.
You can manage the PayPal interface in WooCommerce via WooCommerce -> Settings -> Checkout -> PayPal:
For your first test it will suffice to set the interface to “Enable” via the check box at the very top, as well as the second to last option Enable PayPal sandbox:
Finally, simply enter the email address of the previously created sandbox merchant account in the field PayPal Email.
You can now carry out your test order in your online shop. You should now be forwarded to PayPal, provided the relevant payment type was selected and the payment process is complete. Entering the user information of the buyer test account will allow you to check the correct processing on both sides (buyer and seller).
The transaction will be displayed under My Account -> Overview in the seller account of the sandbox when completed, which should look something like this:
Advanced Fields in the PayPal Integration
WooCommerce offers a number of setting options for PayPal, which will allow you to adapt the integration to your specific requirements. Here an overview of the main setting options:
- You can use the fields Title and Description to specify the name of the payment type on the checkout page of your shop, and what other information will be provided for buyers selecting that payment type.
- The Receiver Email is optional. You can enter an email address here if you want confirmation emails for successful PayPal payments sent to a different recipient than the one stated in the PayPal account.
- The so-called Payment Data Transfer (PDT) allows you to view the details of the PayPal transaction status, which can be helpful if you would like to e.g. display that status to the customer while the transaction is under way. You will need a PayPal Identity Token for that. Find out more about the topic in this PayPal tutorial.
- Invoice Prefix: This unique identifier is displayed ahead of the invoice number for all PayPal transactions, which allows their unique identification. Here an example: An easily identifiable prefix should be used if your PayPal merchant account is used in several online shops, as PayPal will not accept duplicate invoice numbers.
- The option Payment Action determines, whether or not forwarded payments will be credited to the PayPal account immediately (the PayPal payment status will then be set to “Completed”), or if payments have to be approved manually (payment status “Pending”). The final variant is analog to the selection option “Authorization” in the WooCommerce settings.
- Selecting the check box Use form submission method will allow you to transmit additional data to PayPal via an extended interface. Read the explanations about the Payment Gateway API. You can leave this option disabled for the standard process.
- Page Styles will allow you to select individual PayPal user interfaces the customer will see during the payment process. You can use these to adapt the layout to the design of your online shop. Find out more about these options here.
- The check box Shipping Details governs whether the shipping address or the billing address will apply if PayPal is used for shipping processing.
- The option Address override should generally remain disabled to avoid conflicts in the PayPal-internal address validation process.
In most cases, the default settings will suffice for a PayPal integration into your WordPress shop.
You can deactivate the sandbox via the relevant WooCommerce field, once you have tested all processes successfully. The only thing left is to replace the test email address with your actual PayPal merchant account. However, you should still periodically check back to verify correct function (e.g. via the status messages in the PayPal account) to ensure that nor order or incomplete payment transaction gets lost.
You can create a merchant account with PayPal via this link. (Utilizing this payment provider will incur additional costs for the merchant, see the Fee Table.) PayPal offers additional information about account creation here.
We will be happy to answer any questions regarding PayPal integration in the comments below. You have some issues or problems regarding the PayPal account itself? The payment provider offers these Help Pages for your convenience.
New Plugin: Slack Connector - Connect WordPress, WooCommerce and Slackby Michael Firnkes
Initially we merely wanted to optimize our own Slack-processes. With automated notifications from our MarkettPress shop, the blog and our forums. The resul ...Read more
Role Based Prices for WooCommerce is available again: Different prices for different customer groupsby Michael Firnkes
You want different prices for different customers and users of your online shop? E.g. for subscribers or wholesaler? Or do you need bulk prices? A lot of o ...Read more
WooCommerce Weekly Review #7: Woo vs Magento, shop security and customer confidenceby Michael Firnkes
What is a WooCommerce shop in practice? And how do you protect it against external attacks? This and more in our Weekly Review. WooCommerce vs Magento: ...Read more
WooCommerce Weekly Review #6: Translations, WordCamp Switzerland & avoiding legal warningsby Michael Firnkes
WooCommerce was a hot topic at WordCamp in Switzerland. Progress is being made with the system translations and there are lots of useful new extensions. Th ...Read more