Overview
Icon for Packeta

Packeta

Packeta (Zásilkovna) shipping for Central European delivery

medusa-plugin-packeta

This plugin is a Packeta (Zásilkovna) fulfillment provider for Medusa v2. It supports pickup points, home delivery, cash on delivery, labels, push tracking and returns. It has an admin UI and a helper for the storefront widget.

Disclaimer: This plugin is an unofficial integration from the community. It is not affiliated with, endorsed by, or maintained by Packeta s.r.o. / Zásilkovna s.r.o. "Packeta", "Zásilkovna" and their logos are trademarks of their owners. This document uses them only to identify the service that the plugin connects to.

npm | Packeta API docs | Medusa Fulfillment Module

Features

  • Fulfillment options.
    • Copy to clipboardpacketa-pickup: a Packeta or partner pickup point that the customer selects in the widget.
    • Copy to clipboardpacketa-home-delivery: the Packeta home delivery carrier for the shipping country.
    • Copy to clipboardpacketa-return.
    • Optional: one option for each carrier in the live Packeta carrier feed (Copy to clipboardpacketa-carrier-<id>). Use these options to set different prices for Z-BOX, PPL ParcelShop, InPost, DHL and other carriers.
  • Checkout validation. The server validates the selected pickup point again with the Packeta widget validate endpoint. The pickup point must exist, your account must have access to it, and it must accept packets now.
  • Packets. The plugin calls Copy to clipboardcreatePacket when you create a fulfillment. The packet has COD, insured value, weight, note, earliest delivery date, adult content, dimensions, carrier services and customs declarations for non-EU carriers. The weight comes from the variant weights. The product weight is the fallback.
  • COD. The plugin sets COD from the payment provider of the order (Copy to clipboardpp_system_default by default). You can change COD for each packet in the admin.
  • Labels. Packeta PDF (all formats), ZPL (203 or 300 dpi), PDF or ZPL from an external carrier, and one bulk PDF for many packets. The plugin attaches the tracking number and the label link to the Medusa fulfillment.
  • Tracking. A signed push tracking webhook (Copy to clipboard/hooks/packeta) and a polling job as a fallback. The statuses mark the Medusa fulfillment as shipped or delivered.
  • Cancel. You can cancel a packet and its fulfillment before Packeta receives the packet.
  • Returns. A return creates a claim assistant packet with a drop-off password.
  • Admin UI (English and Czech). A card on the order page and a Copy to clipboard/packeta page. Refer to Admin.
  • Storefront helper Copy to clipboardmedusa-plugin-packeta/widget. This helper wraps Packeta widget v6 and the home delivery widget. It has no dependencies. It returns the exact Copy to clipboarddata that this provider expects.
  • No runtime dependencies (only fetch and Copy to clipboardnode:crypto).

Install

bun add medusa-plugin-packeta # or npm / yarn / pnpm

The plugin supports Medusa 2.x. Use the Node.js version that your Medusa release requires: Node.js 20.19 or later up to Medusa 2.21, Node.js 22.22 or later from Medusa 2.22. CI tests the plugin with Medusa 2.21.2 on Node.js 20 and with Medusa 2.23.2 on Node.js 26.

Configure

Give the same options object to the fulfillment provider and to the Copy to clipboardpacketa module of the plugin. The routes and workflows use the module. The checkout uses the provider. The plugin entry loads the API routes, the subscribers, the job and the admin UI.

