Table of Contents
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.
Generally, the payment system 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 & SaaS are:
Amazon payments (Amazon Pay)
PayPal Gateway stands out as the 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 payment integration and main APIs that are used for development.
Want to know what other APIs can help you scale your business? Find the list of top APIs for business in this article.
Pros and Cons 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) 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
- 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.
- 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.
- PayPal sends notifications (IPN). Whether bank accepts or denies the transaction, PayPal sends a notification to your app.
- Instant Payment Notification (IPN) tab.
- 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:
- SDK makes an API call to get a token from PayPal and sends transaction details.
- If the token is granted, a customer will be directed to PayPal to select payment method and shipping address.
- The customer makes or denies the payment.
- PayPal returns customer to your site.
- API makes a call to retrieve transaction details.
- Customer completes an order.
- API makes a call to request payment status.
- PayPal makes the transaction and sends IPN, or you can check status manually through transaction history in your account.
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 Adaptive Payments API 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.
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:
- PayPal API forms a transaction list and sends it to PayPal.
- The payment is pending until IPN notifications about all sub-transactions are received.
- 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:
- Production version – paypal.com.
- 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, this can cause errors during transition to production version.
Pieces of Advice for PayPal website integration
- 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 the development. Good luck with the development and you are welcome to contact us if you need any help.