Development / software

How to Integrate PayPal payment Gateway to your Website

Nov 29, 2016
1 Star2 Stars3 Stars4 Stars5 Stars
Loading...
4 (10 voices) 18 comments
Green shopping cart on the keyboard

Whether you are using a website to sell goods or services the choice of the right payment system may directly affect your conversion rates. Needless to say, that competition in the e-commerce sector is high and it is always a good idea to process customer’s payments through your own web page instead of relying on third-party applications and external services.

And that’s where payment system comes into play. Generally, it is used to deliver transaction information: receiver, amount, a method of payment, etc. There are plenty of online payment gateways nowadays.

The most popular payment systems that facilitate E-commerce are:

PayPal payment system logo     PayPal

Google Wallet payment gateway logo     Google Payments

Stripe Logo     Stripe

Dwolla Logo      Dwolla

Braintree Logo     Braintree

Amazon Payments Logo Amazon payments

PayPal Gateway stands out as most notable and widespread online payment system to your Website.

Thanks to its excellent security reputation PayPal has a massive consumer base. As for merchants the system offers easy setup process and requires a little technical knowledge to get started. This article covers key topics of PayPal integration and main APIs that are used for development.

 

Pros and Сons of Integrate PayPal Payment System

Advantages:

  • High transaction speed.
  • Secure – safe for users and protected by PayPal Purchase Protection.
  • Widespread – 200 countries, 26 currencies, 200 million users.
  • A wide variety of APIs and interaction methods to choose from.
  • Vast knowledge base – thanks to PayPal popularity there are tons of manuals, community threads, educational material, etc.
  • Trusted – loyal audience and excellent reputation. The system is well known for its safety and has already become a standard solution among e-commerce platforms.
  • There is an option to pay not only with a credit card but also using PayPal account.

Disadvantages:

  • No currency conversion option.
  • A wide range of APIs and methods makes it difficult to choose a suitable one.
  • PayPal Sandbox is a separate platform. That imposes some limitations and slightly lowers the interaction speed. Also, this may cause some discrepancies and issues at the stage of moving to production version.
  • There is a problem with IPN notifications reception and webhooks (especially in Sandbox version). However, there is always an option to resend notification from admin panel of PayPal.

 

Payment methods supported by PayPal Solutions

Express Checkout. Fast, no setup fees. Upon processing the payment from PayPal side, user is redirected back to our web application. This method is available only for users who already have a PayPal account.

Direct Payment. This API is used to accept credit card payments from customers who don’t have PayPal account. The method is a way to integrate transaction process into your website. Moreover, Direct Payment improves customer experience as it is easy to use and familiar to them.

Recurring payment. The subscription as it is. There are several APIs that can implement this method.

Mass Payment. It is used to split payment between multiple accounts.

 

Getting started

First, you need to sign up and provide PayPal with information about your product/service/company, in order to verify your “lawful alignment”. You can do this here.

You’ll receive an access key upon completion. Keep that key safe! It’s your id so that the service could recognize your app and its unique settings.

Get an API

On My Apps & Credentials tab (proceed from “introduction page”) click “Create App”. Select REST API. This is the most popular API for development, so we’ll use it as an example.

All necessary settings and authentication for API access are in SANDBOX API CREDENTIALS tab.

Sandbox Account

Configure settings from SANDBOX WEBHOOKS and SANDBOX APP SETTINGS, in case you continue working in a sandbox environment. Next, create a test user (SANDBOX – Accounts tab) in order to proceed with Sandbox.

NOTE: It takes several hours for settings to apply.

Log into sandbox.paypal.com (for SANDBOX) or paypal.com under main (owner) account. Go to profile settings > My selling tools tab and fill in all required fields.

NOTE: Don’t forget to set IPN notifications up and assign URL in Instant payment notifications.

Principles of communication between PayPal and user app

  1. The application makes a request. It is app’s responsibility to create a transaction and send it to PayPal via specific payment method or API.
  2. PayPal works with banks. If your transaction is processed and validated properly (otherwise you’ll get an error), PayPal will send a request to the bank.
  3. PayPal sends notifications (IPN). Whether bank accepts or denies the transaction, PayPal sends a notification to your app.
  4. Instant Payment Notification (IPN). The way PayPal notifies app about payment status. It goes to URL that you previously assigned in My selling tools tab.
  5. It’s your responsibility to create proper methods for the app to process IPNs.

 

