Adds shipping functions to Payload: address checks, rate quotes, label purchase, returns, refunds of unused labels and a tracking webhook endpoint. EasyPost is the first carrier provider. A beforeExternalCall hook must approve every outside call, and a purchases collection ensures each quote is bought only once. Requires Payload 3.80 or later and an EasyPost key; US addresses only.
Shipping for Payload: addresses, carrier rates, labels, refunds of unused labels and tracking webhooks, with EasyPost as the first carrier provider.
Installation
npm i @extantape/payload-plugin-shipping0
Stars
0
Forks
0
Open Issues
6 days ago
Last Updated
220
Weekly Downloads
v0.2.0
npm Version
64.4 KB
Unpacked Size
0
Dependencies
00 since Nov 8
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
220+220 since Nov 14
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 220 |
| Dec 4, 2026 | 214 |
| Dec 3, 2026 | 215 |
| Dec 2, 2026 | 198 |
| Dec 1, 2026 | 22 |
| Nov 30, 2026 | 23 |
| Nov 29, 2026 | 23 |
| Nov 28, 2026 | 20 |
| Nov 27, 2026 | 20 |
| Nov 26, 2026 | 17 |
| Nov 25, 2026 | 23 |
| Nov 24, 2026 | 30 |
| Nov 23, 2026 | 40 |
| Nov 22, 2026 | 232 |
| Nov 21, 2026 | 229 |
| Nov 20, 2026 | 227 |
| Nov 19, 2026 | 227 |
| Nov 18, 2026 | 220 |
| Nov 17, 2026 | 208 |
| Nov 16, 2026 | 197 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1456392848-root)<a href="https://payloaddirectory.dev/plugins/1456392848-root"><img src="https://payloaddirectory.dev/badge/1456392848-root.svg" alt="Payload Directory"></a>README
Shipping for Payload: addresses, carrier rates, labels, refunds of unused labels and tracking webhooks, with EasyPost as the first carrier provider.
Status: 0.2.0 is the latest release (see CHANGELOG.md). 43 tests pass: 27 against Payload 3.92 with an in-memory MongoDB and a fake carrier, and 16 with no database, on the go-ahead, money, secrets and the webhook's refusals. The 27 cover addresses, parcels, buying, buying each quote once (in a row and at the same moment), returns, the side-effects hook and each answer it can give, production refused without it, a timed-out purchase, errors without addresses, and the webhook's 503, 401 (a custom provider's async check included), unknown, too-old, too-new, retry and refund cases, and purchases whose outcome is unclear. It has never called EasyPost: the request shapes follow EasyPost's documentation and are checked in test mode once a test key is saved. No site uses it yet.
Addresses of three kinds (street, PO Box, General Delivery), with addressProblems in plain codes, labelAddress (refuses a guessed or placeholder address), addressKey and carriersFor: PO Box and General Delivery take USPS only. Both addresses on a label always come from your records, never a carrier account's defaults.
Carrier calls, through a provider (EasyPost first):
quote: Ground Advantage first, else the cheapest allowed. A PO Box or General Delivery address on either side gets USPS only, whatever the caller asked;buy, and buyLabel (a quote then a purchase). Each quote is bought once: see below;buyReturn: from the customer to your hub's address, USPS only;quoteReturn;refund, for an unused label, within 30 days for USPS;verifyAddress.Your go-ahead before every outside call. beforeExternalCall({ action, mode }) runs before every verify, quote, buy and refund, and the external-call hook allows only true. The call goes ahead when the hook answers exactly true, or a promise of it. Every other answer refuses it and nothing is sent: false, nothing at all, 1, 'yes', an object, a throw or a rejected promise. A hook that only throws to refuse must now end with return true. Without the hook, test mode (an EZTK… key) is allowed and production mode is refused, so a copied live key can't buy postage from a test site by accident.
Errors in plain words, with a stable code. They never include a name, an address or your key. A purchase whose outcome is unknown (a timeout, a dropped connection, a 408, a 429, a 5xx, an unreadable reply, or a label with no tracking number) fails with MAYBE_BOUGHT. The error says the label may have been bought, carries the shipment's id as shipmentId, and says how to settle it. Address checks return EasyPost's codes, never its text.
Parcels: parcelFor (a box's outside size, longest side first, and weight), billableLb and dimWeightLb (USPS dimensional weight past one cubic foot), and mailability (too big, too heavy, the nonstandard fees, in words).
Tracking: trackingLink for USPS and UPS, and noticeFor, which maps a carrier status to out for delivery, delivered or an exception. Sending the emails is yours, through Notifications or your own code.
The webhook at /api/easypost/webhook (a root endpoint, webhookPath). It fails closed:
webhook.verify may be sync or async, and only an answer of exactly true counts: false, 1, an object such as { valid: false }, or an error thrown or rejected is a 401;'handled' or 'unknown': 500, so the carrier retries.Handlers are yours, or another plugin's, registered at config.custom.shippingHandlers with no import. They must be idempotent, because carriers retry.
Buy each quote once. buy and buyLabel claim the quote in a record with a unique key before the carrier is called, so one quote ends in one purchase, across repeated calls, calls made at the same moment and several server instances.
buy of a bought quote answers the first label, with no carrier call;buy that arrives while the first is still running is refused with BUY_IN_PROGRESS, with no carrier call. So is every later one if the server stopped mid-purchase;MAYBE_BOUGHT the quote stays locked, and every later buy of it answers MAYBE_BOUGHT with no carrier call. To settle it, look up the shipment (shipmentId on the error) with the carrier. If it has a label, use it or refund it. If it has none, get a new quote and buy that one;NOT_CLAIMED and nothing is sent.The purchase request also carries an Idempotency-Key header made from the quote's shipment and rate. EasyPost's documentation, as read on 2026-11-26, doesn't describe that header, so the plugin doesn't count on it: the record is what holds.
One collection, shipping-purchases, for those claims: the quote's key, a status, the shipment's id and the label that came back (tracking number, label link, price). It holds no name or address, it's hidden from the admin, and every access rule answers no, so only the plugin's server code reads or writes it. The claim is written outside any transaction of yours. Your own code still records each label against its order or kit.
A fake carrier for tests and dry runs, only from @extantape/payload-plugin-shipping/testing, so a production bundle can't pick it by accident. Its prices are made up, and every rate and label says fake: true.
On its own: Shipping needs only Payload and an EasyPost key, which your site passes in, or the fake carrier for tests. It adds one small collection, shipping-purchases, which keeps each quote to one purchase. Your own code records each label it buys against its order, and your own handlers answer the webhook.
Needs: Payload ^3.80.0 as a peer dependency. No other EXTANT APE plugin is required.
Works with:
adapters.shipping, and Sample Kits registers its tracking and refund handler at config.custom.shippingHandlers. The two never import each other.noticeFor turns a carrier status into out for delivery, delivered or a problem, and the plugin that owns the parcel can send that through Notifications.quote to Kitting's adapter as it is: shipping: { provider: ratesFromShipping({ quote, from }) }. Neither plugin imports the other, and every quote still goes through your beforeExternalCall hook. If a quote fails, Kitting packs by its own postage rates and marks the suggestion.Color Theory: none needed. It has no screens of its own, and its collections use Payload's standard admin, which takes Color Theory's admin colors when its applyToAdmin option is on.
Family: Shipping sits in the Fulfillment family, with Kitting, Restock, Sample Kits, Scan, Labels, Wizards, Custody and Sequences, though the families are a working draft and Fulfillment is due to be split into different groups.
npm install @extantape/payload-plugin-shipping
import { easyPost, shippingPlugin } from '@extantape/payload-plugin-shipping'
shippingPlugin({
provider: easyPost({ apiKey: process.env.EASYPOST_API_KEY, webhookSecret: process.env.EASYPOST_WEBHOOK_SECRET }),
beforeExternalCall: ({ action, mode }) => mySideEffectsCheck('easypost', action, mode) === true, // only an exact true allows the call
handlers: [{ owner: 'orders', onTracker: async ({ event }) => (await markTracking(event)) ? 'handled' : 'unknown' }],
})
The plugin reads no environment: your site passes the key and the secret in.
The go-ahead hook guards the plugin's functions (quote, buy, buyLabel, refund and the rest). The provider object itself, from easyPost() or config.custom.shipping.provider, calls the carrier directly: it's server code, so treat it like your key and go through the functions.
buyLabel and buyReturn make a new quote on every call, so calling one of them twice for the same order buys two labels. To make a retry safe, call quote, keep the quote with the order, and buy that.npm test # integration tests, in-memory MongoDB, fake carrier
npm run typecheck
npm run build
MIT. See LICENSE.
payload plugin shipstation
ShipStation shipping rates, address validation and tracking webhooks for Payload ecommerce
3225/wk2v3
payload shipping rates
Shipping zones, methods and rate quotes for Payload ecommerce, in integer minor units
7314/wk2v3
payload plugin sample kits
Track sample kits from stock to keeper and back with custody trails, lot recalls and one-time activation secrets
74441/wk0v3
payload fulfillment
Extra order states, transition history, internal notes and tracking fields for Payload ecommerce orders
7332/wk1v3
payload shipping classes
Weight, dimensions and a shipping class on Payload products and variants, stored in one canonical unit
7210/wk2v3
payload downloads
Sell digital products with signed, expiring download links and per-order download limits
7119/wk1v3