1. Checkout APIs
Salla Platform Docs
  • Overview
  • Authentication
  • Key Concepts
  • Usage Flows
  • Cart
    • Save guest cart data
      POST
    • Generate cart
      POST
    • Get cart
      GET
    • Assign cart to Customer
      POST
    • Apply cart coupon
      POST
    • Remove cart coupon
      DELETE
  • Cart Items
    • Add cart item
      POST
    • Update cart item
      PATCH
    • Delete cart item
      DELETE
  • Schemas
    • SuccessEnvelope
    • GuestDataRequest
    • GuestData
    • Error
    • Money
    • CartTotals
    • TotalLineItem
    • CartItem
    • AssignShippingRequest
    • CartItemsRequest
    • ProductIdentifier
    • CartItemEntry
    • RemoveItemsRequest
    • BadRequest
    • Unauthorized
    • Forbidden
    • NotFound
    • ValidationError
    • Currency
    • AmountLine
    • CartScope
    • CartFeatures
    • CartAmounts
    • CartDiscountEntry
    • CartOptionEntry
    • Cart
    • CartShipping
    • CartItemCreateRequest
    • CartItemUpdateRequest
    • ApplyCouponRequest
    • ErrorEnvelope
    • CartItemOptionInput
    • ErrorObject
    • GenerateCartRequest
Merchant
Merchant
  • Merchant API
  • Embedded SDK
  • Salla OAuth 2.0
Storefront
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Component Bundle
  • Checkout APIs
  • Change Log
App Functions
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • Billing System Salla partners
  • Communication Apps
Dev Tools
Dev Tools
  • Partners Agent Kit
  • Salla Apps Playbook
  • Salla CLI
Merchant
Merchant
  • Merchant API
  • Embedded SDK
  • Salla OAuth 2.0
Storefront
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Component Bundle
  • Checkout APIs
  • Change Log
App Functions
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • Billing System Salla partners
  • Communication Apps
Dev Tools
Dev Tools
  • Partners Agent Kit
  • Salla Apps Playbook
  • Salla CLI
Salla - Opensource
Salla - Developers Community
  1. Checkout APIs

Key Concepts

image.png

Key Concepts#

Checkout URL#

Every successful cart response includes:
id
checkout_url
Use checkout_url to redirect the customer to hosted checkout when the cart is ready.
{
  "id": "abc123",
  "checkout_url": "https://salla.sa/store/checkout/abc123"
}

Flexible Product Identification (Add Item)#

When adding an item, products can be referenced using:
TypeDescriptionBest for
idInternal product IDDirect catalog references
variant_idSpecific variant IDVariant-first integrations
skuStock Keeping UnitInventory/SKU-driven systems
Request body fields:
identifier_type
identifier
quantity
optional: options, notes, amount, bundle

Item Mutation Model (Current V2)#

The current implementation uses route item IDs for update/delete:
Add: POST /v2/checkout/{cart}/items (identifier-based payload)
Update: PATCH /v2/checkout/{cart}/items/{item} (item id in path)
Delete: DELETE /v2/checkout/{cart}/items/{item} (item id in path)
{item} must belong to {cart}; otherwise a 404 not_found response is returned.

Cart Response Structure#

Cart payload is returned in successful operations and includes:
SectionDescription
Identityid, store_id, checkout_url
Countcount
Currencycurrency.label, currency.code
Scopestore scope context (scope.id, scope.type) or null
Amountsamounts map (for example subtotal/discount/tax/total/offers when applicable)
Shippingshipping.requires_shipping
Couponcurrent coupon code or null
Featurescoupon, gift, loyalty, guest_checkout flags
Discountsnormalized discounts map (coupon, offers, bundle, loyalty_prize when available)
Settingsfeature-dependent settings (for example gift settings)
Optionscart-level order options
Itemsincluded only when requested via query

Items Inclusion#

By default, line items are omitted.
Use:
include_items=true

Ownership and Assignment#

V2 carts are created in guest context and can later be assigned to an authenticated user.
Ownership is represented by the cart's customer assignment state
Current behavior:
1.
Generate cart (POST /v2/checkout/generate)
2.
Cart operates in guest context (internally uses guest customer semantics)
3.
Assign via POST /v2/checkout/{cart}/assign (requires JWT auth)
4.
The cart transitions from guest ownership to authenticated customer ownership
Assignment is blocked (403) when the cart is already assigned to a non-guest customer.

Scope Context (Store Context)#

scope describes store operational context (for example scope/location context used for product availability, pricing, and checkout validation), independent from customer ownership.
scope is returned as:
{
  "scope": {
    "id": "scope_123",
    "type": "Scope"
  }
}
When no store scope is active, scope can be null.

Authentication Model#

Store-Identifier is required for all requests.
Guest flow can use optional auth middleware.
Assign endpoint requires JWT authentication:
POST /v2/checkout/{cart}/assign

Error Envelope#

Errors follow a consistent envelope:
{
  "status": 422,
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "Validation failed",
    "fields": {
      "quantity": [
        "The quantity must be at least 1."
      ]
    }
  }
}
Common status outcomes across cart operations:
400 bad request (for example invalid coupon)
401 unauthorized (missing/invalid token on protected operations)
403 forbidden (assignment/access constraints)
404 not found (cart/item/product/identifier resolution failures)
422 validation or business-rule failure
Treat status codes as operation-specific outcomes; exact behavior depends on endpoint and action path.
Modified at 2026-07-29 11:46:05
Previous
Authentication
Next
Usage Flows