npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

craft-commerce-headless-sdk

v2.0.2

Published

Craft Commerce Headless SDK provides tools to integrate Craft Commerce in headless environments, focusing on building API-driven checkout experiences.

Downloads

79

Readme

Craft Commerce Headless SDK Documentation Index

This SDK is designed to simplify integration with Craft Commerce, offering specialized modules for users, carts, payments, subscriptions, and more. Whether you're building a headless e-commerce application or enhancing an existing Craft Commerce setup, this guide will help you navigate and implement the SDK effectively.

Note: Craft Commerce version 4 or higher is required for compatibility with this SDK.


Table of Contents

  1. Demo and Local Testing
  2. Craft CMS Configuration Guide
  3. Package Installation
  4. Client Module
  5. Users Module
  6. Cart Module
  7. Payment Sources Module
  8. Payment Module
  9. Subscriptions Module
  10. Suggestions for Craft CMS Improvements

Demo and Local Testing

You can see a working demo of the SDK at this link:
https://craft-commerce-headless-sdk.netlify.app/

If you want to test the SDK locally, follow these steps:

  1. Clone the repository.
  2. Navigate to the demo folder.
  3. Run the following commands:
    npm install
    npm run dev
    This will start the demo locally. Before using the SDK, ensure that Craft CMS and Craft Commerce are correctly configured for headless usage. Follow the Craft CMS Configuration Guide for essential setup steps, including CORS configuration and cookie settings.

Craft CMS Configuration Guide

This section provides details on configuring Craft CMS for headless usage, including CORS setup and other necessary settings.


Package Installation

To use the Craft Commerce Headless SDK in your project, you can install it using your preferred package manager. Here are the commands for different managers:

npm

npm install craft-commerce-headless-sdk

pnpm

pnpm add craft-commerce-headless-sdk

yarn

yarn add craft-commerce-headless-sdk

After installation, you can import the SDK in your code:

import { craftCommerceHeadlessSdk } from 'craft-commerce-headless-sdk';

Client Module

The base module for API communication, handling HTTP requests with post and get methods.


Users Module

This module handles user account creation, profile management, and address handling. It simplifies operations like login, password resets, and managing user-related data, all essential for e-commerce platforms.


Cart Module

Manage shopping cart actions, including retrieval, updates, and checkout operations. This module supports typical e-commerce workflows in Craft Commerce.


Payment Sources Module

Create, manage, and assign payment methods to user accounts. This module supports common payment operations like adding or removing payment sources, tailored for Craft Commerce.


Payment Module

Handle payments, including support for 3D Secure and other gateway integrations. This module streamlines the process of initiating and completing payments in Craft Commerce.


Subscriptions Module

Manage subscriptions, including plan creation, cancellations, switching, and reactivation. This module simplifies recurring payment setups in Craft Commerce.


Suggestions for Craft CMS Improvements

While this SDK provides extensive functionality, there are a few additional features that would greatly enhance the integration experience if included directly in Craft CMS or Craft Commerce:

  • Include Available Payment Gateways in the Cart: Similar to how shipping methods are returned, having payment gateways listed directly in the cart data would streamline the checkout process and improve integration ease.

  • Return User-Associated Addresses: Adding a feature to retrieve addresses associated with a user, similar to the actions/users/session-info method for session data, would simplify managing user information in headless implementations.