APIs overview

PayPal supports two data transfer formats to send requests and respond. Both are made using HTTP protocol:

  • NVP (Name-Value Pair).
  • SOAP (Simple Object Access Protocol).

It is preferable to use NVP because of its flexibility. This article covers APIs and SDKs that goes with NVP format.

NOTE: It is not recommended to use SDK for PayPal development. Some methods may change over time, this could lead to potential failures.

Website Payments Standard API. This is the simplest way to make a payment. It allows paying by card or via PayPal account. The payment is processed from PayPal side after that customer is redirected back to your site’s confirmation page. In the best case scenario, you just need to send payment data using POST request.

NOTE: Although it is the easiest way to process PayPal payments, you can check the transaction status only by IPN.

Express checkout. This is the SDK used to process Express checkout payment method. It is used to pay via PayPal account.

NOTE: Express checkout available for Premier and Business members only.

Checkout flow:

  1. SDK makes an API call to get a token from PayPal and sends transaction details.
  2. If the token is granted, a customer will be directed to PayPal to select payment method and shipping address.
  3. The customer makes or denies the payment.
  4. PayPal returns customer to your site.
  5. API makes a call to retrieve transaction details.
  6. Customer completes an order.
  7. API makes a call to request payment status.
  8. PayPal makes the transaction and sends IPN, or you can check status manually through transaction history in your account.

Illustration of Express Chechout workflow

ADVICE: Don’t rely on PayPal’s IPN. There is always a chance that your server won’t be available during notification session. Use your own cron to check payment status.

Transaction status can be obtained in PayPal API by requesting “search for transactions for the period”. Exact methods of making such call you can find here.

 

Adaptive Payments. With the help of AdaptivePayments you can select the most suitable payment scenario. For example: to split payment between multiple peers. Learn more here.

Payflow. Payflow API SDK is used for direct payments. Direct payment refers to a payment made by credit card.

Variants of use:

  • Payflow Pro – is used with iframe. Form used to enter card data is generated from PayPal’s side. Your site is not involved during the input process. Therefore, Payflow Pro grants better security but makes it difficult to customize the application form.
  • Payflow Link – Similar to Payflow Pro.
  • Payflow – Opposite to Payflow Pro. The application form is displayed on merchant’s website. This method may concern your customers, as they need to input credit card information on your site, which may seem less secure than PayPal web page. The credit card data is transferred via HTTPS.
NOTE: Use HTTPS to secure data transfer.

img class=”alignnone size-full wp-image-5943″ src=”http://gbksoft.com/blog/wp-content/uploads/2016/11/shema.png” alt=”Illustration of Payflow API workflow” width=”900″ height=”510″ />

(Payflow API workflow)

IMPORTANT: Your website needs to be PCI-DSS certified (PCI PA-DSS certification for script libraries) in order to process users’ credit card information. Otherwise, it is recommended not to involve in customers data processing.

 

Payflow is almost similar to Express Checkout. The differences are in SDK and communication flow. Again, it is not recommended to rely on PayPal’s IPN.

Unlike Express Checkout, Payflow uses three Inquiry Actions:

  • to View the Status of Payments.
  • to View Recurring Transaction Details.
  • to View Optional Transaction Details.

Learn more here.

Mass Pay can be applied to consolidate multiple payments in a single transaction. This API is used for mass payments. It’s available only for users with PayPal account as it requires PayPal email address.

Checkout flow:

  1. PayPal API forms a transaction list and sends it to PayPal.
  2. The payment is pending until IPN notifications about all sub-transactions are received.
  3. If, for any reason, your server couldn’t receive IPN, you should manually enter PayPal account and resend it.

 

Difficulties in PayPal payment gateway integration

PayPal offers two IDEs:

  1. Production version – paypal.com.
  2. Test version –  sandbox.paypal.com.

The second one is used to test system operation without losing money on real transactions. Those two IDEs are different, thia can cause errors during transition to production version.

