commerce

POST /v1/carts/adopt

Carry a guest basket into the signed-in account.

Semua titik akhir commerce

Autentikasi

Kirim kunci API sebagai token bearer. Kunci tersebut harus memiliki izin billing.payment.manage; kunci tanpa izin tersebut akan ditolak dengan status 403, bukan 404.

Tempat ID organisasi Anda dimasukkan

Titik akhir ini memerlukan org_id sebagai field dalam bodi JSON.

ID organisasi Anda berada di layar kunci API di dasbor Anda, di sebelah kunci itu sendiri. Itu adalah ID yang sama dalam setiap panggilan yang Anda buat.

Coba

Ganti apa pun di dalam tanda kurung sudut dengan nilai Anda sendiri, dan placeholder kunci dengan kunci dari dasbor Anda.

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

Sudah masuk? Konsol API di dasbor Anda akan mengisi ID organisasi asli dan kunci Anda sendiri, serta menjalankan permintaan terhadap API langsung sehingga Anda dapat melihat respons aktualnya. Buka titik akhir ini di konsol API

Detail

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.

Isi permintaan

NamaJenisWajibTentang apa ini
tokenstringYaThe 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_idstringTidakRequired only when the caller manages billing for more than one organization.

Tanggapan

NamaJenisWajibTentang apa ini
cart_idstringYaThe organization cart the items now live in. Empty when the guest basket held nothing — which is a success with zero moved, not a failure.
adoptedintegerYaHow many items were carried over.

Kesalahan yang dapat dikembalikan oleh titik akhir ini

401 · 403 · 422 · 429