Medusa Storefront API (1.0.0)
API reference for Medusa's Storefront endpoints. All endpoints are prefixed with /store
.
In many endpoints you'll find an expand
query parameter that can be passed to the endpoint. You can use the expand
query parameter to unpack an entity's relations and return them in the response.
For example, when you list customers you can also retrieve their groups by passing to the expand
query parameter the value groups
.
You can expand more than one relation by separating the relations in the expand
query parameter with a comma. For example, to retrieve both the orders and the groups of a customer, pass to the expand
query parameter the value groups,orders
.
Please note that the parameters you pass to expand
replace any relations that are expanded by default.
In many endpoints you'll find a fields
query parameter that can be passed to the endpoint. You can use the fields
query parameter to specify which fields in the entity should be returned in the response.
You can pass more than one field by seperating the field names in the fields
query parameter with a comma.
Only the fields you pass to field
will be retrieved and returned in the response. Any fields that are returned by default will not be returned in this case. This does not affect relations.
For example, to only select the title
and description
fields of a product, pass to the fields
query parameter the value title,description
.
Query Parameters
In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters limit
and offset
.
limit
is used to specify the maximum number of items that can be return in the response. offset
is used to specify how many items to skip before returning the resulting entities.
You can use the offset
query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on.
Response Fields
In listing fields, aside from the entities retrieved, there are three pagination-related fields returned: count
, limit
, and offset
.
Similarly to the query parameters, limit
is the maximum number of items that can be returned in the response, and field
is the number of items that were skipped before the entities in the result.
count
is the total number of available items of this entity. It can be used to determine how many pages are there.
For example, if the count
is 100 and the limit
is 50, you can divide the count
by the limit
to get the number of pages: 100/50 = 2 pages
.
Customer Login
Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser.
Request Body schema: application/json
email required | string The Customer's email. |
password required | string The Customer's password. |
Responses
Response Schema: application/json
object (Customer) Represents a customer | |||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "string",
- "password": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": [ ],
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": { },
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Customer Log out
Destroys a Customer's authenticated session.
Authorizations:
Responses
Request samples
- cURL
curl --location --request DELETE 'https://medusa-url.com/store/auth' \ --header 'Cookie: connect.sid={sid}'
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Get Current Customer
Gets the currently logged in Customer.
Authorizations:
Responses
Response Schema: application/json
object (Customer) Represents a customer | |||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged medusa.auth.getSession() .then(({ customer }) => { console.log(customer.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": [ ],
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": { },
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Check if email exists
Checks if a Customer with the given email has signed up.
path Parameters
email required | string <email> The email to check if exists. |
Responses
Response Schema: application/json
exists | boolean Whether email exists or not. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.auth.exists('user@example.com')
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "exists": true
}
Add a Shipping Method
Adds a Shipping Method to the Cart.
path Parameters
id required | string The cart ID. |
Request Body schema: application/json
option_id required | string ID of the shipping option to create the method from |
data | object Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "option_id": "string",
- "data": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Calculate Cart Taxes
Calculates taxes for a cart. Depending on the cart's region this may involve making 3rd party API calls to a Tax Provider service.
path Parameters
id required | string The Cart ID. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- cURL
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/taxes'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Complete a Cart
Completes a cart. The following steps will be performed. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header Idempotency-Key
. If not provided, we will generate one for the request.
path Parameters
id required | string The Cart id. |
Responses
Response Schema: application/json
type | string Enum: "order" "cart" "swap" The type of the data property. |
Order (object) or Cart (object) or Swap (object) The data of the result object. Its type depends on the type field. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.carts.complete(cart_id) .then(({ cart }) => { console.log(cart.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "type": "order",
- "data": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": true
}, - "tax_rate": 0,
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "fulfillments": [
- {
- "id": null,
- "claim_order_id": null,
- "claim_order": { },
- "swap_id": null,
- "swap": { },
- "order_id": null,
- "order": { },
- "provider_id": null,
- "location_id": null,
- "provider": null,
- "items": [ ],
- "tracking_links": [ ],
- "tracking_numbers": [ ],
- "data": { },
- "shipped_at": null,
- "no_notification": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- {
- "id": null,
- "order_id": null,
- "order": null,
- "changes": [ ],
- "internal_note": null,
- "created_by": null,
- "requested_by": null,
- "requested_at": null,
- "confirmed_by": null,
- "confirmed_at": null,
- "declined_by": null,
- "declined_at": null,
- "declined_reason": null,
- "subtotal": null,
- "discount_total": null,
- "shipping_total": null,
- "gift_card_total": null,
- "gift_card_tax_total": null,
- "tax_total": null,
- "total": null,
- "difference_due": null,
- "status": null,
- "items": [ ],
- "payment_collection_id": null,
- "payment_collection": null,
- "created_at": null,
- "updated_at": null
}
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": { },
- "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Create a Cart
Creates a Cart within the given region and with the initial items. If no region_id
is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set.
Request Body schema: application/json
region_id | string The ID of the Region to create the Cart in. |
sales_channel_id | string [EXPERIMENTAL] The ID of the Sales channel to create the Cart in. |
country_code | |
Array of objects An optional array of | |
context | object Example: {"ip":"::1","user_agent":"Chrome"} An optional object to provide context to the Cart. The |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "region_id": "string",
- "sales_channel_id": "string",
- "country_code": "string",
- "items": [
- {
- "variant_id": "string",
- "quantity": 0
}
], - "context": {
- "ip": "::1",
- "user_agent": "Chrome"
}
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Create Payment Sessions
Creates Payment Sessions for each of the available Payment Providers in the Cart's Region.
path Parameters
id required | string The id of the Cart. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.carts.createPaymentSessions(cart_id) .then(({ cart }) => { console.log(cart.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Remove Discount
Removes a Discount from a Cart.
path Parameters
id required | string The id of the Cart. |
code required | string The unique Discount code. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.carts.deleteDiscount(cart_id, code) .then(({ cart }) => { console.log(cart.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Delete a Line Item
Removes a Line Item from a Cart.
path Parameters
id required | string The id of the Cart. |
line_id required | string The id of the Line Item. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.carts.lineItems.delete(cart_id, line_id) .then(({ cart }) => { console.log(cart.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Update a Line Item
Updates a Line Item if the desired quantity can be fulfilled.
path Parameters
id required | string The id of the Cart. |
line_id required | string The id of the Line Item. |
Request Body schema: application/json
quantity required | integer The quantity to set the Line Item to. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "quantity": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Delete a Payment Session
Deletes a Payment Session on a Cart. May be useful if a payment has failed.
path Parameters
id required | string The id of the Cart. |
provider_id required | string The id of the Payment Provider used to create the Payment Session to be deleted. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.carts.deletePaymentSession(cart_id, 'manual') .then(({ cart }) => { console.log(cart.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Update a Payment Session
Updates a Payment Session with additional data.
path Parameters
id required | string The id of the Cart. |
provider_id required | string The id of the payment provider. |
Request Body schema: application/json
data required | object The data to update the payment session with. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "data": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "discounts": [
- { }
], - "gift_cards": [
- { }
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null
}
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": null,
- "order_id": null,
- "order": { },
- "return_id": null,
- "return_order": { },
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null
}
], - "type": "default",
- "completed_at": "2019-08-24T14:15:22Z",
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "context": {
- "ip": "::1",
- "user_agent": "PostmanRuntime/7.29.2"
}, - "sales_channel_id": null,
- "sales_channel": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "shipping_total": 1000,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Get a Cart
Retrieves a Cart.
path Parameters
id required | string The id of the Cart. |
Responses
Response Schema: application/json
object (Cart) Represents a user cart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.carts.retrieve(cart_id) .then(({ cart }) => { console.log(cart.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": [
- { }
], - "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": { },
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": { },
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,