SumUp
SumUp has no hosted checkout thus their JS library is used as described below.
Using the provider
site/config/config.php
<?php
return [
'bnomei.kart.provider' => 'sumup',
// other options
];
API Credentials
.env
SUMUP_SECRET_KEY=ZZZ
SUMUP_SECRET_KEY=XXX
SUMUP_MERCHANT_CODE=MMMMMM
SumUp Checkout JS
site/templates/payment.php
<?php snippet('kart/sumup-checkout') ?>
<?php // or create a custom version based on the snippet ?>
<script>
...
</script>
Customers
The SumUp customer API is designed for managing subscriptions. While it is technically possible to link a customer to a shopping cart checkout, I believe that this linkage will not be visible in the SumUp dashboard. However, you can store customer data within the orders created by Kart in Kirby. To make that possible, you need to...
a) manually set the customer data during your checkout flow to the current session
<?php
kirby()->session()->set('bnomei.kart.sumup.customer', [
'email' => $email,
'name' => $name,
]);
Or b) forward the form fields within the checkout form of Kart
<p><strong><?= kart()->cart()->formattedSubtotal() ?> +tax</strong></p>
<form method="POST" action="<?= kart()->urls()->cart_checkout() ?>">
<?php // TODO: You should add an invisible CAPTCHA here, like...?>
<?php // snippet('kart/turnstile-form')?>
<input type="hidden" name="redirect" value="<?= $page?->url() ?>">
<!-- forwarding data to customer creation -->
<input type="text" name="name">
<input type="email" name="email">
<button type="submit" onclick="this.disabled=true;this.form.submit();" <?= kart()->cart()->canCheckout() === false ? 'disabled' : '' ?>>Checkout</button>
</form>
Read more about the Kart checkout form here.