# Square

Source: https://kart.bnomei.com/docs/providers/square
Updated: 2025-08-08T14:21:11+00:00
Summary: Alpha Square provider for Bnomei Kart plugin: configure in site/config/config.php, set SQUARE_ACCESS_TOKEN, LOCATION_ID (.env), customize checkout via callbacks

> \[ALPHA\] This provider for Square is in alpha stage. It can not sync products, variants yet nor has it been tested a lot. Use at your own risk. Any feedback is very welcome.

## Using the provider

Path: site/config/config.php  
Code (php):  
```
<?php

return [
   'bnomei.kart.provider' => 'square',
   // other options
];
```

  
## API Credentials

You can create the `ACCESS_TOKEN` within the [Square developer dashboard](https://developer.squareup.com/docs/build-basics/access-tokens). Be sure to start out with using the Sandbox token and set the production one only when going live. You need to provide the credentials for `LOCATION_ID` and optionally the `API_VERSION` as config values or via an `.env` file ([plugin](https://github.com/bnomei/kirby3-dotenv)).

Path: .env  
Code (plaintext):  
```
SQUARE_ACCESS_TOKEN=XXX
SQUARE_LOCATION_ID=ZZZ
# SQUARE_API_VERSION=
```

  
## Customzing the Checkout

You can use callbacks to customise both the checkout process and each line item. The returned arrays from your callbacks will be merged with the defaults created by the plugin for this provider, allowing you to override those defaults. Check the relevant PHP class and the linked online documentation for the provider to learn more about the expected data structure.

Code (php):  
```
<?php

return [
    'bnomei.kart.providers.square.checkout_options' => function (\Bnomei\Kart\Kart $kart) {
        // configure the checkout based on current kart instance
        // https://developer.squareup.com/reference/square/checkout-api/create-payment-link
        return [];
    },
    'bnomei.kart.providers.square.checkout_line' => function (\Bnomei\Kart\Kart $kart, \Bnomei\Kart\CartLine $line) {
        // add custom data to the current checkout line
        // https://developer.squareup.com/docs/orders-api/create-orders#create-an-ad-hoc-line-item
        return [];
    },
    // other options
];
```

  