Kirby

The default

The kirby_cms provider is the default for the Kirby Kart plugin. It will work on localhost and can easily be swapped out with a single config value and given secret environment variables for other, cloud-based providers.

site/config/config.php
<?php

return [
   // 'bnomei.kart.provider' => 'kirby_cms', // DEFAULT
   // other options
];

Why products from the cloud?

One of the key features of the Kart plugin is that your products can be stored and managed on a third-party service like Stripe or Paddle. The necessary information for purchasing, such as the product ID, title and price, is synced into the CMS. This setup allows the checkout process to link products to orders within the payment service, enabling automated tax calculation, email sending, hosted invoices, and improved analysis/reporting. When using providers that support products and hosted checkout, the interface that the Kart plugin has to provide can be kept slim and reliable.

Inside Kirby CMS, you enhance the synced products with images, downloadable files or additional texts just like you can do with any other page blueprint in Kirby.

While I would advise you to use a cloud service, maybe you do not want that for one reason or another. For example, you may want to store the products only in Kirby or build a custom payment view or even a complete payment flow. You could even skip the payment if that makes sense for your project.

Meet the "Kirby" provider

Template: Payment

The Kart plugins only allow you to use products from within Kirby itself with the default bnomei.kart.provider = kirby_cms, just like in the localhost demo, the online demo or the Kerbs theme preview.
No externally hosted checkout is used in these.

They use a copied and modified version of the templates/payment prefab, which is a regular Kirby CMS template where you can set up whatever payment view you want.

A simplified version looks like this:

site/templates/payment.php
<main>
    <nav>
        <a href="<?= \Bnomei\Kart\Router::get('cancel_url') ?>">Back</a>
    </nav>

    <h1>Fake Payment Provider</h1>

    <form method="POST" action="<?= \Bnomei\Kart\Router::get('success_url') ?>">
        <?php // TODO: You should add an invisible CAPTCHA here, like...?>
        <?php // snippet('kart/turnstile-form')?>
        <label>
            <input type="email" name="email" 
                   placeholder="E-Mail (provide for account creation)"
                   autocomplete="email"
                   value="<?= kirby()->user()?->email() ?>"
                   <?= kirby()->user() ? 'readonly' : '' ?>
            />
        </label>
        <button type="submit" onclick="this.disabled=true;this.form.submit();">Pay</button>
    </form>
</main>

Class: \Bnomei\Kart\Provider\Kirby

You can also extend the default provider if you need to change its behaviour.

  • Create a new PHP class extending from \Bnomei\Kart\Provider\Kirby
  • Make sure your class is loaded before the Kirby config gets parsed, using a composer PSR-4 or files loading based setup
  • Register your class as a provider by setting the class name in the config bnomei.kart.provider = MyProvider::class
Kirby Kart is not affiliated with the developers of Kirby CMS. We are merely standing on the shoulder of giants.
© 2025 Bruno Meilick All rights reserved.