Skip to main content

Initialize a Checkout session

Initialize a Checkout session by making a POST request to the checkout backend API endpoint. This returns a public token for rendering the Checkout iframe and a private ID for retrieving checkout information.

Before you start

You need API credentials from Merchant Hub. Call this endpoint from your backend only. If you initialize a session from client-side code, customers can read your credentials.

Explore all features

This guide covers the basic steps to initialize a checkout session. For every available property, optional configuration and advanced use case, see Advanced initialization.

Quick start​

Basic example to get started:

POST /checkouts HTTP/1.1
Host: api.uat.walleydev.com
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
Content-Type: application/json

{
"storeId": 123,
"countryCode": "SE",
"merchantTermsUri": "https://example.com/terms",
"notificationUri": "https://example.com/notifications",
"cart": {
"items": [
{
"id": "10001",
"description": "Product Name",
"unitPrice": 100.0,
"quantity": 1,
"vat": 25.0
}
]
}
}

Request properties​

Request headers​

HeaderRequiredDescription
AuthorizationYesBearer token for authentication. See Authorization
Content-TypeYesMust be application/json

Request body​

PropertyRequiredTypeDescription
storeIdNo *numberYour unique store identifier
countryCodeYesstringMarket code: SE, NO, FI, DK, DE, NL, or EU
merchantTermsUriYesstringURL to your terms and conditions page. Must be https.
notificationUriYesstringEndpoint for purchase notifications. Must be https.
cartYesobjectShopping cart with items. See Cart Object

* Only needed when countryCode and salesSegment do not identify a single store. The examples above send it because it always resolves on its own. See Selecting a store.

Production vs UAT
  • UAT: https://api.uat.walleydev.com/checkouts
  • Production: https://api.walleypay.com/checkouts

See Endpoints for the complete list.


Cart object​

The cart must contain at least one item with these required properties:

PropertyRequiredTypeDescription
idYesstringUnique item identifier
descriptionYesstringProduct name/description
unitPriceYesdecimalPrice per unit (including VAT)
quantityYesintegerNumber of items
vatYesdecimalVAT percentage (e.g., 25.0 for 25%)
Cart Validation

The cart cannot consist entirely of items with negative unitPrice values. At least one item in the cart must have a non-negative unit price.

Cart example​

{
"cart": {
"items": [
{
"id": "product-123",
"description": "Premium Widget",
"unitPrice": 299.0,
"quantity": 2,
"vat": 25.0
}
]
}
}

Response​

A successful response returns all five properties below in the data object, alongside the top-level id and a null error.

PropertyExplanation
publicTokenRenders the Checkout iframe. Valid for 168 hours (7 days).
privateIdIdentifies the session in every backend call. Use it to acquire information for up to 90 days after the session was created, and to update the session until it completes or expiresAt passes.
expiresAtWhen the session expires. After this timestamp the customer cannot complete the purchase and you cannot update the cart, so initialize a new session.
paymentUriA shortcut link to this session, used when distributing a Pay Link.
paymentQrCodeUriA QR code image of paymentUri. The URL needs no authentication, so you can embed it directly.

For the callback, prefill, custom field and URI templating properties, see Advanced initialization.