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

@swft-checkout/medusa

v1.0.0

Published

Swft Checkout plugin for Medusa v2 — sub-200ms edge checkout

Readme

@swft-checkout/medusa

Swft Checkout plugin for Medusa v2. Integrates sub-200ms edge checkout into any Medusa storefront.


Installation

npm install @swft-checkout/medusa @swft-checkout/js

Plugin registration

In medusa-config.ts:

import { defineConfig } from '@medusajs/medusa'

export default defineConfig({
  plugins: [
    {
      resolve: '@swft-checkout/medusa',
      options: {
        merchantApiKey: process.env.SWFT_MERCHANT_API_KEY,
        webhookSecret:  process.env.SWFT_WEBHOOK_SECRET,
      },
    },
  ],
})

Usage in a custom API route or storefront

import { SwftSessionService } from '@swft-checkout/medusa'

// In your checkout route:
const swft = new SwftSessionService({
  merchantApiKey: process.env.SWFT_MERCHANT_API_KEY!,
})

const session = await swft.createFromCart(cart)
// Redirect the customer to session.sessionUrl

The cart object should be a fully populated Medusa Cart with items, shipping_methods, and customer populated.


Webhook setup

The plugin registers POST /webhooks/swft automatically. When Swft fires a payment_succeeded event, this route verifies the signature and calls completeCart on the matching Medusa cart, triggering order creation via Medusa's standard workflow.

Steps:

  1. Deploy your Medusa backend
  2. In your Swft merchant dashboard, set the webhook URL to https://your-medusa-url.com/webhooks/swft
  3. Copy the webhook signing secret from Swft and set SWFT_WEBHOOK_SECRET in your environment

Environment variables

| Variable | Description | |---|---| | SWFT_MERCHANT_API_KEY | Your Swft merchant API key — from swft.co.uk/dashboard | | SWFT_WEBHOOK_SECRET | Webhook signing secret — from Swft merchant settings |


Optional: auto-create sessions on cart creation

The plugin ships a cart-created subscriber that eagerly creates a Swft session whenever a Medusa cart is created and stores swft_session_url in cart metadata.

To enable it, import and register the subscriber in your Medusa project's src/subscribers/ directory or let Medusa auto-discover it from the plugin's subscribers/ folder.

When enabled, your storefront can read cart.metadata.swft_session_url and redirect immediately without an extra API call.


Module extensions via extensions

Swft Gifts, Drops, Bumps, and Funnels all pass data through the extensions field on the session. When using SwftSessionService.createFromCart, the medusa_cart_id is set automatically. To pass additional module data:

// The session service sets medusa_cart_id — add your own fields by extending
// the cart object or by calling createSession from @swft-checkout/js directly with:
// extensions: { medusa_cart_id: cart.id, swft_bump_id: 'bump_xyz', ... }

Architecture

Storefront              Medusa Backend              Swft Edge
---------               --------------              ----------
cart.create()    -->    cart-created subscriber -->  createSession()
                        (stores session URL in       (returns sessionUrl)
                         cart metadata)

checkout         -->    read cart.metadata
                        .swft_session_url
                 -->    redirect to sessionUrl  -->  Swft Checkout UI

payment done     <--    POST /webhooks/swft     <--  payment_succeeded event
                        verifySwftWebhook()
                        completeCart(cartId)
                        --> order created

License

MIT