Skip to content
PolyPack
Docs: Products

Products

Sell tiers, not single Packs: give a customer a whole set of Packs in one step.

A Product is a set of your Team's Packs that you sell together, with default terms. Say Hopper Digital sells Widgets Pro: hopper/widgets and @hopper/ui, for 12 months, with updates to 2.x. Give Widgets Pro to Knuth Press and Knuth Press can install both Packs at once, with those terms. Products are on every Plan, and Admins manage them; Members do not see them.

Creating a Product

In the panel, open Access → Products and choose New Product. Give it:

  • a name, unique in your Team, and an optional description that only your Team sees;
  • optional default terms:
    • Access, months: a customer's access ends this many months after they are given the Product;
    • Updates, months: only versions released within this many months of it being given;
    • Versions: a constraint such as ^2.0, in Composer's syntax for every package manager.

Leave the terms empty for every version, with no end. Then open the Product and Add a Pack for each Pack it covers: Composer, npm and container images can share a Product.

Giving it to a Client

On the Client's page, under Products, choose Give a Product. Its default terms are filled in, counted from today, and you can change them for this Client: a longer trial, a discount year, an older major version. The Client can install every Pack in the Product on their next request, with their existing Client Tokens and setup instructions.

Later, Terms changes the Client's terms for the whole Product, and Withdraw takes the Product away. Changing a Product's default terms applies to Clients you give it to afterwards; Clients that already have it keep theirs.

It stays in step

  • Add a Pack to a Product and every Client that has it can install that Pack at once.
  • Remove a Pack and Clients that had it only through this Product lose it on their next request.
  • Delete a Product and its Clients lose its Packs, unless something else covers them.

Products and your own Grants

A Client's Granted Packs show where each Grant comes from: Direct, for one you gave yourself, or the Product's name. A Grant that comes from a Product is changed through the Product, so it has no Terms or Withdraw of its own.

  • Your direct Grants win. If you grant a Pack yourself, your terms apply, whatever the Client's Products say. Granting directly a Pack the Client already has through a Product turns that Grant into yours.
  • Withdraw a direct Grant and a Product that covers the Pack takes over straight away.
  • Two Products, one Pack: the one that lasts longer applies. A Product with no end beats any date.
  • Set terms for all Grants, on a Client's page, changes only the Client's direct Grants.

When it ends

A Product's access works through its last day, then its Packs disappear for that Client, as with any Grant. Your Team's notification channels hear about it once per Product, 14 days and one day before it ends and on the day after (product_grant.ending and product_grant.ended), not once per Pack.

From your billing system

Map each of your billing products to a PolyPack Product, then give, extend and withdraw it with the Team API when a customer buys, renews or cancels:

Give Knuth Press Widgets Pro, with its default terms
curl -X POST https://api.polypack.io/v1/clients/42/products -H 'Authorization: Bearer polypack_key_…' -H 'Content-Type: application/json' -d '{"product_id": 3}'
Extend it a year on renewal
curl -X PATCH https://api.polypack.io/v1/clients/42/products/{product_grant} -H 'Authorization: Bearer polypack_key_…' -H 'Content-Type: application/json' -d '{"ends_on": "2028-11-30"}'

GET /products lists your Products with their Packs and default terms, and DELETE /clients/42/products/{product_grant} withdraws one. Products themselves are created and changed in the panel.