Hygglig Checkout
Checkout API
Create, retrieve, and update hosted Hygglig Checkout sessions from your merchant checkout.
receive html_snippet
checkout page
query parameter
order_number
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();
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;
Retrieve checkout by order number
Use GET /api/checkout?order_number={order_number} to retrieve an existing checkout by OCR-formatted order number.
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.
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.