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.
Please note that the relations you pass to expand
replace any relations that are expanded by default in the request.
Expanding One Relation
For example, when you retrieve a product, you can retrieve its collection by passing to the expand
query parameter the value collection
:
curl "http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection"
Expanding Multiple Relations
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 variants and the collection of a product, pass to the expand
query parameter the value variants,collection
:
curl "http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection"
Prevent Expanding Relations
Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations.
For example:
curl "http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand"
This would retrieve the product with only its properties, without any relations like collection
.
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.
Please note that if you pass a fields
query parameter, only the fields you pass in the value along with the id
of the entity will be returned in the response.
Also, the fields
query parameter does not affect the expanded relations. You'll have to use the expand
parameter instead.
Selecting One Field
For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing title
as a value to the fields
query parameter:
curl "http://localhost:9000/store/products?fields=title"
As mentioned above, the expanded relations such as variants
will still be returned as they're not affected by the fields
parameter.
You can ensure that only the title
field is returned by passing an empty value to the expand
query parameter. For example:
curl "http://localhost:9000/store/products?fields=title&expand"
Selecting Multiple Fields
You can pass more than one field by seperating the field names in the fields
query parameter with a comma.
For example, to select the title
and handle
of a product:
curl "http://localhost:9000/store/products?fields=title,handle"
Retrieve Only the ID
You can pass an empty fields
query parameter to return only the ID of an entity. For example:
curl "http://localhost:9000/store/products?fields"
You can also pair with an empty expand
query parameter to ensure that the relations aren't retrieved as well. For example:
curl "http://localhost:9000/store/products?fields&expand"
This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman.
Strings
You can pass a string value in the form of <parameter_name>=<value>
.
For example:
curl "http://localhost:9000/store/products?title=Shirt"
If the string has any characters other than letters and numbers, you must encode them.
For example, if the string has spaces, you can encode the space with +
or %20
:
curl "http://localhost:9000/store/products?title=Blue%20Shirt"
You can use tools like this one to learn how a value can be encoded.
Integers
You can pass an integer value in the form of <parameter_name>=<value>
.
For example:
curl "http://localhost:9000/store/products?offset=1"
Boolean
You can pass a boolean value in the form of <parameter_name>=<value>
.
For example:
curl "http://localhost:9000/store/products?is_giftcard=true"
Date and DateTime
You can pass a date value in the form <parameter_name>=<value>
. The date must be in the format YYYY-MM-DD
.
For example:
curl -g "http://localhost:9000/store/products?created_at[lt]=2023-02-17"
You can also pass the time using the format YYYY-MM-DDTHH:MM:SSZ
. Please note that the T
and Z
here are fixed.
For example:
curl -g "http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z"
Array
Each array value must be passed as a separate query parameter in the form <parameter_name>[]=<value>
. You can also specify the index of each parameter in the brackets <parameter_name>[0]=<value>
.
For example:
curl -g "http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7"
Note that the -g
parameter passed to curl
disables errors being thrown for using the brackets. Read more here.
Object
Object parameters must be passed as separate query parameters in the form <parameter_name>[<key>]=<value>
.
For example:
curl -g "http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17"
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.
For example, to limit the number of products returned in the List Products endpoint:
curl "http://localhost:9000/store/products?limit=5"
Response Fields
In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: count
, limit
, and offset
.
Similar 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
.
Sort Order
The order
field available on endpoints supporting pagination allows you to sort the retrieved items by an attribute of that item. For example, you can sort products by their created_at
attribute by setting order
to created_at
:
curl "http://localhost:9000/list/products?order=created_at"
By default, the sort direction will be ascending. To change it to descending, pass a dash (-
) before the attribute name. For example:
curl "http://localhost:9000/list/products?order=-created_at"
This sorts the products by their created_at
attribute in the descending order.
Get Current Customer
Gets the currently logged in Customer.
Authorizations:
Responses
Response Schema: application/json
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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 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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
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 required | 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
}
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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Update a Cart
Updates a Cart.
path Parameters
id required | string The id of the Cart. |
Request Body schema: application/json
region_id | string The id of the Region to create the Cart in. |
country_code | |
string <email> An email to be used on the Cart. | |
sales_channel_id | string The ID of the Sales channel to update the Cart with. |
AddressPayload (object) or string The Address to be used for billing purposes. | |
AddressPayload (object) or string The Address to be used for shipping. | |
Array of objects An array of Gift Card codes to add to the Cart. | |
Array of objects An array of Discount codes to add to the Cart. | |
customer_id | string The ID of the Customer to associate the Cart with. |
context | object Example: {"ip":"::1","user_agent":"Chrome"} An optional object to provide context to the Cart. |
Responses
Response Schema: application/json
required | object (Cart) Represents a user cart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "region_id": "string",
- "country_code": "string",
- "email": "user@example.com",
- "sales_channel_id": "string",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "gift_cards": [
- {
- "code": "string"
}
], - "discounts": [
- {
- "code": "string"
}
], - "customer_id": "string",
- "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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 required | string Enum: "order" "cart" "swap" The type of the data property. |
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "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,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Add a Line Item
Generates a Line Item with a given Product Variant and adds it to the Cart
path Parameters
id required | string The id of the Cart to add the Line Item to. |
Request Body schema: application/json
variant_id required | string The id of the Product Variant to generate the Line Item from. |
quantity required | number The quantity of the Product Variant to add to the Line Item. |
metadata | object An optional key-value map with additional details about the Line Item. |
Responses
Response Schema: application/json
required | object (Cart) Represents a user cart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "variant_id": "string",
- "quantity": 0,
- "metadata": { }
}
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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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 | number The quantity to set the Line Item to. |
metadata | object An optional key-value map with additional details about the Line Item. If omitted, the metadata will remain unchanged." |
Responses
Response Schema: application/json
required | object (Cart) Represents a user cart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "quantity": 0,
- "metadata": { }
}
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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Select a Payment Session
Selects a Payment Session as the session intended to be used towards the completion of the Cart.
path Parameters
id required | string The ID of the Cart. |
Request Body schema: application/json
provider_id required | string The ID of the Payment Provider. |
Responses
Response Schema: application/json
required | object (Cart) Represents a user cart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "provider_id": "string"
}
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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
Refresh a Payment Session
Refreshes a Payment Session to ensure that it is in sync with the Cart - this is usually not necessary.
path Parameters
id required | string The id of the Cart. |
provider_id required | string The id of the Payment Provider that created the Payment Session to be refreshed. |
Responses
Response Schema: application/json
required | 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.refreshPaymentSession(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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "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
required | 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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": 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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}
}
List Collections
Retrieve a list of Product Collection.
query Parameters
offset | integer Default: 0 The number of collections to skip before starting to collect the collections set |
limit | integer Default: 10 The number of collections to return |
handle | Array of strings Filter by the collection handle |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. |
Responses
Response Schema: application/json
required | Array of objects (Product Collection) |
count required | integer The total number of items available |
offset required | integer The number of items skipped before these items |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.collections.list() .then(({ collections, limit, offset, count }) => { console.log(collections.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collections": [
- {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get a Collection
Retrieves a Product Collection.
path Parameters
id required | string The id of the Product Collection |
Responses
Response Schema: application/json
required | object (Product Collection) Product Collections represents a group of Products that are related. | ||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.collections.retrieve(collection_id) .then(({ collection }) => { console.log(collection.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Customer
Creates a Customer account.
Request Body schema: application/json
first_name required | string The Customer's first name. |
last_name required | string The Customer's last name. |
email required | string <email> The email of the customer. |
password required | string <password> The Customer's password. |
phone | string The Customer's phone number. |
Responses
Response Schema: application/json
required | object (Customer) Represents a customer | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "first_name": "string",
- "last_name": "string",
- "email": "user@example.com",
- "password": "pa$$word",
- "phone": "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
Get a Customer
Retrieves a Customer - the Customer must be logged in to retrieve their details.
Authorizations:
Responses
Response Schema: application/json
required | 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.customers.retrieve() .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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
Update Customer
Updates a Customer's saved details.
Authorizations:
Request Body schema: application/json
first_name | string The Customer's first name. |
last_name | string The Customer's last name. |
AddressPayload (object) or string The Address to be used for billing purposes. | |
password | string The Customer's password. |
phone | string The Customer's phone number. |
string The email of the customer. | |
metadata | object Metadata about the customer. |
Responses
Response Schema: application/json
required | object (Customer) Represents a customer | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "first_name": "string",
- "last_name": "string",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "password": "string",
- "phone": "string",
- "email": "string",
- "metadata": { }
}
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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
Add a Shipping Address
Adds a Shipping Address to a Customer's saved addresses.
Authorizations:
Request Body schema: application/json
required | object (AddressCreatePayload) Address fields used when creating an address. | ||||||||||||||||||||||
|
Responses
Response Schema: application/json
required | object (Customer) Represents a customer | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}
}
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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
Update a Shipping Address
Updates a Customer's saved Shipping Address.
Authorizations:
path Parameters
address_id required | string The id of the Address to update. |
Request Body schema: application/json
first_name | string Example: "Arno" First name |
last_name | string Example: "Willms" Last name |
phone | string Example: 16128234334802 Phone Number |
company | string |
address_1 | string Example: "14433 Kemmer Court" Address line 1 |
address_2 | string Example: "Suite 369" Address line 2 |
city | string Example: "South Geoffreyview" City |
country_code | |
province | string Example: "Kentucky" Province |
postal_code | string Example: 72093 Postal Code |
metadata | object Example: {"car":"white"} An optional key-value map with additional details |
Responses
Response Schema: application/json
required | object (Customer) Represents a customer | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}
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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
Delete an Address
Removes an Address from the Customer's saved addresses.
Authorizations:
path Parameters
address_id required | string The id of the Address to remove. |
Responses
Response Schema: application/json
required | 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.customers.addresses.deleteAddress(address_id) .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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
List Orders
Retrieves a list of a Customer's Orders.
Authorizations:
query Parameters
q | string Query used for searching orders. |
id | string Id of the order to search for. |
status | Array of strings Status to search for. |
fulfillment_status | Array of strings Fulfillment status to search for. |
payment_status | Array of strings Payment status to search for. |
display_id | string Display id to search for. |
cart_id | string to search for. |
string to search for. | |
region_id | string to search for. |
currency_code | |
tax_rate | string to search for. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were canceled. | |
limit | integer Default: 10 How many orders to return. |
offset | integer Default: 0 The offset in the resulting orders. |
fields | string (Comma separated string) Which fields should be included in the resulting orders. |
expand | string (Comma separated string) Which relations should be expanded in the resulting orders. |
Responses
Response Schema: application/json
required | Array of objects (Order) |
count required | integer The total number of items available |
offset required | integer The number of items skipped before these items |
limit required | integer The number of items per page |
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.customers.listOrders() .then(({ orders, limit, offset, count }) => { console.log(orders); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "orders": [
- {
- "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": 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": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "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": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "discounts": [
- null
], - "gift_cards": [
- null
], - "shipping_methods": [
- null
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- null
], - "edits": [
- { }
], - "gift_card_transactions": [
- null
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "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,
- "returnable_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get Payment Methods
Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects | ||||
Array
|
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.customers.paymentMethods.list() .then(({ payment_methods }) => { console.log(payment_methods.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_methods": [
- {
- "provider_id": "string",
- "data": { }
}
]
}
Reset Password
Resets a Customer's password using a password token created by a previous /password-token request.
Request Body schema: application/json
email required | string <email> The email of the customer. |
password required | string <password> The Customer's password. |
token required | string The reset password token |
Responses
Response Schema: application/json
required | object (Customer) Represents a customer | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com",
- "password": "pa$$word",
- "token": "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": null,
- "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"
}
}
}
Request Password Reset
Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.
Request Body schema: application/json
email required | string <email> The email of the customer. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com"
}
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Get Gift Card by Code
Retrieves a Gift Card by its associated unique code.
path Parameters
code required | string The unique Gift Card code. |
Responses
Response Schema: application/json
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. | ||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.giftCards.retrieve(code) .then(({ gift_card }) => { console.log(gift_card.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Retrieve an OrderEdit
Retrieves a OrderEdit.
path Parameters
id required | string The ID of the OrderEdit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit keeps track of order items changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.orderEdits.retrieve(order_edit_id) .then(({ order_edit }) => { console.log(order_edit.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Completes an OrderEdit
Completes an OrderEdit.
path Parameters
id required | string The ID of the Order Edit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit keeps track of order items changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.orderEdits.complete(order_edit_id) .then(({ order_edit }) => { console.log(order_edit.id) })
Response samples
- 200
- 400
- 404
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Decline an OrderEdit
Declines an OrderEdit.
path Parameters
id required | string The ID of the OrderEdit. |
Request Body schema: application/json
declined_reason | string The reason for declining the OrderEdit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit keeps track of order items changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "declined_reason": "string"
}
Response samples
- 200
- 400
- 404
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Look Up an Order
Look up an order using filters.
query Parameters
display_id required | number The display id given to the Order. |
email required | string <email> The email associated with this order. |
fields | string (Comma separated) Which fields should be included in the result. |
expand | string (Comma separated) Which fields should be expanded in the result. |
object The shipping address associated with this order. |
Responses
Response Schema: application/json
required | object (Order) Represents an order | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.orders.lookupOrder({ display_id: 1, email: 'user@example.com' }) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "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,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Claim an Order
Sends an email to emails registered to orders provided with link to transfer order ownership
Authorizations:
Request Body schema: application/json
order_ids required | Array of strings The ids of the orders to claim |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "order_ids": [
- "string"
]
}
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Get by Cart ID
Retrieves an Order by the id of the Cart that was used to create the Order.
path Parameters
cart_id required | string The ID of Cart. |
Responses
Response Schema: application/json
required | object (Order) Represents an order | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.orders.retrieveByCartId(cart_id) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "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,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Verify an Order Claim
Verifies the claim order token provided to the customer upon request of order ownership
Authorizations:
Request Body schema: application/json
token required | string The invite token provided by the admin. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "token": "string"
}
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Get an Order
Retrieves an Order
path Parameters
id required | string The id of the Order. |
query Parameters
fields | string (Comma separated) Which fields should be included in the result. |
expand | string (Comma separated) Which fields should be expanded in the result. |
Responses
Response Schema: application/json
required | object (Order) Represents an order | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.orders.retrieve(order_id) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "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": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "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": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "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,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a PaymentCollection
Get a Payment Collection
Authorizations:
path Parameters
id required | string The ID of the PaymentCollection. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
required | object (Payment Collection) Payment Collection | ||||||||||||||||||||||||||||||||||
|
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 in or use api token medusa.paymentCollections.retrieve(paymentCollectionId) .then(({ payment_collection }) => { console.log(payment_collection.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": 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": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Manage a Payment Session
Manages Payment Sessions from Payment Collections.
Authorizations:
path Parameters
id required | string The ID of the Payment Collection. |
Request Body schema: application/json
provider_id required | string The ID of the Payment Provider. |
Responses
Response Schema: application/json
required | object (Payment Collection) Payment Collection | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "provider_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": 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": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Manage Payment Sessions
Manages Multiple Payment Sessions from Payment Collections.
Authorizations:
path Parameters
id required | string The ID of the Payment Collections. |
Request Body schema: application/json
required | Array of objects An array of payment sessions related to the Payment Collection. If the session_id is not provided, existing sessions not present will be deleted and the provided ones will be created. | ||||||
Array
|
Responses
Response Schema: application/json
required | object (Payment Collection) Payment Collection | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "sessions": [
- {
- "provider_id": "string",
- "amount": 0,
- "session_id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": 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": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Authorize PaymentSessions
Authorizes Payment Sessions of a Payment Collection.
Authorizations:
path Parameters
id required | string The ID of the Payment Collections. |
Request Body schema: application/json
session_ids required | Array of strings List of Payment Session IDs to authorize. |
Responses
Response Schema: application/json
required | object (Payment Collection) Payment Collection | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "session_ids": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": 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": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Refresh a Payment Session
Refreshes a Payment Session to ensure that it is in sync with the Payment Collection.
path Parameters
id required | string The id of the PaymentCollection. |
session_id required | string The id of the Payment Session to be refreshed. |
Responses
Response Schema: application/json
required | object (Payment Session) Payment Sessions are created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, who is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc. | ||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.paymentCollections.refreshPaymentSession(payment_collection_id, session_id) .then(({ payment_session }) => { console.log(payment_session.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "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": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "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": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "items": [
- null
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "discounts": [
- null
], - "gift_cards": [
- null
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- 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": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}, - "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "amount": 100,
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Authorize Payment Session
Authorizes a Payment Session of a Payment Collection.
Authorizations:
path Parameters
id required | string The ID of the Payment Collections. |
session_id required | string The ID of the Payment Session. |
Responses
Response Schema: application/json
required | object (Payment Session) Payment Sessions are created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, who is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc. | ||||||||||||||||||||||||||
|
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 in or use api token medusa.paymentCollections.authorize(payment_id, session_id) .then(({ payment_collection }) => { console.log(payment_collection.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_session": {
- "id": "ps_01G901XNSRM2YS3ASN9H5KG3FZ",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": {
- "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "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": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "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": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "items": [
- null
], - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "discounts": [
- null
], - "gift_cards": [
- null
], - "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "payment_session": { },
- "payment_sessions": [
- { }
], - "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "shipping_methods": [
- 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": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}, - "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,
- "raw_discount_total": 800,
- "item_tax_total": 8000,
- "shipping_tax_total": 1000,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0
}, - "provider_id": "manual",
- "is_selected": true,
- "is_initiated": true,
- "status": "pending",
- "data": { },
- "idempotency_key": "string",
- "amount": 100,
- "payment_authorized_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
List Product Categories
Retrieve a list of product categories.
Authorizations:
query Parameters
q | string Query used for searching product category names or handles. |
handle | string Query used for searching product category by handle. |
parent_category_id | string Returns categories scoped by parent |
include_descendants_tree | boolean Include all nested descendants of category |
offset | integer Default: 0 How many product categories to skip in the result. |
limit | integer Default: 100 Limit the number of product categories returned. |
Responses
Response Schema: application/json
required | Array of objects (ProductCategory) |
count required | integer The total number of items available |
offset required | integer The number of items skipped before these items |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.productCategories.list() .then(({ product_categories, limit, offset, count }) => { console.log(product_categories.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_categories": [
- {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get a Product Category
Retrieves a Product Category.
Authorizations:
path Parameters
id required | string The ID of the Product Category |
query Parameters
expand | string (Comma separated) Which fields should be expanded in each product category. |
fields | string (Comma separated) Which fields should be retrieved in each product category. |
Responses
Response Schema: application/json
required | object (ProductCategory) Represents a product category | ||||||||||||||||||||||||||
|
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 in or use api token medusa.productCategories.retrieve(product_category_id) .then(({ product_category }) => { console.log(product_category.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
List Product Tags
Retrieve a list of Product Tags.
query Parameters
limit | integer Default: 20 The number of types to return. |
offset | integer Default: 0 The number of items to skip before the results. |
order | string The field to sort items by. |
discount_condition_id | string The discount condition id on which to filter the product tags. |
value | Array of strings The tag values to search for |
id | Array of strings The tag IDs to search for |
q | string A query string to search values for |
object Date comparison for when resulting product tags were created. | |
object Date comparison for when resulting product tags were updated. |
Responses
Response Schema: application/json
required | Array of objects (Product Tag) |
count required | integer The total number of items available |
offset required | integer The number of items skipped before these items |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.productTags.list() .then(({ product_tags }) => { console.log(product_tags.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_tags": [
- {
- "id": "ptag_01G8K2MTMG9168F2B70S1TAVK3",
- "value": "Pants",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
List Product Types
Retrieve a list of Product Types.
Authorizations:
query Parameters
limit | integer Default: 20 The number of types to return. |
offset | integer Default: 0 The number of items to skip before the results. |
order | string The field to sort items by. |
discount_condition_id | string The discount condition id on which to filter the product types. |
value | Array of strings The type values to search for |
id | Array of strings The type IDs to search for |
q | string A query string to search values for |
object Date comparison for when resulting product types were created. | |
object Date comparison for when resulting product types were updated. |
Responses
Response Schema: application/json
required | Array of objects (Product Type) |
count required | integer The total number of items available |
offset required | integer The number of items skipped before these items |
limit required | integer The number of items per page |
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 in or use api token medusa.productTypes.list() .then(({ product_types }) => { console.log(product_types.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_types": [
- {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
List Products
Retrieves a list of Products.
query Parameters
q | string Query used for searching products by title, description, variant's title, variant's sku, and collection's title |
string or Array of strings product IDs to search for. | |
sales_channel_id | Array of strings an array of sales channel IDs to filter the retrieved products by. |
collection_id | Array of strings Collection IDs to search for |
type_id | Array of strings Type IDs to search for |
tags | Array of strings Tag IDs to search for |
title | string title to search for. |
description | string description to search for. |
handle | string handle to search for. |
is_giftcard | boolean Search for giftcards using is_giftcard=true. |
object Date comparison for when resulting products were created. | |
object Date comparison for when resulting products were updated. | |
category_id | Array of strings Category ids to filter by. |
include_category_children | boolean Include category children when filtering by category_id. |
offset | integer Default: 0 How many products to skip in the result. |
limit | integer Default: 100 Limit the number of products returned. |
expand | string (Comma separated) Which fields should be expanded in each product of the result. |
fields | string (Comma separated) Which fields should be included in each product of the result. |
order | string the field used to order the products. |
cart_id | string The id of the Cart to set prices based on. |
region_id | string The id of the Region to set prices based on. |
currency_code | string The currency code to use for price selection. |
Responses
Response Schema: application/json
required | Array of objects (Priced Product) |
count required | integer The total number of items available |
offset required | integer The number of items skipped before these items |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.products.list() .then(({ products, limit, offset, count }) => { console.log(products.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "products": [
- {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- null
], - "options": [
- null
], - "variants": [
- null
], - "categories": [
- null
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tags": [
- null
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Search Products
Run a search query on products using the search engine installed on Medusa
Request Body schema: application/json
q | string The query to run the search with. |
offset | number How many products to skip in the result. |
limit | number Limit the number of products returned. |
filter | any Filter based on the search engine. |
Responses
Response Schema: application/json
hits required | Array of arrays Array of results. The format of the items depends on the search engine installed on the server. |
Request samples
- Payload
- JS Client
- cURL
{- "q": "string",
- "offset": 0,
- "limit": 0,
- "filter": null
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "hits": [ ]
}
Get a Product
Retrieves a Product.
path Parameters
id required | string The id of the Product. |
query Parameters
sales_channel_id | string The sales channel used when fetching the product. |
cart_id | string The ID of the customer's cart. |
region_id | string The ID of the region the customer is using. This is helpful to ensure correct prices are retrieved for a region. |
fields | string (Comma separated) Which fields should be included in the result. |
expand | string (Comma separated) Which fields should be expanded in each product of the result. |
currency_code | string The 3 character ISO currency code to set prices based on. This is helpful to ensure correct prices are retrieved for a currency. |
Responses
Response Schema: application/json
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.products.retrieve(product_id) .then(({ product }) => { console.log(product.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List Regions
Retrieves a list of Regions.
query Parameters
offset | integer Default: 0 How many regions to skip in the result. |
limit | integer Default: 100 Limit the number of regions returned. |
object Date comparison for when resulting regions were created. | |
object Date comparison for when resulting regions were updated. |
Responses
Response Schema: application/json
required | Array of objects (Region) |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.regions.list() .then(({ regions }) => { console.log(regions.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "regions": [
- {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get a Region
Retrieves a Region.
path Parameters
id required | string The id of the Region. |
Responses
Response Schema: application/json
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.regions.retrieve(region_id) .then(({ region }) => { console.log(region.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List Return Reasons
Retrieves a list of Return Reasons.
Responses
Response Schema: application/json
required | Array of objects (Return Reason) | ||||||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.returnReasons.list() .then(({ return_reasons }) => { console.log(return_reasons.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return_reasons": [
- {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Get a Return Reason
Retrieves a Return Reason.
path Parameters
id required | string The id of the Return Reason. |
Responses
Response Schema: application/json
required | object (Return Reason) A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned. | ||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.returnReasons.retrieve(reason_id) .then(({ return_reason }) => { console.log(return_reason.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create Return
Creates a Return for an Order.
Request Body schema: application/json
order_id required | string The ID of the Order to create the Return from. |
required | Array of objects The items to include in the Return. |
object If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves. |
Responses
Response Schema: application/json
required | object (Return) Return orders hold information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can be used as part of a Swap. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "order_id": "string",
- "items": [
- {
- "item_id": "string",
- "quantity": 0,
- "reason_id": "string",
- "note": "string"
}
], - "return_shipping": {
- "option_id": "string"
}
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return": {
- "id": "ret_01F0YET7XPCMF8RZ0Y151NZV2V",
- "status": "requested",
- "items": [
- {
- "return_id": null,
- "item_id": null,
- "return_order": { },
- "item": null,
- "quantity": null,
- "is_requested": null,
- "requested_quantity": null,
- "received_quantity": null,
- "reason_id": null,
- "reason": null,
- "note": null,
- "metadata": { }
}
], - "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "shipping_method": {
- "id": "sm_01F0YET7DR2E7CYVSDHM593QG2",
- "shipping_option_id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tax_lines": [
- null
], - "price": 200,
- "data": { },
- "includes_tax": false,
- "subtotal": 8000,
- "total": 8200,
- "tax_total": 0
}, - "shipping_data": { },
- "location_id": "sloc_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "refund_amount": 1000,
- "no_notification": false,
- "idempotency_key": "string",
- "received_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get Shipping Options
Retrieves a list of Shipping Options.
query Parameters
is_return | boolean Whether return Shipping Options should be included. By default all Shipping Options are returned. |
product_ids | string A comma separated list of Product ids to filter Shipping Options by. |
region_id | string the Region to retrieve Shipping Options from. |
Responses
Response Schema: application/json
required | Array of objects (Priced Shipping Option) | ||||||||||||||||||||||||||||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.shippingOptions.list() .then(({ shipping_options }) => { console.log(shipping_options.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_options": [
- {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "provider_id": "manual",
- "provider": {
- "id": null,
- "is_installed": null
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- null
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "price_incl_tax": 0,
- "tax_rates": [
- { }
], - "tax_amount": 0
}
]
}
List for Cart
Retrieves a list of Shipping Options available to a cart.
path Parameters
cart_id required | string The id of the Cart. |
Responses
Response Schema: application/json
required | Array of objects (Priced Shipping Option) | ||||||||||||||||||||||||||||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.shippingOptions.listCartOptions(cart_id) .then(({ shipping_options }) => { console.log(shipping_options.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_options": [
- {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "provider_id": "manual",
- "provider": {
- "id": null,
- "is_installed": null
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- null
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "price_incl_tax": 0,
- "tax_rates": [
- { }
], - "tax_amount": 0
}
]
}
Create a Swap
Creates a Swap on an Order by providing some items to return along with some items to send back
Request Body schema: application/json
order_id required | string The ID of the Order to create the Swap for. |
required | Array of objects The items to include in the Return. |
required | Array of objects The items to exchange the returned items to. |
return_shipping_option | string The ID of the Shipping Option to create the Shipping Method from. |
Responses
Response Schema: application/json
required | object (Swap) Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "order_id": "string",
- "return_items": [
- {
- "item_id": "string",
- "quantity": 0,
- "reason_id": "string",
- "note": "string"
}
], - "return_shipping_option": "string",
- "additional_items": [
- {
- "variant_id": "string",
- "quantity": 0
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "swap": {
- "id": "swap_01F0YET86Y9G92D3YDR9Y6V676",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "additional_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "return_order": { },
- "fulfillments": [
- { }
], - "payment": { },
- "difference_due": 0,
- "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "confirmed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "allow_backorder": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get by Cart ID
Retrieves a Swap by the id of the Cart used to confirm the Swap.
path Parameters
cart_id required | string The id of the Cart |
Responses
Response Schema: application/json
required | object (Swap) Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.swaps.retrieveByCartId(cart_id) .then(({ swap }) => { console.log(swap.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "swap": {
- "id": "swap_01F0YET86Y9G92D3YDR9Y6V676",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "additional_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "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": null,
- "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,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "return_order": { },
- "fulfillments": [
- { }
], - "payment": { },
- "difference_due": 0,
- "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": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "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_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "confirmed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "allow_backorder": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get Product Variants
Retrieves a list of Product Variants
query Parameters
ids | string A comma separated list of Product Variant ids to filter by. |
sales_channel_id | string A sales channel id for result configuration. |
expand | string A comma separated list of Product Variant relations to load. |
offset | number Default: "0" How many product variants to skip in the result. |
limit | number Default: "100" Maximum number of Product Variants to return. |
cart_id | string The id of the Cart to set prices based on. |
region_id | string The id of the Region to set prices based on. |
currency_code | string The currency code to use for price selection. |
string or Array of strings product variant title to search for. | |
number or object Filter by available inventory quantity |
Responses
Response Schema: application/json
required | Array of objects (Priced Product Variant) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Array
|
Request samples
- cURL
curl --location --request GET 'https://medusa-url.com/store/variants'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variants": [
- {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- null
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- null
], - "inventory_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true,
- "original_price": 0,
- "calculated_price": 0,
- "original_price_incl_tax": 0,
- "calculated_price_incl_tax": 0,
- "original_tax": 0,
- "calculated_tax": 0,
- "tax_rates": [
- { }
]
}
]
}
Get a Product Variant
Retrieves a Product Variant by id
path Parameters
variant_id required | string The id of the Product Variant. |
query Parameters
cart_id | string The id of the Cart to set prices based on. |
sales_channel_id | string A sales channel id for result configuration. |
region_id | string The id of the Region to set prices based on. |
currency_code |
Responses
Response Schema: application/json
required | object (Priced Product Variant) Product Variants represent a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- cURL
curl --location --request GET 'https://medusa-url.com/store/variants/{id}'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variant": {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- {
- "id": null,
- "value": null,
- "option_id": null,
- "option": { },
- "variant_id": null,
- "variant": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "inventory_items": [
- {
- "id": null,
- "inventory_item_id": null,
- "variant_id": null,
- "variant": { },
- "required_quantity": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true,
- "original_price": 0,
- "calculated_price": 0,
- "original_price_incl_tax": 0,
- "calculated_price_incl_tax": 0,
- "original_tax": 0,
- "calculated_tax": 0,
- "tax_rates": [
- {
- "rate": null,
- "name": null,
- "code": null
}
]
}
}