When Laravel Cashier will not help you

Laravel‘s official Cashier package is great for handling credit card payments and generate accompanying invoices. I love it.

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?

Meet Mollie

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:

  1. Let the customer make the payment
  2. Process the payment in your app
  3. 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.

Create your first Laravel package

Laravel package development from scratch

Learning Laravel package development doesn't have to be hard. If you know how to create a basic Laravel app, you can write packages as well.

I've opened this course up for free to the first 100 subscribers only.

Join now and get the first lesson in your inbox right away.

We won't send you spam. Unsubscribe at any time. Powered by ConvertKit

5 Replies to “When Laravel Cashier will not help you”

    1. Hi Falko,

      Thanks for pointing that out. I have been keeping an eye out on these developments as well, but so far it has not been of any use to me. That’s a pity, because implementing custom billing processes is a chore.

      I’m assuming you are talking about recurring payments (a.k.a. subscriptions) here. For one-off payments, the Laraval Cashier docs suggest to look for another solution.

      About the Stripe support
      Stripe indeed now offers iDeal and SEPA support. I quote from the Stripe support docs:

      iDEAL sources are single-use and can only be used to create a payment once. To support recurring payments, you can make use of a modified SEPA Direct Debit flow that allows you to create further payments. After first creating a successful payment with iDEAL, the source is then used to create a new SEPA Direct Debit source. This is used to perform subsequent charge requests without each payment needing to be authorized by the customer.

      Within the scope of Sources, SEPA Direct Debit is a pull-based, reusable and asynchronous method of payment. This means that you take action to debit the amount from the customer’s account. It can take up to 14 business days to confirm the success or failure of a payment.

      Before you can accept SEPA Direct Debit payments, your Stripe account needs to have regularly processed card payments for 60-75 days. If you would like to discuss starting sooner, please get in touch.

      By the way, the Mollie gateway offers a similar “iDeal + SEPA = subscription” approach at cheaper rates. And as it seems without the “60-75 days” requirement. I am currently building a custom Mollie solution with the mandate payment amount set to the first subscription amount, so the customer does not experience a separate “mandate payment”. I have yet to see that it works in production.

      About the Laravel Cashier support
      The Laravel Cashier repo tells me (#504, #582) that these new payment methods are not supported yet. Bummer.

      Given the fact that the subscription flow for iDeal subscriptions are really different from creditcard subscriptions, I don’t expect it to happen soon. The “up to 14 days” of processing also is very different from creditcard processing. But who knows?

      Like Cashier, I am hoping Laravel Spark will be supporting recurring iDeal/SEPA payments one day. But today, that’s not the case. Let met know if you find another solution.

      – Sander

Leave a Reply

Your email address will not be published. Required fields are marked *