For the complete documentation index, see llms.txt. This page is also available as Markdown.

Handoffs

Add an overview of the Handoffs API here. This block is preserved across regenerations.

Endpoints

POST /api/v1/handoffs/redeem

Redeem a post-purchase handoff token

post
/handoffs/redeem

Called by the tenant's own app server when a buyer arrives from checkout with ?token=. Verifies the token (signature, purpose, audience, issuer, 5-minute expiry), requires it to belong to this API key's tenant, and burns it: exactly one redeem succeeds. Returns the buyer's identity so the app can sign them in. Never call this from a browser; the token is a single-use credential and must not be logged.

Required scopes
This endpoint requires the following scopes:
Authorizations
X-API-KeystringRequired

Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.

Body
tokenstringRequired

The handoff token from the ?token= query parameter

Responses
200

Redeemed. data is { clerkUserId, email, contactId, sessionId, subscriptionId }. clerkUserId is the Clerk user PeakCommerce verified server-side for the person who completed this checkout: sign in exactly that user, and never look a user up by the email.

No content

post/handoffs/redeem
POST /api/v1/handoffs/redeem HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "token": "text"
}

No content

Notes, examples, or caveats for POST /handoffs/redeem go here.

GET /api/v1/settings/post-purchase-handoff

Read the post-purchase handoff setting

get
/settings/post-purchase-handoff
Required scopes
This endpoint requires the following scopes:
Authorizations
X-API-KeystringRequired

Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.

Responses
200

data is the setting, or null when not configured

No content

get/settings/post-purchase-handoff
GET /api/v1/settings/post-purchase-handoff HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
200

data is the setting, or null when not configured

No content

Notes, examples, or caveats for GET /settings/post-purchase-handoff go here.

PUT /api/v1/settings/post-purchase-handoff

Set the post-purchase handoff setting

put
/settings/post-purchase-handoff

{ audience, redirectUrl (https), activeKid, keys: [{ kid, secretRef }] }. secretRef is the NAME of the environment variable on the PeakCommerce service that holds the signing key (at least 32 characters), never the key itself. ?dryRun=true validates and returns before/after without writing. Audited.

Required scopes
This endpoint requires the following scopes:
Authorizations
X-API-KeystringRequired

Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.

Query parameters
dryRunbooleanOptional
Body
objectOptional
Responses
200

data is { before, after, changed, written, dryRun }

No content

put/settings/post-purchase-handoff
PUT /api/v1/settings/post-purchase-handoff HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 2

{}

No content

Notes, examples, or caveats for PUT /settings/post-purchase-handoff go here.

Last updated

Was this helpful?