But what if you need to implement other payment methods than credit cards?
It took me a few projects (months…) to figure this one out, now let me save you the effort and share it with you.
The Dutch: funny people
In The Netherlands, the majority of the customers prefer to pay online using iDeal.
iDeal is a well-designed secure payment process which requires the customer to use a debit card, its PIN and usually a special hardware token. (So it basically is a 2-factor authentication method.)
In terms of usability and conversion rates it comes down to supporting what your customers prefer to pay with.
Like it or hate it, iDeal is simply the most trusted online payment method in The Netherlands.
Laravel Cashier does not support iDeal. So bye bye Cashier!
So what is a nice payment gateway supporting iDeal?
For projects targeting The Netherlands, I integrate Mollie‘s payment gateway.
Mollie redirects the customer to a highly optimised payment page, offering a multitude of payment methods including iDeal and credit cards. After payment a) the customer is redirected to a URL of your choice and b) a configurable webhook is called to notify you of any payment status updates.
Like other major payment providers it offers helpful integration libraries, extensive documentation, a rich API, a testing mode, the necessary payment handling tools (i.e. refunds) and a nice dashboard to keep an eye on your revenue. Support for recurring payments has been added recently.
Oh, and the pricing is competitive for sure.
Integrating Mollie into your Laravel application
Supporting iDeal payments with Mollie is actually quite easy. You can take several routes.
You could call the Mollie API directly (i.e. using GuzzleHttp). Probably not the best idea as it is cumbersome and error-prone to implement.
Or you could use one of the existing packages:
HOWEVER, this only will help you let the customer complete the payment. After that it gets a bit messy. So what comes next, after the customer has paid?
You will need a way to process the payment. Make sure your application gets notified of payment status updates and generate invoices.
After implementing and testing this in a few projects, I have decided to start packaging the whole Mollie payment process functionality and share it with you. Stay tuned for next blog posts.
Extending Cashier to support Mollie is not an option
Cashier is great because it supports all three requirements discussed above:
- Let the customer make the payment
- Process the payment in your app
- Create an invoice
So it would be great if we could simply swap out the payment gateway and benefit from the other functionality.
After analyzing the Cashier code, extending Cashier to support iDeal unfortunately appears to be a no-go. The package code is strongly tied to (initially) the Stripe and (later) the BrainTree payment gateways. It is not engineered (yet) to support other gateways in the future. It also surprised me that the invoice generator is not covered by a more generic interface.
Stripe and BrainTree allow the customer to pay without leaving the merchant website using a payment token under the hood. iDeal requires the customer to pay using a redirect. This significant difference in the payment process (token vs redirect) is another reason why it will be very hard to implement iDeal into Cashier.
And how about Laravel Spark?
When it comes to supporting other payment gateways, Laravel Spark suffers from the same issues as Laravel Cashier does, because it is based on / architected the same way as Laravel Cashier.
Therefore I use Cashier and Spark only for projects targeting a highly international customer base.
So what should you do?
What will be the best Laravel payment and invoice solution for your project depends on what payment method the customers prefer. For credit card payments, be sure to check out Laravel Cashier. It will fulfil most projects’ requirements.
If you need to support iDeal, go with Mollie and one of the packages described above. And be sure to stay tuned for my next blog posts, as I am launching some packages to help further integrating Mollie payments and invoicing in Laravel apps.