Due to its popularity, PayPal has become the go-to option for sending and receiving money anywhere in the world.
If you run an eCommerce store, you need a means of accepting money from customers. While there are many options you could choose from, Paypal is often one of the top choices. Why? Most online shoppers use PayPal and have become used to the PayPal payment process. On your end, receiving payments through this platform is a seamless and secure process.
In this article, you will learn how to add PayPal to Woocommerce, easily. But first, we need to create a PayPal sandbox.
In this article:
- How to Create PayPal Sandbox Account
- Installing Paypal for WooCommerce
- Setting Up PayPal in Woocommerce
- How to Generate Identity Token
How to create a PayPal Sandbox Account
Before deploying a PayPal payment gateway to your Woocommerce site, it’s needful to first test it to be sure everything works fine. Thankfully PayPal has an option for this: PayPal sandbox. So, for this tutorial, we shall be creating a sandbox account and using it along the way.
Head over to PayPal’s developer section. On the far right corner, click Log into Dashboard
Upon click, you would be prompted to sign in or sign up. In this instance, we will be signing up.
Next, select an account category: Personal or Business. Personal PayPal accounts are for those who just want to send and receive money. Since you would be doing business transactions, choose a business account.
Put in your email (personal or business email), set a password and provide a description of your business.
Once you are done, submit your entry. The next screen you would see is this:
To link PayPal to your bank account, get a debit card for your business, etc. click Continue to Payment Setup. You can do that later, but for now, let’s integrate PayPal with WooCommerce.
Installing PayPal for WooCommerce
If you don’t have WooCommerce up and running on your WordPress website, go ahead and install WooCommerce and activate it now. This is done in the same way as every other plugin is installed and activated.
With WooCommerce installed and activated, navigate to WooCommerce >> Settings
Next, click Payment
Note: If you are using older versions of WooCommerce, you would see Checkout in place of Payments.
Scroll down to PayPal Standard, enable it by toggling the button to the left (usually disabled by default).
Next click Set Up. The next screen you would see is this:
Setting Up PayPal in WooCommerce
In the Title section, put in the headline you would want customers to see on landing on your PayPal checkout page. A good title would be something like this: “Pay with PayPal”.
As for the description, put in the text that would be below the headline. Remember the email you used for opening your business account? Put it in the “PayPal email” section.
Since we are still in the testing phase, check Enable PayPal Sandbox. Also, check Enable logging to capture all PayPal events on your site. Now let’s setup PayPal.
If you would want to receive alerts in an email different from the PayPal email, put it in the Receiver email.
PayPal identity token offers a secure means to verify payment from customers without using PayPal native’s IPN (Instant Payment Notification). Also, with identity token, you can keep track of all transaction, either ongoing or completed.
How to generate Identity Token
To generate Identity Token, log into your PayPal business account and click on the settings icon.
Next, on the left side of the page, under the Products and Services section, click Website Payments.
After that, click update website preferences.
Next, turn on Auto return.
Finally, turn on Payment data transfer, put the URL to your “Thank you page”, and save. You will see your identity token displayed on the screen. Copy and paste this in the “Paypal identity token” input box in your Paypal plugin setup page.
Finishing up The Setup
In the Invoice prefix section, type in your preferred prefix for your invoices. Using unique invoice prefixes is particularly needful if you are running more than one online store. A unique prefix could be something like this: “Business Shop”. Put in your business name in place of “Business”.
If you check the Shipping details checkbox, shipping details would be sent to your PayPal address, not billing address.
To prevent the address from being changed, check the Address override.
As for Payment action, you have two options: capture or authorize. If you chose to capture, payments from customers would be processed immediately without the need for verification. If you go for authorizing, payments will first have to be verified before being processed. As you may have guessed, the authorize option is heavily time-consuming.
The rest (Page style and Image URL) are optional.
To process refunds, you will have to set up your API credentials. Head over to PayPal’s website to learn how to generate API credentials.
When you have your API details, input them and click Save changes.
To ensure the set up is working properly, we need to run a test purchase. This is where PayPal’s sandbox becomes handy.
How to Run a Test Purchase with PayPal Sandbox Account
First, ensure that Sandbox is enabled in the WooCommerce Setting (WooCommerce >> Settings>> Payments). Save changes.
If you haven’t created a developer account (same as sandbox account) yet, follow the steps in the first section of this article to do so. Now log into the developer account you just created, go to the ‘Sandbox’ section on the developer menu (on the left) and click Accounts. Next, click Create Account.
What you would see next is this:
The country you chose doesn’t really matter. Select a Personal Buyer account. Type in an email (this is the email you would be using for the test purchase). For this tutorial, we shall be using “firstname.lastname@example.org”. Put in a password. You can fill in or leave out first and the last name.
In the payment section, type in any balance of your choice, select PayPal as Payment Card. Then click Create Account.
In your Sandbox dashboard, you should see the newly created account.
Now we’ve created a test buyer account, let’s test to see its working.
Head over to your online store and make a purchase. As usual, add a product to cart and proceed to checkout.
On the checkout page, fill in your normal billing details. Scroll down and click Proceed to PayPal. Just before the proceed button, you should see a dialog box telling you Sandbox is enabled.
Upon clicking the proceed button, you would be redirected to the sandbox account. Log in with the sandbox buyer email and password you had earlier created.
On the next page, accept terms and conditions. Finally, click Pay Now
That’s it! To be sure the order went through, log into your website, go to WooCommerce >> Orders. You should see the order you just processed.
Now we have tested and verified that our WooCommerce/PayPal setup is working properly, we can now disable PayPal Sandbox. By so doing real users will be able to purchase from your store.
Hopefully, you have learned how to integrate payment to your Woocommerce store. We did our best to make it as simple as possible, but if you missed something do get in touch.