Get a Free Quote

How to Enable Payments in a Laravel-based Store

June 27, 2018 Written by Aliaksandra Makarevich, Content Manager
eCommerce websites have learnt how to leverage Laravel’s modular structure, flexibility and convenience of coding, and a constantly growing number of Laravel-based e-shops proves it. Simple integration with 3rd-party solutions, including, first of all, payment gateways, is adding to this technology expansion.

Integrating a Payment Gateway with Laravel: Whats & Hows

Payment Gateway Principle of Work

Payment gateways are all based upon the same principle. It is a software service that acts as an intermediary between the merchant and the shopper for receiving the submitted payment details from the shopper, sending them to the merchant’s acquiring bank, getting the authorization and forwarding it back to the website. Hosted payment gateways, which redirect a customer to an external webpage for filling in their payment details and validate a purchase, after which they get back to the e-shop website, remain the most popular and cost-efficient solution for eCommerce websites. The most well-known representatives of this group are: PayPal, BrainTree and Stripe.  

Using Libraries for Integrating a Payment Gateway

Integrating a payment gateway into an e-shop passes with the use of libraries. These tools completely take control over the operations that are carried out during transactions and, as a consequence, make supporting and maintaining of the software much easier. In addition, using these libraries rids a merchant of the need to purchase a PCI certificate, as it is already guaranteed.

How Payment Gateway Integration with Laravel is Passing

With Laravel a merchant has two ways to provide their website with a payment gateway.
  • Use an official library provided by a payment system vendor

Most of the payment gateway providers supply developers with software development kits (SDK) for connecting their systems to the existing website functionality. Such SDKs contain libraries for different types of applications and programming languages. Paypal, Stripe, AliPay (China), Amazon Pay and others provide libraries for PHP as well. But payment-processing packages written in plain PHP still need to be adapted and customized for a Laravel-based website. As a result, it requires more work and time from the technical team. In some cases, when accomplished not effectively, the system’s stability can be affected.
  • Use a library developed by Laravel contributors

Laravel provides a number of libraries for facilitating the installation of a payment gateway into a website - Laravel Spark, LaraMill, PhoenixBill - but the most renown among them is Laravel Cashier. Laravel Cashier is promoted as a solution developed by Laravel developers and for Laravel developers. For example, at R-Style Lab our Laravel developers use Laravel Cashier to benefit from a ready-made billing code for adapting a universal payment gateway to the Laravel environment.
However, it has two essential limitations:
  • Subscription management. Laravel Cashier’s official documentation underlines that the package is a good solution for managing subscription type of payment but not one-time payments. This tool provides a comprehensive and tested logic for managing subscriptions, coupons and other issues associated with regular payments. It becomes excessive for ‘one-off’ payments, and in this case it gets easier to use Stripe or BrainTree API directly.
  • Limited number of gateways. So far the functionality of Laravel Cashier is limited to Stripe and BrainTree.

Stripe Vs. PayPal Competition in Laravel’s Reality

The most popular payment system solutions on the market and the key rivals are Stripe and PayPal. They co-influence each other, thus proving again that consumers benefit from competition.

Stripe: Perfect Solution for All Types of Payment

Stripe is an online payment gateway which is probably most preferred by developers today, as it covers all the background processes, leaving a customer with a seamless and intuitive checkout experience. It is also highly appreciated by merchants for its ability to accept different types of payments.

The strong points of Stripe are:

  • Developer friendliness. One of the mottos of Stripe is ‘Developers First’. It provides an open API (so that it gets easy to integrate it and make necessary changes), thorough materials on it and good support. This combination quickly attracted programmers and merchants: now there are around 500k websites using Stripe.
  • Working with multiple payment methods. It accepts not only major credit and debit cards, but also Bitcoins, Amazon Pay and Android Pay and many other types of payment.
  • Payment processing in 135+ currencies. Charges can be created in any of them, thus adjusting a pricing model to any geographical area. Plus, Stripe automatically converts foreign currency into the shopper’s accounts currency and charges a 2% fee atop market exchange rates.
  • Transparent pricing schemes. It starts with a $2 fee per account and continues with additional fees: a fixed fee for each transaction, for payouts, for account debits, a 0,25% charge on all account volume, etc.
  • A wide range of additional business services. The most renown are: -   Stripe Atlas, a tool for online entrepreneurs, which allows a company, even if it is located outside the US, to establish a US business and get a digital US bank account. So far it looks like one of the easiest ways to open a business in US, for a flat fee of $500; -   Stripe Sigma, a tool for data tracking and analysis and for getting custom reports; -   Stripe Radar, a mechanism for fraud fighting which is based upon machine learning and thus quickly adapting its protection mechanisms to changing fraud patterns.

But before opting for Stripe, the merchant should keep in mind its limitations.

  • Stripe’s presence on the world’s market is limited. At the time of writing it functions in 25 countries. If a business is located in one of these countries and implements Stripe, then it can accept payments from anywhere in the world.
The Stripe company is trying to overcome this limitation by providing the Stripe Atlas services, which facilitates the incorporation of a foreign company in the US and makes it a Stripe client.

PayPal: A Truly International Solution

Paypal is a full payment platform which has made digital payment processes mainstream. In 2016 75% of TSYS respondents admitted having a PayPal account as a payment type, additional to credit and debit cards. Therefore, it would be wise for online merchants to provide a possibility for their customers to make a PayPal payment option.

Its key advantages include:

  • Clean and well documented API. The appearance of Stripe on the market back in 2011 seriously influenced bulky coding of the existing payment systems of the moment, including PayPal. Now PayPal boasts an improved and consistent API in order not to lose its position to the key competitor.
  • Global coverage. Unlike Stripe, PayPal is present on more than 200 markets. Besides, it operates in more than 100 currencies.
  • The power of brand. It also adds to the PayPal's popularity among online shoppers. When sending sensitive financial data to a website, they need to be assured that this information will be secured, and PayPal looks like a trustworthy partner for more than 227 million customers.

However, its usage can be limited in one case.

Laravel Cashier doesn’t support PayPal integration, thus pushing developers to work with PayPal’s native PHP library and customize it. With a ‘one-off’ payment type this limitation doesn’t pose a problem, but if a merchant uses a subscription type of payment for his business, then his developers will spend a number of hours for developing the solution. Nonetheless, the simplest way to overcome this limitation is to go for Braintree, a division of PayPal, which provides a payment solution for mobile and web eCommerce applications and accepts PayPal payments along with credit cards. Laravel Cashier's functionality covers Braintree and thus facilitates its integration and further performance.
Such robust payment systems like Stripe, PayPal, and Braintree, when integrated into a Laravel based website, provide for a pleasant customer checkout experience. The whole integration process is quite simple and hassle-free, once again proving the flexibility and scalability of Laravel, especially when it passes with additional helping tools like Laravel Cashier.

Popular Posts

Subscribe Now

We get into the groove, sharing what we've learnt in the real-life context with the like-minded folks.
Subscribe to get the latest insights from us!

Please, enter a valid name
Please, enter a valid email address