Hygglig Checkout

Checkout API

Create, retrieve, and update hosted Hygglig Checkout sessions from your merchant checkout.

Create checkoutPOST /api/checkout,
receive html_snippet
Render checkoutEmbed html_snippet on your
checkout page
Get checkoutGET with order_number
query parameter
Update checkoutPATCH by
order_number
1

Create checkout

Use POST /api/checkout to create a checkout session for an order. The response includes html_snippet, which is the embeddable checkout UI rendered on the merchant checkout page.

const creds = btoa(`${merchantId}:${secret}`); const res = await fetch('https://sb-checkout.hygglig.com/api/checkout', { method: 'POST', headers: { 'Authorization': `Basic ${creds}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ order_reference, currency, articles, success_url, checkout_url, push_notification_url, terms_url }) }); const { html_snippet } = await res.json();
2

Render the checkout iframe

Render the returned html_snippet inside your checkout page. The snippet is the bridge between your merchant checkout and the hosted Hygglig Checkout experience.

document.getElementById('checkout').innerHTML = html_snippet;
3

Retrieve checkout by order number

Use GET /api/checkout?order_number={order_number} to retrieve an existing checkout by OCR-formatted order number.

4

Update checkout before completion

Use PATCH /api/checkout/{order_number} to update an existing checkout before it is completed. The request body uses the same checkout request shape as create checkout.

5

Important data rules

The Checkout Integration contract uses scaled article values. Article price is scaled by 100, quantity is scaled by 100, and VAT is sent in basis points, for example 2500 for 25% VAT.

Need schemas and status codes?

Open the full Checkout Integration API documentation for request fields, response fields, examples, parameters, and status codes.

View API documentation