Decide what a purchase grants
Your checkout and customer database own the sale. The registry provides read-only download keys (pdk_…) rather than a built-in license or billing record. Map each product or price in your store to one registry and the exact package IDs it grants there. Keep your order ID as the key's external_ref.

Handle the payment event on your server
- Receive a paid or fulfilled event from Stripe or your other payment provider. Verify its signature using that provider's instructions, confirm the order and payment state, and record the provider event ID so retries cannot fulfill the order twice.
- Create or retrieve one organization API key for your fulfillment service under Settings → API keys. It needs permission to manage download keys; API access starts on Growth. Keep the
gsk_…secret on your server. - Call
RegistryDownloadKeyService/IssueDownloadKeywith the registry ID, recipient label, your order reference, and package IDs. Store the returned key ID and reveal-once secret securely. A retry must consult your saved order-to-key mapping before issuing another key. - Email the customer the secret and
.npmrcinstructions from your own email service. Track send status so a mail failure can be retried without minting another key.

The management request uses the Connect JSON endpoint on your app origin:
POST /privatenpmcom.core.registryaccess.v1.RegistryDownloadKeyService/IssueDownloadKey
Authorization: Bearer gsk_...
X-Idempotency-Key: order_1234
Content-Type: application/json
{"registryId":"reg_...","name":"Order 1234","recipient":"[email protected]","externalRef":"order_1234","packageIds":["rpkg_..."]}Send the customer their install details
Use your existing transactional email service after saving the key and order mapping. Send to the verified order email address. This example assumes a package on the shared registry; substitute your custom domain and package name when appropriate:
Subject: Your Acme SDK download key
Your download key: pdk_...
Set ACME_NPM_TOKEN to that key, then add to .npmrc:
@acme:registry=https://registry.privatenpm.com/
//registry.privatenpm.com/:_authToken=${ACME_NPM_TOKEN}
Run: npm install @acme/sdkThe response's secret is shown only at issuance. Use the key ID to change access or revoke it later. A purchase cancellation or refund should trigger your own policy to revoke the key through the management API. Registry outgoing webhooks report registry changes; they do not receive Stripe payment events.