Pieces of Advice

  • Make sure IPN is turned on.
  • Stick to one type of methods.
  • Pay attention while setting up paypal.com or sandbox.paypal.com accounts.
  • Do not count on quick transaction processing, but make sure that you have permitted to accept payments inside your app settings. (You can find this option in Sandbox app settings/App feature options/Accept payments/on).
  • Do not rely heavily on PayPal documentation. Whilst it is mainly accurate, there might be outdated methods.
  • Recurring made via Express Checkout can’t be canceled while in “pending” status. It is better to inform users about this issue in advance.
  • There might be an issue when PayPal makes an error output to the customer. It’s better to hide those notifications, because they may contain private information.

Conclusion

Although PayPal is a powerful and multifunctional payment system, it is a vast and complex platform. This may cause difficulties during the development process and may require additional time for testing and waiting for transactions to pass. Finally, it is important to read the documentation before starting development. Good luck with the development and you are welcome to contact us if you need any help.

 

Alexandra

Alexandra is a Business Manager with solid experience in client communications, team management, product management. She’s driving force and soul of every project completed by GBKSOFT!

Other Articles of Alexandra

Comments (18)

Leave a comment
Close

Leave a Reply

Name field is required
Email field is required
Please enter comment

Kir
Jul 09, 2017 at 12:22 AM

Awesome post.

reply
jonathan
May 02, 2017 at 5:43 PM

Asking questions are genuinely nice thing if you are not understanding anything entirely,
however this post gives nice understanding even.

reply
puzzle
Apr 25, 2017 at 8:53 PM

Thank you for sharing your info. I really appreciate
your efforts and I am waiting for your further write ups thanks
once again.

reply
Beli Skin
Apr 09, 2017 at 7:09 PM

Thanks for sharing your info. I truly appreciate your efforts and I will be waiting for your further post thank you once
again.

reply
Melina
Apr 06, 2017 at 11:37 AM

Hi, just wanted to tell you, I liked this post.

It was inspiring. Keep on posting!

reply
Sal Mattos
Mar 03, 2017 at 11:06 PM

I’m truly enjoying the design and layout of your website. It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme? Exceptional work!

reply
Tony
Apr 14, 2017 at 11:58 AM
Sal Mattos,

Thnx a lot our designer very appreciate your comment!)

reply

tawan
Feb 23, 2017 at 10:00 PM

I have been browsing online more than 3 hours today, yet I never found any interesting article like yours.
It is pretty worth enough for me. In my view,
if all web owners and bloggers made good content as you did, the web will be
much more useful than ever before.

reply
tom broadhurst
Feb 21, 2017 at 1:25 PM

Excellent blog you’ve got here.. It’s hard to find excellent writing like yours these days.
I truly appreciate individuals like you! Take care!!

reply
shastamil tenberger
Feb 20, 2017 at 8:48 PM

Hi! This post could not be written any better! Reading through this post
reminds me of my old room mate! He always kept chatting about this.

I will forward this page to him. Fairly certain he will have a good read.
Many thanks for sharing!

reply
williams cozart
Feb 17, 2017 at 7:20 PM

I like it when folks come together and share opinions.

Great blog, continue the good work!

reply

Similar Blog Articles

Drag and Drop Files to browser

Development

How does Web Apps work with Local Files Through the Browser?

Few will argue that working with files through browser window is one of the must-have things for any modern office web app. At times when many of us prefer work remotely the ability to work through the web becomes vital for any business entity. Some of them have already decentralized their corporate structure but require...

Rating — 5 (3 voices)
smart speakers

Business

Top Intelligent Assistants App Ideas for Smart Speakers

Smart Speakers may always be a niche market if there wasn’t such a harsh competition between three tech giant: Amazon, Google, and Apple. Each company has its own smart speaker powered by intelligent assistant and voice control system. Each of them eager to monetize on their techs. However smart speakers are just a tip of...

Rating — 5 (1 voice)

Development

Bugs not found. How to get from Quality Control to Quality Assurance

The first thing that comes to mind when you think about website testing is a glitch or broken design element. However, testing is a crucial phase that should be applied to each and every stage of web development process. In fact, QA and QC in software testing can help you to distinguish professionals from amateurs.  

Rating — 5 (5 voices)

Categories

All articles Business Company News Development Marketing StartUp App Ideas UI and Design

TELL US ABOUT YOUR PROJECT

We’ll estimate your project and give first advices within 24 hours!

Name field is required
Email field is required