import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.retrieve("cart_123")
.then(({ cart }) => {
console.log(cart)
}){
"cart": {
"id": "<string>",
"currency_code": "usd",
"original_item_total": 123,
"original_item_subtotal": 123,
"original_item_tax_total": 123,
"item_total": 123,
"item_subtotal": 123,
"item_tax_total": 123,
"original_total": 123,
"original_subtotal": 123,
"original_tax_total": 123,
"total": 123,
"subtotal": 123,
"tax_total": 123,
"discount_total": 123,
"discount_tax_total": 123,
"gift_card_total": 123,
"gift_card_tax_total": 123,
"shipping_total": 123,
"shipping_subtotal": 123,
"shipping_tax_total": 123,
"original_shipping_total": 123,
"original_shipping_subtotal": 123,
"original_shipping_tax_total": 123,
"promotions": [
{
"id": "<string>",
"code": "<string>",
"is_automatic": true,
"application_method": {
"value": "<string>",
"type": "fixed",
"currency_code": "<string>"
}
}
],
"region": {
"id": "<string>",
"name": "<string>",
"currency_code": "usd",
"automatic_taxes": true,
"countries": [
{
"id": "<string>",
"iso_2": "us",
"iso_3": "usa",
"num_code": 840,
"name": "<string>",
"display_name": "<string>"
}
],
"payment_providers": [
{
"id": "<string>",
"is_enabled": true
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"region_id": "<string>",
"customer_id": "<string>",
"sales_channel_id": "<string>",
"email": "[email protected]",
"shipping_address": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "us",
"province": "us-ca",
"postal_code": "<string>",
"metadata": {}
},
"billing_address": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "us",
"province": "us-ca",
"postal_code": "<string>",
"metadata": {}
},
"items": [
{
"id": "<string>",
"title": "<string>",
"quantity": 123,
"requires_shipping": true,
"is_discountable": true,
"is_tax_inclusive": true,
"unit_price": 123,
"cart": {},
"cart_id": "<string>",
"original_total": 123,
"original_subtotal": 123,
"original_tax_total": 123,
"item_total": 123,
"item_subtotal": 123,
"item_tax_total": 123,
"total": 123,
"subtotal": 123,
"tax_total": 123,
"discount_total": 123,
"discount_tax_total": 123,
"subtitle": "<string>",
"thumbnail": "<string>",
"product": {
"length": 123,
"title": "<string>",
"status": "draft",
"options": [
{
"id": "<string>",
"title": "<string>",
"product": {},
"product_id": "<string>",
"values": [
{
"id": "<string>",
"value": "<string>",
"option": {},
"option_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"description": "<string>",
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"variants": [
{
"options": [
{
"id": "<string>",
"value": "<string>",
"option": {},
"option_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"length": 123,
"title": "<string>",
"id": "<string>",
"width": 123,
"weight": 123,
"height": 123,
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"sku": "<string>",
"barcode": "<string>",
"ean": "<string>",
"upc": "<string>",
"allow_backorder": true,
"manage_inventory": true,
"product": {},
"metadata": {},
"product_id": "<string>",
"inventory_quantity": 123,
"variant_rank": 123,
"calculated_price": {
"id": "<string>",
"calculated_amount": 123,
"original_amount": 123,
"currency_code": "usd",
"original_amount_with_tax": 123,
"original_amount_without_tax": 123,
"is_calculated_price_price_list": true,
"is_calculated_price_tax_inclusive": true,
"calculated_amount_with_tax": 123,
"calculated_amount_without_tax": 123,
"is_original_price_price_list": true,
"is_original_price_tax_inclusive": true,
"calculated_price": {},
"original_price": {}
}
}
],
"handle": "<string>",
"subtitle": "<string>",
"is_giftcard": true,
"thumbnail": "<string>",
"width": 123,
"weight": 123,
"height": 123,
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"collection_id": "<string>",
"type_id": "<string>",
"images": [
{
"id": "<string>",
"url": "<string>",
"rank": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {}
}
],
"discountable": true,
"external_id": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"categories": [
{}
],
"type": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"value": "<string>",
"metadata": {},
"deleted_at": "2023-11-07T05:31:56Z"
},
"metadata": {},
"collection": {
"id": "<string>",
"title": "<string>",
"handle": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {},
"products": [
{}
]
},
"tags": [
{
"id": "<string>",
"value": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {}
}
]
},
"product_id": "<string>",
"product_title": "<string>",
"product_description": "<string>",
"product_subtitle": "<string>",
"product_type": "<string>",
"product_collection": "<string>",
"product_handle": "<string>",
"variant": {
"options": [
{
"id": "<string>",
"value": "<string>",
"option": {},
"option_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"length": 123,
"title": "<string>",
"id": "<string>",
"width": 123,
"weight": 123,
"height": 123,
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"sku": "<string>",
"barcode": "<string>",
"ean": "<string>",
"upc": "<string>",
"allow_backorder": true,
"manage_inventory": true,
"product": {},
"metadata": {},
"product_id": "<string>",
"inventory_quantity": 123,
"variant_rank": 123,
"calculated_price": {
"id": "<string>",
"calculated_amount": 123,
"original_amount": 123,
"currency_code": "usd",
"original_amount_with_tax": 123,
"original_amount_without_tax": 123,
"is_calculated_price_price_list": true,
"is_calculated_price_tax_inclusive": true,
"calculated_amount_with_tax": 123,
"calculated_amount_without_tax": 123,
"is_original_price_price_list": true,
"is_original_price_tax_inclusive": true,
"calculated_price": {},
"original_price": {}
}
},
"variant_id": "<string>",
"variant_sku": "<string>",
"variant_barcode": "<string>",
"variant_title": "<string>",
"variant_option_values": {
"Color": "Red"
},
"compare_at_unit_price": 123,
"tax_lines": [
{
"item": {},
"item_id": "<string>",
"total": 123,
"subtotal": 123,
"id": "<string>",
"code": "<string>",
"rate": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"tax_rate_id": "<string>",
"provider_id": "<string>"
}
],
"adjustments": [
{
"item": {},
"item_id": "<string>",
"id": "<string>",
"amount": 123,
"cart_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"promotion_id": "<string>",
"provider_id": "<string>"
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"shipping_methods": [
{
"id": "<string>",
"cart_id": "<string>",
"name": "<string>",
"amount": 123,
"is_tax_inclusive": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"original_total": 123,
"original_subtotal": 123,
"original_tax_total": 123,
"total": 123,
"subtotal": 123,
"tax_total": 123,
"discount_total": 123,
"discount_tax_total": 123,
"description": "<string>",
"shipping_option_id": "<string>",
"data": {},
"metadata": {},
"tax_lines": [
{
"shipping_method": {},
"shipping_method_id": "<string>",
"total": 123,
"subtotal": 123,
"id": "<string>",
"code": "<string>",
"rate": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"tax_rate_id": "<string>",
"provider_id": "<string>"
}
],
"adjustments": [
{
"shipping_method": {},
"id": "<string>",
"amount": 123,
"cart_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"promotion_id": "<string>",
"provider_id": "<string>"
}
]
}
],
"payment_collection": {
"id": "<string>",
"currency_code": "<string>",
"amount": 123,
"status": "canceled",
"payment_providers": [
{
"id": "<string>"
}
],
"authorized_amount": 123,
"captured_amount": 123,
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"metadata": {},
"payment_sessions": [
{
"id": "<string>",
"amount": 123,
"currency_code": "usd",
"provider_id": "<string>",
"data": {},
"status": "authorized",
"context": {
"customer": {
"id": "cus_123"
}
},
"authorized_at": "2023-11-07T05:31:56Z",
"payment_collection": {},
"payment": {
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}
}
],
"payment_collection": {},
"payment_session": {}
}
}
],
"payments": [
{
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}
}
],
"payment_collection": {},
"payment_session": {}
}
]
},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Retrieve a cart by its ID. You can expand the cart’s relations or select the fields that should be returned.
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.retrieve("cart_123")
.then(({ cart }) => {
console.log(cart)
}){
"cart": {
"id": "<string>",
"currency_code": "usd",
"original_item_total": 123,
"original_item_subtotal": 123,
"original_item_tax_total": 123,
"item_total": 123,
"item_subtotal": 123,
"item_tax_total": 123,
"original_total": 123,
"original_subtotal": 123,
"original_tax_total": 123,
"total": 123,
"subtotal": 123,
"tax_total": 123,
"discount_total": 123,
"discount_tax_total": 123,
"gift_card_total": 123,
"gift_card_tax_total": 123,
"shipping_total": 123,
"shipping_subtotal": 123,
"shipping_tax_total": 123,
"original_shipping_total": 123,
"original_shipping_subtotal": 123,
"original_shipping_tax_total": 123,
"promotions": [
{
"id": "<string>",
"code": "<string>",
"is_automatic": true,
"application_method": {
"value": "<string>",
"type": "fixed",
"currency_code": "<string>"
}
}
],
"region": {
"id": "<string>",
"name": "<string>",
"currency_code": "usd",
"automatic_taxes": true,
"countries": [
{
"id": "<string>",
"iso_2": "us",
"iso_3": "usa",
"num_code": 840,
"name": "<string>",
"display_name": "<string>"
}
],
"payment_providers": [
{
"id": "<string>",
"is_enabled": true
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"region_id": "<string>",
"customer_id": "<string>",
"sales_channel_id": "<string>",
"email": "[email protected]",
"shipping_address": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "us",
"province": "us-ca",
"postal_code": "<string>",
"metadata": {}
},
"billing_address": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "us",
"province": "us-ca",
"postal_code": "<string>",
"metadata": {}
},
"items": [
{
"id": "<string>",
"title": "<string>",
"quantity": 123,
"requires_shipping": true,
"is_discountable": true,
"is_tax_inclusive": true,
"unit_price": 123,
"cart": {},
"cart_id": "<string>",
"original_total": 123,
"original_subtotal": 123,
"original_tax_total": 123,
"item_total": 123,
"item_subtotal": 123,
"item_tax_total": 123,
"total": 123,
"subtotal": 123,
"tax_total": 123,
"discount_total": 123,
"discount_tax_total": 123,
"subtitle": "<string>",
"thumbnail": "<string>",
"product": {
"length": 123,
"title": "<string>",
"status": "draft",
"options": [
{
"id": "<string>",
"title": "<string>",
"product": {},
"product_id": "<string>",
"values": [
{
"id": "<string>",
"value": "<string>",
"option": {},
"option_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"description": "<string>",
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"variants": [
{
"options": [
{
"id": "<string>",
"value": "<string>",
"option": {},
"option_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"length": 123,
"title": "<string>",
"id": "<string>",
"width": 123,
"weight": 123,
"height": 123,
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"sku": "<string>",
"barcode": "<string>",
"ean": "<string>",
"upc": "<string>",
"allow_backorder": true,
"manage_inventory": true,
"product": {},
"metadata": {},
"product_id": "<string>",
"inventory_quantity": 123,
"variant_rank": 123,
"calculated_price": {
"id": "<string>",
"calculated_amount": 123,
"original_amount": 123,
"currency_code": "usd",
"original_amount_with_tax": 123,
"original_amount_without_tax": 123,
"is_calculated_price_price_list": true,
"is_calculated_price_tax_inclusive": true,
"calculated_amount_with_tax": 123,
"calculated_amount_without_tax": 123,
"is_original_price_price_list": true,
"is_original_price_tax_inclusive": true,
"calculated_price": {},
"original_price": {}
}
}
],
"handle": "<string>",
"subtitle": "<string>",
"is_giftcard": true,
"thumbnail": "<string>",
"width": 123,
"weight": 123,
"height": 123,
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"collection_id": "<string>",
"type_id": "<string>",
"images": [
{
"id": "<string>",
"url": "<string>",
"rank": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {}
}
],
"discountable": true,
"external_id": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"categories": [
{}
],
"type": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"value": "<string>",
"metadata": {},
"deleted_at": "2023-11-07T05:31:56Z"
},
"metadata": {},
"collection": {
"id": "<string>",
"title": "<string>",
"handle": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {},
"products": [
{}
]
},
"tags": [
{
"id": "<string>",
"value": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {}
}
]
},
"product_id": "<string>",
"product_title": "<string>",
"product_description": "<string>",
"product_subtitle": "<string>",
"product_type": "<string>",
"product_collection": "<string>",
"product_handle": "<string>",
"variant": {
"options": [
{
"id": "<string>",
"value": "<string>",
"option": {},
"option_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"length": 123,
"title": "<string>",
"id": "<string>",
"width": 123,
"weight": 123,
"height": 123,
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"sku": "<string>",
"barcode": "<string>",
"ean": "<string>",
"upc": "<string>",
"allow_backorder": true,
"manage_inventory": true,
"product": {},
"metadata": {},
"product_id": "<string>",
"inventory_quantity": 123,
"variant_rank": 123,
"calculated_price": {
"id": "<string>",
"calculated_amount": 123,
"original_amount": 123,
"currency_code": "usd",
"original_amount_with_tax": 123,
"original_amount_without_tax": 123,
"is_calculated_price_price_list": true,
"is_calculated_price_tax_inclusive": true,
"calculated_amount_with_tax": 123,
"calculated_amount_without_tax": 123,
"is_original_price_price_list": true,
"is_original_price_tax_inclusive": true,
"calculated_price": {},
"original_price": {}
}
},
"variant_id": "<string>",
"variant_sku": "<string>",
"variant_barcode": "<string>",
"variant_title": "<string>",
"variant_option_values": {
"Color": "Red"
},
"compare_at_unit_price": 123,
"tax_lines": [
{
"item": {},
"item_id": "<string>",
"total": 123,
"subtotal": 123,
"id": "<string>",
"code": "<string>",
"rate": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"tax_rate_id": "<string>",
"provider_id": "<string>"
}
],
"adjustments": [
{
"item": {},
"item_id": "<string>",
"id": "<string>",
"amount": 123,
"cart_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"promotion_id": "<string>",
"provider_id": "<string>"
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"shipping_methods": [
{
"id": "<string>",
"cart_id": "<string>",
"name": "<string>",
"amount": 123,
"is_tax_inclusive": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"original_total": 123,
"original_subtotal": 123,
"original_tax_total": 123,
"total": 123,
"subtotal": 123,
"tax_total": 123,
"discount_total": 123,
"discount_tax_total": 123,
"description": "<string>",
"shipping_option_id": "<string>",
"data": {},
"metadata": {},
"tax_lines": [
{
"shipping_method": {},
"shipping_method_id": "<string>",
"total": 123,
"subtotal": 123,
"id": "<string>",
"code": "<string>",
"rate": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"tax_rate_id": "<string>",
"provider_id": "<string>"
}
],
"adjustments": [
{
"shipping_method": {},
"id": "<string>",
"amount": 123,
"cart_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"promotion_id": "<string>",
"provider_id": "<string>"
}
]
}
],
"payment_collection": {
"id": "<string>",
"currency_code": "<string>",
"amount": 123,
"status": "canceled",
"payment_providers": [
{
"id": "<string>"
}
],
"authorized_amount": 123,
"captured_amount": 123,
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"metadata": {},
"payment_sessions": [
{
"id": "<string>",
"amount": 123,
"currency_code": "usd",
"provider_id": "<string>",
"data": {},
"status": "authorized",
"context": {
"customer": {
"id": "cus_123"
}
},
"authorized_at": "2023-11-07T05:31:56Z",
"payment_collection": {},
"payment": {
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}
}
],
"payment_collection": {},
"payment_session": {}
}
}
],
"payments": [
{
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}
}
],
"payment_collection": {},
"payment_session": {}
}
]
},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Publishable API Key created in the Medusa Admin.
The cart's ID.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
OK
The cart's details.
The cart's details.
Show child attributes
The cart's ID.
The cart's currency code.
"usd"
The cart items' total including taxes, excluding promotions.
The cart items' total excluding taxes, including promotions.
The cart items' tax total excluding promotions.
The cart items' total including taxes and promotions.
The cart items' total excluding taxes, including promotions.
The cart items' tax total including promotions.
The cart's total including taxes, excluding promotions.
The cart's total excluding taxes, including promotions.
The cart's tax total excluding promotions.
The cart's total including taxes and promotions.
The cart's total excluding taxes, including promotions.
The cart's tax total including promotions.
The cart's discount total.
The tax total applied on the discounted amount.
The total gift card amount applied on the cart.
The total taxes applied on the gift card amount.
The cart's shipping total including taxes and promotions.
The cart's shipping total excluding taxes, including promotions.
The total taxes applied on the cart's shipping amount.
The cart's shipping total including taxes, excluding promotions.
The cart's shipping total excluding taxes, including promotions.
The total taxes applied on the cart's shipping amount.
The cart's promotions.
Show child attributes
The promotion's ID.
The promotion's code.
The promotion's is automatic.
The promotion's application method.
Show child attributes
The application method's value.
The application method's type.
fixed, percentage The application method's currency code.
The region's details.
Show child attributes
The region's ID.
The region's name.
The region's currency code.
"usd"
Whether taxes are calculated automatically during checkout for carts that belong to this region.
The region's countries.
Show child attributes
The country's ID.
The country's iso 2.
"us"
The country's iso 3.
"usa"
The country's num code.
840
The country's name.
The country's display name.
The region's metadata, can hold custom key-value pairs.
The date the region was created.
The date the region was updated.
The ID of the region the cart belongs to.
The ID of the customer the cart belongs to.
The ID of the cart's sales channel. Only products that belong to the same sales channel can be added to the cart. The created order will be associated with the same sales channel.
The email of the customer the cart belongs to.
The address's details.
Show child attributes
The address's ID.
The date the address was created.
The date the address was updated.
The ID of the customer the address belongs to.
The address's first name.
The address's last name.
The address's phone.
The address's company.
The address's first line.
The address's second line.
The address's city.
The address's country code.
"us"
The address's lower-case ISO 3166-2 province code.
"us-ca"
The address's postal code.
The address's metadata, can hold custom key-value pairs.
The address's details.
Show child attributes
The address's ID.
The date the address was created.
The date the address was updated.
The ID of the customer the address belongs to.
The address's first name.
The address's last name.
The address's phone.
The address's company.
The address's first line.
The address's second line.
The address's city.
The address's country code.
"us"
The address's lower-case ISO 3166-2 province code.
"us-ca"
The address's postal code.
The address's metadata, can hold custom key-value pairs.
The cart's items.
Show child attributes
The item's ID.
The item's title.
The item's quantity.
Whether the item requires shipping.
Whether the item is discountable.
Whether the item's price includes taxes.
The price of a single quantity of the item.
The ID of the cart that the line item belongs to.
The item's total including taxes, excluding promotions.
The item's total excluding taxes, including promotions.
The total taxes of the item excluding promotions.
The item's total including taxes and promotions.
The item's total excluding taxes, including promotions.
The total taxes of the item including promotions.
The item's total including taxes and promotions.
The item's total excluding taxes, including promotions.
The total taxes of the item including promotions.
The total discount of the item.
The total taxes applied on the discounted amount.
The item's subtitle.
The item's thumbnail URL.
The product's details.
Show child attributes
The product's length.
The product's title.
The product's status.
draft, proposed, published, rejected The product's options.
Show child attributes
The option's ID.
The option's title.
The ID of the product this option belongs to.
The option's values.
Show child attributes
The value's ID.
The value.
The ID of the option this value belongs to.
The value's metadata, can hold custom key-value pairs.
The date the value was created.
The date the value was updated.
The date the value was deleted.
The option's metadata, can hold custom key-value pairs.
The date the product option was created.
The date the product option was updated.
The date the product option was deleted.
The product's description.
The product's ID.
The date the product was created.
The date the product was updated.
The product's variants.
Show child attributes
The variant's options.
Show child attributes
The value's ID.
The value.
The ID of the option this value belongs to.
The value's metadata, can hold custom key-value pairs.
The date the value was created.
The date the value was updated.
The date the value was deleted.
The variant's length.
The variant's title.
The variant's ID.
The variant's width.
The variant's weight.
The variant's height.
The variant's origin country.
The variant's HS code.
The variant's MID code.
The variant's material.
The date the variant was created.
The date the variant was updated.
The date the variant was deleted.
The variant's SKU.
The variant's barcode.
The variant's EAN.
The variant's UPC.
Whether the variant can be ordered even if it's not in stock.
Whether Medusa manages the variant's inventory. If disabled, the variant is always considered in stock.
The variant's metadata, can hold custom key-value pairs.
The ID of the product this variant belongs to.
The variant's inventory quantity. This property is only available if you pass +variants.inventory_quantity in the fields query parameter.
The variant's rank among its siblings.
The calculated price's details.
Show child attributes
The calculated price's ID.
The amount of the calculated price, or null if there isn't a calculated price. This is the amount shown to the customer.
The amount of the original price, or null if there isn't an original price. This amount is useful to compare with the calculated_amount, such as to check for discounted value.
The calculated price's currency code.
"usd"
The amount of the original price with taxes applied.
The amount of the original price without taxes.
Whether the calculated price belongs to a price list.
Whether the calculated price is tax inclusive.
The calculated price's amount with taxes applied.
The calculated price's amount without taxes applied.
Whether the original price belongs to a price list.
Whether the original price is tax inclusive.
The calculated price's details.
The original price's details.
The product's handle.
The product's subtitle.
Whether the product is a gift card.
The product's thumbnail URL.
The product's width.
The product's weight.
The product's height.
The product's origin country.
The product's HS code.
The product's MID code.
The product's material.
The ID of the collection that the product belongs to.
The ID of the product's type.
The product's images.
Show child attributes
The image's ID.
The image's URL.
The image's rank among its sibling images
The date the image was created.
The date the image was updated.
The date the image was deleted.
The image's metadata, can hold custom key-value pairs.
Whether the product can be discounted.
The ID of the product in an external service or system.
The date the product was deleted.
The product's categories.
The product type's details.
Show child attributes
The product type's ID.
The date the product type was created.
The date the product type was updated.
The type's value.
The product type's metadata, can hold custom key-value pairs.
The date the product type was deleted.
The product's metadata, can hold custom key-value pairs.
The collection's details.
Show child attributes
The collection's ID.
The collection's title.
The collection's handle.
The date the collection was created.
The date the collection was updated.
The date the collection was deleted.
The collection's metadata, can hold custom key-value pairs.
The collection's products.
The product's tags.
Show child attributes
The tag's ID.
The tag's value.
The date the tag was created.
The date the tag was updated.
The date the tag was deleted.
The tag's metadata, can hold custom key-value pairs.
The ID of the associated product.
The item's product title.
The item's product description.
The item's product subtitle.
The ID of the associated product's type.
The ID of the associated product's collection.
The item's product handle.
The variant's details.
Show child attributes
The variant's options.
Show child attributes
The value's ID.
The value.
The ID of the option this value belongs to.
The value's metadata, can hold custom key-value pairs.
The date the value was created.
The date the value was updated.
The date the value was deleted.
The variant's length.
The variant's title.
The variant's ID.
The variant's width.
The variant's weight.
The variant's height.
The variant's origin country.
The variant's HS code.
The variant's MID code.
The variant's material.
The date the variant was created.
The date the variant was updated.
The date the variant was deleted.
The variant's SKU.
The variant's barcode.
The variant's EAN.
The variant's UPC.
Whether the variant can be ordered even if it's not in stock.
Whether Medusa manages the variant's inventory. If disabled, the variant is always considered in stock.
The variant's metadata, can hold custom key-value pairs.
The ID of the product this variant belongs to.
The variant's inventory quantity. This property is only available if you pass +variants.inventory_quantity in the fields query parameter.
The variant's rank among its siblings.
The calculated price's details.
Show child attributes
The calculated price's ID.
The amount of the calculated price, or null if there isn't a calculated price. This is the amount shown to the customer.
The amount of the original price, or null if there isn't an original price. This amount is useful to compare with the calculated_amount, such as to check for discounted value.
The calculated price's currency code.
"usd"
The amount of the original price with taxes applied.
The amount of the original price without taxes.
Whether the calculated price belongs to a price list.
Whether the calculated price is tax inclusive.
The calculated price's amount with taxes applied.
The calculated price's amount without taxes applied.
Whether the original price belongs to a price list.
Whether the original price is tax inclusive.
The calculated price's details.
The original price's details.
The ID of the associated product variant.
The item's variant SKU.
The item's variant barcode.
The item's variant title.
The associated variant's value for the product's options.
{ "Color": "Red" }The original price of the item before a promotion or sale.
The item's tax lines.
Show child attributes
The details of the item that the tax line belongs to. The details of the item that the tax line belongs to.
The ID of the line item this tax line belongs to.
The item's total including taxes and promotions.
The item's total excluding taxes, including promotions.
The tax line's ID.
The code that the tax rate is identified by.
The charged rate.
The date the tax line was created.
The date the tax line was updated.
The tax line's description.
The ID of the applied tax rate.
The ID of the tax provider used to calculate the tax line.
The item's adjustments.
Show child attributes
The details of the item that the adjustment belongs to. The details of the item that the adjustment belongs to.
The ID of the item that the adjustment belongs to.
The adjustment's ID.
The adjustment's amount.
The ID of the associated cart.
The date the adjustment was created.
The date the adjustment was updated.
The adjustment's code.
The adjustment's description.
The ID of the applied promotion.
The adjustment's provider ID.
The item's metadata, can hold custom key-value pairs.
The date the item was created.
The date the item was updated.
The date the item was deleted.
The cart's shipping methods.
Show child attributes
The shipping method's ID.
The ID of the cart this shipping method belongs to.
The shipping method's name.
The shipping method's amount.
Whether the shipping method's amount is tax inclusive.
The date the shipping method was created.
The date the shipping method was updated.
The shipping method's total including taxes, excluding promotions.
The shipping method's total excluding taxes, including promotions.
The total taxes applied on the shipping method's amount including promotions.
The shipping method's total amount including taxes and promotions.
The shipping method's total amount excluding taxes, including promotions.
The total taxes applied on the shipping method's amount including promotions.
The total amount discounted.
The taxes applied on the discounted amount.
The shipping method's description.
The ID of the shipping option this method was created from.
The shipping method's data, useful for fulfillment handling by third-party services.
The shipping method's metadata, can hold custom key-value pairs.
The shipping method's tax lines.
Show child attributes
The details of the method that the tax line belongs to. The details of the method that the tax line belongs to.
The ID of the shipping method this tax line belongs to.
The method's total including taxes and promotions.
The method's total excluding taxes, including promotions.
The tax line's ID.
The code that the tax rate is identified by.
The charged rate.
The date the tax line was created.
The date the tax line was updated.
The tax line's description.
The ID of the applied tax rate.
The ID of the tax provider used to calculate the tax line.
The shipping method's adjustments, such as applied promotions.
Show child attributes
The details of the method that the adjustment belongs to. The details of the method that the adjustment belongs to.
The adjustment's ID.
The adjustment's amount.
The ID of the associated cart.
The date the adjustment was created.
The date the adjustment was updated.
The adjustment's code.
The adjustment's description.
The ID of the applied promotion.
The adjustment's provider ID.
The payment collection's details.
Show child attributes
The payment collection's ID.
The payment collection's currency code.
The total amount to be paid.
The payment collection's status.
canceled, not_paid, awaiting, authorized, partially_authorized The total authorized amount of the collection's payments.
The total captured amount of the collection's payments.
The total refunded amount of the collection's payments.
The date the payment collection was completed.
The date the payment collection was created.
The date the payment collection was updated.
The payment collection's metadata, can hold custom key-value pairs.
The payment collection's payment sessions.
Show child attributes
The payment session's ID.
The payment session's amount.
The payment session's currency code.
"usd"
The ID of the payment provider processing this session.
The payment session's data, useful for the payment provider processing the payment.
The payment session's status.
authorized, captured, canceled, pending, requires_more, error The context around the payment, such as the customer's details.
{ "customer": { "id": "cus_123" } }The date the payment session was authorized.
The payment's details.
Show child attributes
The payment's ID.
The payment's amount.
The payment's currency code.
The ID of the payment provider used to process this payment.
The amount authorized of the payment.
The payment's data, useful for processing by the payment provider.
The date the payment was created.
The date the payment was updated.
The date the payment was captured.
The date the payment was canceled.
The captured amount of the payment.
The refunded amount of the payment.
The details of payment captures.
Show child attributes
The payment capture's ID.
The captured amount.
The date the capture was created.
The ID of the user that captured the payment.
The details of payment refunds.
Show child attributes
The refund's ID.
The refund's amount.
The date the refund was created.
The ID of the refund reason.
More details about the refund.
The ID of the user that created the refund.
The refund reason's details.
Show child attributes
The refund reason's ID.
The refund reason's label.
The refund reason's metadata, can hold custom key-value pairs.
The date the refund reason was created.
The date the refund reason was updated.
The refund reason's description.
The payment collection's payments.
Show child attributes
The payment's ID.
The payment's amount.
The payment's currency code.
The ID of the payment provider used to process this payment.
The amount authorized of the payment.
The payment's data, useful for processing by the payment provider.
The date the payment was created.
The date the payment was updated.
The date the payment was captured.
The date the payment was canceled.
The captured amount of the payment.
The refunded amount of the payment.
The details of payment captures.
Show child attributes
The payment capture's ID.
The captured amount.
The date the capture was created.
The ID of the user that captured the payment.
The details of payment refunds.
Show child attributes
The refund's ID.
The refund's amount.
The date the refund was created.
The ID of the refund reason.
More details about the refund.
The ID of the user that created the refund.
The refund reason's details.
Show child attributes
The refund reason's ID.
The refund reason's label.
The refund reason's metadata, can hold custom key-value pairs.
The date the refund reason was created.
The date the refund reason was updated.
The refund reason's description.
The cart's metadata, can hold custom key-value pairs.
The date the cart was created.
The date the cart was updated.