Skip to content

Plans & Checkout

Sell your product directly through PackEdge. List your pricing plans, send buyers to a hosted checkout (Polar or Stripe, per your connected provider), and have the purchased license delivered straight back to your app for one-click activation. PackEdge is brand-neutral — these endpoints work for any product; just use your own public_key.

Base URL: https://api.packedge.dev/public/v1

List plans

GET /public/v1/plans?public_key=pk_your_public_key

Returns the product's active, public plans for rendering a pricing table.

json
{
  "plans": [
    {
      "id": "plan_…",
      "name": "Personal Yearly",
      "slug": "personal-yearly",
      "price": 49,
      "currency": "USD",
      "billingCycle": "yearly",
      "siteLimit": 1,
      "checkoutUrl": "https://api.packedge.dev/public/v1/checkout?public_key=pk_…&plan=personal-yearly"
    }
  ]
}

Send the buyer to checkout

GET /public/v1/checkout?public_key=pk_your_public_key&plan=<slug>

Responds 303 and redirects the buyer to the hosted checkout for your connected provider. After payment, PackEdge issues the license (via the provider webhook), emails it to the buyer, and — if you passed a return_url — bounces back to your app with the key for auto-activation.

Query parameters

ParamRequiredDescription
public_keyYour product's public key.
planPlan slug. (Or use the path form GET /public/v1/checkout/{planId}.)
emailPrefills + binds the purchase to this buyer email.
return_urlYour app URL to return to after purchase (e.g. your license page).
activate_paramName of the query param PackEdge appends with the license key on success. Default packedge_activate.
pending_paramName of the query param PackEdge appends if the license is still being provisioned at redirect time. Default packedge_pending.

Pick your own param names

activate_param / pending_param let each product use its own return params — so a site running two PackEdge-powered products never collides. Example: &activate_param=myplugin_activate&pending_param=myplugin_pending.

The post-purchase return

If you passed return_url, the buyer lands back on it with one of:

  • Success: ?<activate_param>=<LICENSE_KEY> — activate it immediately.
  • Still provisioning (rare; webhook hadn't landed yet): ?<pending_param>=1 — show a "license on its way (also emailed)" notice; it activates on next load.

Example (browser JS)

js
const PUBLIC_KEY = 'pk_your_public_key';
const ACTIVATE = 'myplugin_activate';
const PENDING  = 'myplugin_pending';

// 1) Send the buyer to checkout, asking PackEdge to use our param names.
function buy(planSlug, email) {
  const u = new URL('https://api.packedge.dev/public/v1/checkout');
  u.searchParams.set('public_key', PUBLIC_KEY);
  u.searchParams.set('plan', planSlug);
  if (email) u.searchParams.set('email', email);
  u.searchParams.set('return_url', location.origin + location.pathname);
  u.searchParams.set('activate_param', ACTIVATE);
  u.searchParams.set('pending_param', PENDING);
  location.href = u.toString();
}

// 2) On your return page, read the key and activate.
const params = new URLSearchParams(location.search);
const key = params.get(ACTIVATE);
if (key) {
  // POST /public/v1/licenses/activate with this key (see Licenses → Activate)
} else if (params.get(PENDING)) {
  // Show "your license is being provisioned and was emailed to you"
}

Notes

  • The provider (Polar / Stripe) is whatever you've connected in the console under Settings → Payments; the buyer sees that provider's hosted checkout.
  • On purchase, PackEdge auto-issues the license with the plan's seat limit and emails it — so even without return_url, the buyer always gets their key.
  • All /public/v1/* endpoints are CORS-open and need no secret (the public_key identifies the product, not a user).