docs: add clarification for set cart's customer API route (#13506)

This commit is contained in:
Shahed Nasser
2025-09-15 14:32:36 +03:00
committed by GitHub
parent 2ceed66b4d
commit 9f7df88c84
33 changed files with 92 additions and 32 deletions

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to set the cart's customer
sdk.store.cart.transferCart("cart_123")
.then(({ cart }) => {
console.log(cart)

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to retrieve their details
sdk.store.customer.retrieve()
.then(({ customer }) => {
console.log(customer)

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to update their details
sdk.store.customer.update({
first_name: "John"
})

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to list their addresses
sdk.store.customer.listAddress()
.then(({ addresses, count, offset, limit }) => {
console.log(addresses)

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to create an address
sdk.store.customer.createAddress({
country_code: "us"
})

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to delete their address
sdk.store.customer.deleteAddress("caddr_123")
.then(({ deleted, parent: customer }) => {
console.log(customer)

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to retrieve their address
sdk.store.customer.retrieveAddress(
"caddr_123"
)

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to update their address
sdk.store.customer.updateAddress(
"caddr_123",
{

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to list their orders
sdk.store.order.list()
.then(({ orders, count, offset, limit }) => {
console.log(orders)

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to cancel the order transfer
sdk.store.order.cancelTransfer(
"order_123",
{},

View File

@@ -12,6 +12,7 @@ export const sdk = new Medusa({
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
// TODO must be authenticated as the customer to request the order transfer
sdk.store.order.requestTransfer(
"order_123",
{

View File

@@ -1,2 +1,3 @@
curl -X POST '{backend_url}/store/carts/{id}/customer' \
-H 'Authorization: Bearer {access_token}' \
-H 'x-publishable-api-key: {your_publishable_api_key}'

View File

@@ -1,3 +1,3 @@
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
-H 'Authorization: Bearer {access_token}'
-H 'Authorization: Bearer {access_token}' \
-H 'x-publishable-api-key: {your_publishable_api_key}'

View File

@@ -1,2 +1,3 @@
curl '{backend_url}/store/orders' \
-H 'Authorization: Bearer {access_token}' \
-H 'x-publishable-api-key: {your_publishable_api_key}'

View File

@@ -1,2 +1,3 @@
curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
-H 'Authorization: Bearer {access_token}' \
-H 'x-publishable-api-key: {your_publishable_api_key}'

View File

@@ -1,2 +1,3 @@
curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
-H 'Authorization: Bearer {access_token}' \
-H 'x-publishable-api-key: {your_publishable_api_key}'