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

payload-cod-adapter

v0.1.0

Published

Cash on Delivery payment adapter for PayloadCMS ecommerce plugin

Readme

payload-cod-adapter

License: MIT

Cash on Delivery (COD / Pouzeće) payment adapter for PayloadCMS ecommerce plugin.

Enables customers to pay upon delivery — no external payment gateway redirect needed. Orders are created directly with a configurable surcharge.

Features

  • Full integration with @payloadcms/plugin-ecommerce
  • No external API calls — orders created instantly
  • Optional COD surcharge (flat fee)
  • Complete pricing breakdown (subtotal, discount, shipping, surcharge, grandTotal)
  • Address passthrough (billing + shipping) to orders
  • TypeScript support with full type safety

Installation

npm install payload-cod-adapter
# or
pnpm add payload-cod-adapter
# or
yarn add payload-cod-adapter

Requirements

  • PayloadCMS 3.x
  • @payloadcms/plugin-ecommerce ^3.60.0

Quick Start

Server Configuration

// payload.config.ts
import { buildConfig } from 'payload'
import { ecommercePlugin } from '@payloadcms/plugin-ecommerce'
import { codAdapter } from 'payload-cod-adapter'

export default buildConfig({
  plugins: [
    ecommercePlugin({
      payments: {
        paymentMethods: [
          codAdapter({
            label: 'Cash on Delivery',
            surcharge: 200, // Optional: 200 cents = 2.00 surcharge
          }),
        ],
      },
    }),
  ],
})

Client Configuration

COD does not require a client adapter — no payment form is needed. The payment method appears as a selectable option in checkout automatically.

Configuration Options

| Option | Type | Default | Description | | ----------- | -------- | -------------------- | ----------------------------------------- | | label | string | 'Cash on Delivery' | Display label for the payment method | | surcharge | number | 0 | COD surcharge in cents (e.g., 200 = 2.00) |

Payment Flow

  1. Customer selects COD at checkout
  2. initiatePayment() called — creates transaction with status succeeded
  3. Order created immediately (no redirect, no webhook)
  4. Cart marked as purchased
  5. Customer receives order confirmation

Unlike card payment adapters, COD skips the external gateway entirely. The order is confirmed instantly.

Transaction Fields

The adapter adds a cod group field to transactions with:

  • surcharge - COD surcharge amount applied
  • note - Payment collection note

TypeScript

import { codAdapter } from 'payload-cod-adapter'
import type { CodAdapterArgs } from 'payload-cod-adapter'

Changelog

0.1.0

  • Initial release
  • Full @payloadcms/plugin-ecommerce PaymentAdapter implementation
  • COD surcharge support
  • Pricing breakdown passthrough

License

MIT