// medusa-config.ts
const packeta = {
api_password: process.env.PACKETA_API_PASSWORD, // 32-hex API password
api_key: process.env.PACKETA_API_KEY, // 16-char API key (feeds, widget)
eshop: process.env.PACKETA_ESHOP, // sender indication (client section → Senders)
webhook_signing_key: process.env.PACKETA_WEBHOOK_SIGNING_KEY, // from Packeta support, see Push tracking
// optional — see the table below
// cod_payment_providers: ["pp_system_default"],
// enabled_carriers: ["106", "131", "3060"],
// carrier_filter: { countries: ["cz", "sk"], cod: true },
// label_format: "A6 on A6",
}
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/fulfillment",
options: {
providers: [

Then run the migration of the plugin. It creates the Copy to clipboardpacketa_packet table.

npx medusa db:migrate

The provider ID is Copy to clipboardpacketa_packeta. Do these steps in the admin:

  1. Go to Settings → Locations & Shipping → your location → Fulfillment providers.
  2. Add Packeta.
  3. Create shipping options for the service zone. Select the Packeta fulfillment options (pickup, home delivery or one carrier).

The prices are flat Medusa prices. Packeta has no price API.

Options

Option Required Default Description Copy to clipboardapi_password yes — REST API password. You find it in the client section → Support. Copy to clipboardapi_key yes — API key for the carrier feed, the widget and the widget validate endpoint. Copy to clipboardeshop yes — Sender indication. Use a special test sender during the integration. Packeta has no sandbox. Copy to clipboardcod_payment_providers no Copy to clipboard["pp_system_default"] Payment provider IDs that mean cash on delivery. Copy to clipboarddefault_weight_kg no Copy to clipboard0.5 Packet weight if no line has a variant weight or a product weight. Copy to clipboardpackaging_weight_g no Copy to clipboard100 The plugin adds this value (grams) to the sum of the line weights. Copy to clipboardlabel_format no Copy to clipboard"A6 on A6" Copy to clipboardA6 on A6, Copy to clipboardA7 on A7, Copy to clipboardA6 on A4, Copy to clipboardA7 on A4, Copy to clipboard105x35mm on A4, Copy to clipboardA8 on A8. Copy to clipboardexpose_carriers no Copy to clipboardtrue Add one fulfillment option for each carrier in the feed. Copy to clipboardenabled_carriers no Copy to clipboard"all" Carrier IDs to show (Copy to clipboard["106", "3060"]) or Copy to clipboard"all". The plugin applies this list after Copy to clipboardcarrier_filter. Copy to clipboardcarrier_filter no — Rules that remove carriers from the feed. Refer to Carrier filter. Copy to clipboardfeed_ttl_s no Copy to clipboard86400 Time (seconds) that the plugin keeps the carrier feed in the cache. Copy to clipboardvalidate_pickup_point no Copy to clipboardtrue Validate the selected pickup point with Packeta at checkout. Copy to clipboardwebhook_signing_key no — Signing key for push tracking. If this key is not set, the webhook sends 503. Copy to clipboardallow_unsigned_webhook no Copy to clipboardfalse Accept webhooks without a signature. Use it only for local development. The plugin ignores it in production. Copy to clipboardwebhook_tolerance_s no Copy to clipboard300 Maximum age (seconds) of a webhook timestamp. An older request is a replay. Copy to clipboardtracking_url no Copy to clipboardhttps://tracking.packeta.com/cs/?id={barcode} Use the Copy to clipboard{barcode} and Copy to clipboard{id} placeholders. Copy to clipboardauto_ship_status_ids no Copy to clipboard[2,3,4,5,6,12] Packeta status IDs that mark the fulfillment as shipped. Copy to clipboardauto_deliver_status_ids no Copy to clipboard[7] Packeta status IDs that mark the fulfillment as delivered. Copy to clipboarddefault_size no — Copy to clipboard{ length, width, height } in mm. The plugin uses it if a carrier requires dimensions. Copy to clipboardcustoms no — Copy to clipboard{ ead, default_hs_code, default_origin_country, invoice_number } for non-EU carriers. Refer to Customs. Copy to clipboardreturn_value_default no Copy to clipboard1 Insured value for a return claim if the request has no value. Copy to clipboardpoll_status / Copy to clipboardpoll_status_cron / Copy to clipboardpoll_status_batch / Copy to clipboardpoll_status_max_age_days no Copy to clipboardtrue / Copy to clipboard*/30 * * * * / Copy to clipboard100 / Copy to clipboard60 Status polling job. It is the fallback for push tracking. Copy to clipboardbase_url, Copy to clipboardfeed_base_url, Copy to clipboardwidget_validate_url no Packeta production URLs You can change these URLs for tests.

Carrier filter

Copy to clipboardcarrier_filter removes carriers from the fulfillment options, from the home-delivery carrier selection and from Copy to clipboardGET /store/packeta/carriers. A carrier must agree with all the rules that you set.

Key Type A carrier stays if Copy to clipboardcountries Copy to clipboardstring[] Its country is in the list (ISO alpha-2, for example Copy to clipboard["cz", "sk"]). Copy to clipboardtypes Copy to clipboard("hd" | "pickup" | "box")[] Its type is in the list. Copy to clipboardhd is home delivery. Copy to clipboardbox is a pickup-point carrier with "box", "Paczkomat", "Paketomat", "automat" or "locker" in its name. All other pickup-point carriers are Copy to clipboardpickup. Copy to clipboardcod Copy to clipboardboolean Copy to clipboardtrue: it accepts cash on delivery. Copy to clipboardeu_only Copy to clipboardboolean Copy to clipboardtrue: it needs no customs declaration. Copy to clipboardmin_max_weight_kg Copy to clipboardnumber Its maximum weight is this value (kg) or more. A carrier without a maximum weight in the feed stays. Copy to clipboardexclude_ids Copy to clipboardstring[] Its ID is not in the list.

The rules apply at checkout too. The plugin refuses a carrier that the filter removes, also if the storefront sends its ID. For Packeta pickup points (Z-Point, Z-BOX), the plugin applies Copy to clipboardcountries and Copy to clipboardtypes (a Z-BOX is Copy to clipboardbox, a Z-Point is Copy to clipboardpickup).

If Copy to clipboardtypes does not contain Copy to clipboardhd, the plugin does not show the "Packeta home delivery" option. If Copy to clipboardtypes contains neither Copy to clipboardpickup nor Copy to clipboardbox, the plugin does not show the "Packeta pickup point" option. The plugin stops at startup if a key is unknown or a value has the wrong type.

Environment

PACKETA_API_PASSWORD=
PACKETA_API_KEY=
PACKETA_ESHOP=
PACKETA_WEBHOOK_SIGNING_KEY=

Storefront

The customer selects a Packeta pickup point in the Packeta widget on your storefront. Send the selection as the shipping method data (Copy to clipboarddata). The provider validates and normalizes it.

import { pickPoint, pickAddress, pointToShippingMethodData, addressToShippingMethodData } from "medusa-plugin-packeta/widget"
// Pickup point (Z-Point, Z-BOX, partner PUDO). Filter with `vendors` / `country` if you like.
const point = await pickPoint(process.env.NEXT_PUBLIC_PACKETA_API_KEY!, { language: "cs", country: "cz,sk" })
if (point) {
await sdk.store.cart.addShippingMethod(cart.id, {
option_id: pickupShippingOption.id,
data: pointToShippingMethodData(point),
})
}
// Home delivery: the address from the cart is enough…
await sdk.store.cart.addShippingMethod(cart.id, { option_id: homeShippingOption.id, data: {} })
// …or let the customer pick a validated address in Packeta's HD widget (CZ/SK):
const carrierId = (await fetch(`${MEDUSA_URL}/store/packeta/carriers?country=cz`, { headers }).then((r) => r.json())).home_delivery_carrier_id
const address = await pickAddress(process.env.NEXT_PUBLIC_PACKETA_API_KEY!, { carrierId, language: "cs" })
if (address) {
await sdk.store.cart.addShippingMethod(cart.id, { option_id: homeShippingOption.id, data: addressToShippingMethodData(address, carrierId) })
}

If you control the widget yourself, send Copy to clipboarddata in this format. Copy to clipboardpointToShippingMethodData gives the same format.

// Packeta point
{ "point_id": "79", "point": { "id": "79", "name": "…", "street": "…", "city": "…", "zip": "…", "country": "cz", "group": "zbox", "type": "internal" } }
// Partner carrier point (InPost, PPL, …)
{ "carrier_id": "3060", "carrier_pickup_point_id": "BIA10M", "point": { "name": "…", "type": "external", "carrier_id": "3060", "carrier_pickup_point_id": "BIA10M" } }
// Home delivery with a specific address (optional; the cart address is the default)
{ "address": { "street": "Vinohradská", "house_number": "1", "city": "Praha", "zip": "12000", "country": "cz" } }

Copy to clipboardGET /store/packeta/carriers?country=cz returns the public carrier list (Copy to clipboardid, Copy to clipboardname, Copy to clipboardcountry, Copy to clipboardpickup_points, Copy to clipboarddisallows_cod, Copy to clipboardrequires_size, Copy to clipboardmax_weight) and Copy to clipboardhome_delivery_carrier_id. Use it for the Copy to clipboardvendors filters of the widget. The configured Copy to clipboardcarrier_filter applies to this list. Add Copy to clipboardtype=hd,pickup,box or Copy to clipboardcod=1 to remove more carriers. An unknown Copy to clipboardtype value gives 400. For a procedure with the Next.js starter, refer to Copy to clipboarddocs/storefront-nextjs.md.

Admin

  • Order page → Packeta card.
    • The card shows the packet barcode, status, destination, COD, value, weight and tracking link.
    • The label menu has PDF, ZPL, carrier PDF and carrier ZPL.
    • The card has the actions Refresh and Cancel, and it shows the return password.
    • Create packet opens a drawer. In the drawer, you select the items, COD, weight, note, earliest delivery date, adult content and dimensions. You can split the order into more than one packet.
  • Packeta page (sidebar). The page shows all packets with search and filters. It has bulk Print labels and bulk Refresh. Health badges show the status of the API password, the feed and the webhook.
  • The Medusa action Fulfill items also creates the packet. The plugin copies the packet into Copy to clipboardpacketa_packet and attaches the tracking label.
  • The admin UI is in English and Czech. It uses the browser language.

Admin API

Route Copy to clipboardGET /admin/packeta/packets Copy to clipboard?order_id= ?fulfillment_id= ?kind= ?status_group= ?q= ?limit= ?offset= Copy to clipboardGET /admin/packeta/packets/:id Copy to clipboard:id is the packet ID, the Copy to clipboardZ… barcode or the record ID Copy to clipboardGET /admin/packeta/packets/:id/label `?type=pdf Copy to clipboardPOST /admin/packeta/packets/labels Copy to clipboard{ packet_ids, format?, offset? } → one PDF Copy to clipboardPOST /admin/packeta/packets/:id/refresh Pull the status from Packeta Copy to clipboardPOST /admin/packeta/packets/:id/cancel Cancel the packet at Packeta and the Medusa fulfillment Copy to clipboardPOST /admin/packeta/orders/:id/packet Copy to clipboard{ items?, cod?, cod_amount?, weight_kg?, note?, deliver_on?, adult_content?, size?, number? } Copy to clipboardGET /admin/packeta/carriers Carrier feed (Copy to clipboard?country= ?refresh=1). Copy to clipboardenabled is Copy to clipboardtrue for each carrier that is a fulfillment option. Copy to clipboardGET /admin/packeta/health Status of the credentials, the feed and the webhook

How it works

  1. Checkout. Copy to clipboardvalidateFulfillmentData receives the widget selection.
    • For a pickup point, it checks the selection with the Packeta validate endpoint.
    • For home delivery, it finds the home delivery carrier for the shipping country.
    • It stores a normalized Copy to clipboard{ kind, point_id | carrier_id + carrier_pickup_point_id, point | address } on the shipping method.
  2. Copy to clipboardorder.placed. A subscriber reads the payment provider. A COD order gets Copy to clipboardmetadata.packeta_cod = true. The fulfillment provider cannot read payments itself.
  3. Fulfillment. Copy to clipboardcreateFulfillment maps the order and the shipping method data to Packeta Copy to clipboardcreatePacket (recipient, destination, value, weight, COD, note, size, customs). The packet ID and barcode go into Copy to clipboardfulfillment.data. A subscriber copies them into Copy to clipboardpacketa_packet and attaches the tracking label to the fulfillment.
  4. Tracking. Packeta sends status events to Copy to clipboard/hooks/packeta. Each event has an HMAC-SHA256 signature. The plugin ignores a duplicate event ID. Copy to clipboardarrived, Copy to clipboarddeparted and similar statuses mark the fulfillment as shipped. Copy to clipboarddelivered marks it as delivered. The polling job does the same for stores without push tracking.
  5. Cancel. Before Packeta receives the packet, the plugin calls Copy to clipboardcancelPacket at Packeta and cancels the fulfillment in Medusa. After that time, Packeta refuses the cancel (Copy to clipboardCancelNotAllowedFault), and the plugin also refuses it.
  6. Returns. A return shipping option with Copy to clipboardpacketa-return creates a claim assistant packet (Copy to clipboardcreatePacketClaimWithPassword). The customer brings the packet to a pickup point and gives the password. The admin shows the password. If the return has an e-mail address, Packeta also sends the password by e-mail.

Storefront contract (driving the widget yourself)

If you do not use Copy to clipboardpointToShippingMethodData, map the widget v6 Copy to clipboardpoint object as this table shows. If you use a different mapping, the packet can go to the wrong destination.

Widget Copy to clipboardpoint Shipping-method Copy to clipboarddata Notes Copy to clipboardpickupPointType === "internal" (Z-Point, Z-BOX) Copy to clipboardpoint_id: String(point.id) Required. It becomes Copy to clipboardaddressId in Copy to clipboardcreatePacket. Copy to clipboardpickupPointType === "external" (partner PUDO) Copy to clipboardcarrier_id: String(point.carrierId), Copy to clipboardcarrier_pickup_point_id: String(point.carrierPickupPointId) Both are required. Do not send Copy to clipboardpoint.id as Copy to clipboardpoint_id for these points. It is not a Packeta pickup point, and Packeta rejects or misroutes the packet. The plugin sends them as Copy to clipboardaddressId and Copy to clipboardcarrierPickupPoint. Copy to clipboardname/Copy to clipboardnameStreet, Copy to clipboardstreet, Copy to clipboardcity, Copy to clipboardzip, Copy to clipboardcountry, Copy to clipboardgroup Copy to clipboardpoint: { name, street, city, zip, country (lowercase), group, type } Only for display (admin card, order e-mails). If Copy to clipboardvalidate_pickup_point is on, the server validates it and fills it from Packeta. — Copy to clipboardnote (optional) Packet note. Maximum 128 characters. The plugin removes Copy to clipboard" and Copy to clipboard;.

The cart must also have these values:

  • A shipping address with Copy to clipboardcountry_code. It sets the region and, for home delivery, the carrier.
  • The customer Copy to clipboardemail.
  • A Copy to clipboardphone on the shipping address. Packeta sends notifications to the recipient by e-mail and SMS.

For a pickup point, you can set the cart shipping address to the address of the pickup point. The packet destination always comes from Copy to clipboarddata, not from the address.

Home delivery needs no values in Copy to clipboarddata. The plugin uses Copy to clipboardaddress_1, Copy to clipboardaddress_2 (house number), Copy to clipboardcity, Copy to clipboardpostal_code and Copy to clipboardcountry_code from the cart. It finds the carrier for the country in the live feed.

Push tracking (webhook)

Packeta enables webhooks for each account. Send your HTTPS URL by e-mail to integrations@packeta.com:

https://<your-backend>/hooks/packeta

Packeta then gives you a signing key. Set it in Copy to clipboardwebhook_signing_key.

The plugin verifies each request with Copy to clipboardHMAC-SHA256(key, "{X-Webhook-Timestamp}.{rawBody}") in constant time. The timestamp must be within Copy to clipboardwebhook_tolerance_s (5 min) of the server clock.

Condition Response No signing key is set 503 No signature, a wrong signature, or an old timestamp 401 The body is not a Packeta status event 400 Unknown packet 200. Packeta stops the retries. The plugin cannot store the status of a known packet 500. Packeta sends the event again. Medusa rejects the fulfillment update permanently (Copy to clipboardINVALID_DATA, Copy to clipboardNOT_ALLOWED or Copy to clipboardNOT_FOUND, for example for a cancelled order) 200. The plugin logs an error. The fulfillment update fails for a temporary cause 500. The plugin runs the event again when Packeta sends it again.

The plugin stores the status before it marks the fulfillment as shipped or delivered. Thus, a rejected fulfillment update does not remove the status. The poll job and the admin Refresh button use the same sequence (Copy to clipboardsyncPacketStatus in Copy to clipboardmedusa-plugin-packeta/workflows).

The plugin ignores a duplicate Copy to clipboardX-Webhook-Event-Id. A late or repeated event cannot move a delivered, returned or cancelled packet back to an earlier status.

Until you set the key, the polling job keeps the statuses up to date. By default, it runs every 30 minutes (Copy to clipboardpoll_status_cron). Copy to clipboardallow_unsigned_webhook is only for local development. The plugin ignores it when Copy to clipboardNODE_ENV=production.

Cash on delivery

The plugin applies COD if the payment provider of the order is in Copy to clipboardcod_payment_providers. The default is the Medusa manual provider Copy to clipboardpp_system_default. At Copy to clipboardorder.placed, the plugin sets Copy to clipboardorder.metadata.packeta_cod to Copy to clipboardtrue.

The admin "Create packet" drawer shows the COD state. You can change the amount or turn COD off. A carrier with Copy to clipboarddisallowsCod rejects a COD packet with a clear error.

Split shipments. An order can have more than one packet, from the drawer or from partial fulfillments in Medusa. The customer pays the order one time:

  1. The first packet has the full COD amount.
  2. Then the flag changes to Copy to clipboard"collected", and Copy to clipboardpacketa_cod_barcode is set.
  3. Each subsequent packet has COD 0. If you send Copy to clipboardcod_amount, the plugin uses that amount.

Each packet is insured for the value of its items. The first packet also includes the shipping cost. Subsequent packets get the reference Copy to clipboard<order>-2, Copy to clipboard<order>-3 and so on.

Customs (non-EU)

Some carriers have the Copy to clipboardcustomsDeclarations flag in the feed. For these carriers, the plugin sends:

  • Copy to clipboardattributes: ead, deliveryCost, invoiceNumber, invoiceIssueDate.
  • Copy to clipboarditems from the order lines: Copy to clipboardhs_code and Copy to clipboardorigin_country of the variant or product, title, value, units and weight.

Set Copy to clipboardcustoms.ead (default Copy to clipboardcarrier) and the fallbacks Copy to clipboarddefault_hs_code and Copy to clipboarddefault_origin_country. If you create the fulfillment in code, send more values for each packet in Copy to clipboardadditional_data.customs: Copy to clipboardinvoiceFile, Copy to clipboardeadFile, Copy to clipboardmrn and Copy to clipboardcustoms_items. Refer to the Packeta customs documentation.

Storefront-agnostic notes

  • Provider ID: Copy to clipboardpacketa_packeta. Fulfillment option IDs: Copy to clipboardpacketa-pickup, Copy to clipboardpacketa-home-delivery, Copy to clipboardpacketa-return, Copy to clipboardpacketa-carrier-<id>.
  • Weight: the plugin reads the Medusa variant or product Copy to clipboardweight as grams. The variant weight has priority. The product weight is the fallback. The admin Create packet procedure reads both. The Medusa Create fulfillment action reads only Copy to clipboardvariant.weight. If you use that action, set the weights on the variants, or use the Packeta drawer.
  • Amounts: Medusa v2 major units map 1:1 to Packeta Copy to clipboardvalue and Copy to clipboardcod. For currencies other than CZK, EUR, HUF, PLN and RON, the plugin uses the currency of the destination country.
  • Phone numbers must be in a format that Packeta accepts. E.164 is recommended.

Development

bun install
bun run check # format + lint + typecheck + unit tests
bun run build # medusa plugin:build → .medusa/server
bun run test:integration # boots a real Medusa app against a mocked Packeta API (needs Postgres: DB_HOST/DB_PORT/DB_USERNAME/DB_PASSWORD)

Live smoke test with your Packeta account. It creates and cancels a real packet at no cost. Use a test sender.

PACKETA_API_PASSWORD=… PACKETA_API_KEY=… PACKETA_ESHOP=… bun run smoke
bun run smoke carriers cz # feed
bun run smoke validate 79 # widget validate endpoint
bun run smoke label <packetId> # write label PDF

To try the plugin in a Medusa app without a publish, run Copy to clipboardscripts/dev-install.sh <path-to-medusa-app>. The script builds, packs and installs the tarball. Then do the configuration above.

License

MIT

This project is an independent, unofficial integration. It is not affiliated with or endorsed by Packeta s.r.o. / Zásilkovna s.r.o. All Packeta and Zásilkovna trademarks and logos are the property of their owners.

You may also like

Browse all integrations

Build your own

Develop your own custom integration

Build your own integration with our API to speed up your processes. Make your integration available via npm for it to be shared in our Library with the broader Medusa community.

gift card interface

Ready to build your custom commerce setup?