Skip to content

Medusa.js

Terminal window
npm install @swft-checkout/medusa @swft-checkout/js
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,
},
}],
})
import { SwftSessionService } from '@swft-checkout/medusa'
const swft = new SwftSessionService({
merchantApiKey: process.env.SWFT_MERCHANT_API_KEY,
})
// In your storefront API route:
const session = await swft.createFromCart(cart)
return { sessionUrl: session.sessionUrl }

The plugin registers POST /webhooks/swft automatically. Set your webhook URL in the Swft dashboard to https://your-medusa-instance.com/webhooks/swft.

VariableDescription
SWFT_MERCHANT_API_KEYFrom swft.co.uk/dashboard
SWFT_WEBHOOK_SECRETFrom Swft dashboard → Settings → Webhook Secret