commerce

POST /v1/carts/adopt

Carry a guest basket into the signed-in account.

Alle commerce Endpunkte

Authentifizierung

Senden Sie einen API-Schlüssel als Bearer-Token. Der Schlüssel muss über die Berechtigung billing.payment.manage verfügen; ein Schlüssel ohne diese wird mit 403 statt 404 abgelehnt.

Hier kommt Ihre Organisations-ID hin

Dieser Endpunkt akzeptiert org_id als Feld im JSON-Body.

Die ID Ihrer Organisation finden Sie im Dashboard auf dem Bildschirm für API-Schlüssel direkt neben dem Schlüssel selbst. Sie ist bei jedem Ihrer Aufrufe dieselbe.

Ausprobieren

Ersetzen Sie alles in spitzen Klammern durch Ihre eigenen Werte und den Platzhalter für den Schlüssel durch einen Schlüssel aus Ihrem Dashboard.

curl -X POST https://api.zinndigital.com/v1/carts/adopt \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "token": <string> }'

Angemeldet? Die API-Konsole in Ihrem Dashboard trägt automatisch Ihre echte Organisations-ID sowie Ihren eigenen Schlüssel ein und führt die Anfrage gegen die Live-API aus, sodass Sie die tatsächliche Antwort sehen können. Öffnen Sie diesen Endpunkt in der API-Konsole

Details

Moves the items of an anonymous guest cart into the caller's organization cart, so a visitor who built a basket on the public site and then signed in continues instead of starting again (`docs/87` §575, #2599). ⛔ **Two credentials, both required.** The raw cart `token` proves the caller built the basket; the authenticated principal decides which organization it lands in. Neither alone is sufficient — a token cannot name a destination and a session cannot claim a basket it never held. One-way and idempotent: the guest cart is closed under a conditional update, so a double-submit or a refresh adopts once. Requires `billing.payment.manage`. ⛔ Declared before `/v1/carts/{cartId}` so the literal `adopt` is not read as a cart id.

Anfragekörper

NameTypErforderlichWas es ist
tokenstringJaThe guest cart's **raw** bearer token — never its digest. The caller proves possession of the credential that already lets them read and modify that cart, so adoption grants not…
org_idstringNeinRequired only when the caller manages billing for more than one organization.

Antwort

NameTypErforderlichWas es ist
cart_idstringJaThe organization cart the items now live in. Empty when the guest basket held nothing — which is a success with zero moved, not a failure.
adoptedintegerJaHow many items were carried over.

Fehler, die dieser Endpunkt zurückgeben kann

401 · 403 · 422 · 429