Replacing Checkout (Client-Side)
Use this approach when you want to redirect shoppers to Simpler Checkout directly from your frontend — for example, when they click "Proceed to Checkout" in your cart page. No backend code is required.
If you need server-side control over the cart data before redirecting, see Replacing Checkout (Server-Side) instead.
No Authentication Required
This redirect does not require any authentication headers or secrets. You only need your App ID.
Overview
The flow has two steps:
- Build a checkout URL containing the shopper's cart data as query parameters.
- Redirect the shopper's browser to that URL.
After the redirect, the shopper lands on the Simpler Checkout page where they complete their purchase. Simpler will then call your Platform Interface APIs to price the cart, resolve shipping, and submit the order.
URL Structure
https://checkout.simpler.so/?app=<APP_ID>&prd=<ENCODED_PRODUCT_DATA>&cur=<CURRENCY>&lang=<LANGUAGE>
URL Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
app | string | Yes | Your Simpler Store App ID. |
prd | string | Yes | URL-encoded JSON array of cart items. See below. |
cur | string | Yes | ISO 4217 currency code (EUR, USD, GBP). |
lang | string | Yes | IETF language tag per RFC 5646 (e.g. en, el, fr). |
prd Item Schema
Each item in the prd JSON array has the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Product identifier as used in your Platform Interface product catalog. |
qty | integer | Yes | Number of units. |
attrs | object | No | Key-value pairs that identify a specific product variant (e.g. {"color": "blue", "size": "L"}). |
PHP Example
function build_checkout_url($cart, $app_id, $currency_iso, $language_iso, $endpoint = 'https://checkout.simpler.so/') {
if (!$cart || empty($cart['items'])) {
error_log('Cart is empty or not available.');
return '';
}
$products_array = [];
foreach ($cart['items'] as $item) {
$product_data = [
'id' => (string)$item['id'],
'qty' => (int)$item['quantity'],
];
if (!empty($item['attributes'])) {
$product_data['attrs'] = (object)$item['attributes'];
}
$products_array[] = $product_data;
}
$products_string = urlencode(json_encode($products_array));
return $endpoint .
'?app=' . $app_id .
'&prd=' . $products_string .
'&cur=' . $currency_iso .
'&lang=' . $language_iso;
}
Usage
$cart = [
'items' => [
[
'id' => 123,
'quantity' => 1,
'attributes' => [
'color' => 'blue',
'size' => 'L'
]
],
[
'id' => 456,
'quantity' => 2,
'attributes' => []
]
]
];
$app_id = '550e8400-e29b-41d4-a716-446655440000';
$checkout_url = build_checkout_url($cart, $app_id, 'EUR', 'el');
header("Location: $checkout_url");
exit;