- Getting Started
- Auth
- Carts
- Create Payment SessionsPOST
- Refresh a Payment SessionPOST
- Create a CartPOST
- Complete a CartPOST
- Select a Payment SessionPOST
- Delete a Payment SessionDELETE
- Update a Payment SessionPOST
- Get a CartGET
- Update a CartPOST
- Add Shipping MethodPOST
- Update a Line ItemPOST
- Delete a Line ItemDELETE
- Add a Line ItemPOST
- Calculate Cart TaxesPOST
- Remove DiscountDELETE
- Customers
- Gift Cards
- Orders
- Order Edits
- Payment Collections
- Products
- Product Variants
- Product Tags
- Product Categories
- Product Collections
- Product Types
- Regions
- Returns
- Return Reasons
- Shipping Options
- Swaps
Complete a Cart
POST
/store/carts/{id}/complete
Carts
If authorizing the payment requires more action, the cart will not be completed and the order will not be placed or the swap will not be created.
Idempotency-Key
and added tothe response. If an error occurs during cart completion or the request is interrupted for any reason, the cart completion can be retried by passing the idempotency
key in the
Idempotency-Key
header.Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.medusa-commerce.com/store/carts//complete'
Response Response Example
200 - Example 1
Request
Path Params
id
stringÂ
required
Responses
🟢200If the payment of the cart was successfully authorized, but requires further action from the customer, the response body will contain the cart with an updated payment session. Otherwise, if the payment was authorized and the cart was successfully complete
application/json
Body
If the cart is completed successfully, this will have the created order or the swap's details, based on the cart's type. Otherwise, it'll be the cart's details.
type
enum<string>Â
required
cart
and the data object will be the cart's details. If the cart completion is successful and the cart is used for checkout, type will be order
and the data object will be the order's details. If the cart completion is successful and the cart is used for swap creation, type will be swap
and the data object will be the swap's details.Allowed values:
ordercartswap
data
required
One of
id
stringÂ
required
Example:
order_01G8TJSYT9M6AVS5N4EMNFS1EK
display_id
integerÂ
required
Example:
2
cart_id
string  | nullÂ
required
Example:
cart_01G8ZH853Y6TFXWPG5EYE81X63
cart
object  | nullÂ
optional
customer_id
stringÂ
required
Example:
cus_01G2SG30J8C85S4A5CHM2S1NS2
customer
object  | nullÂ
optional
email
string <email>
required
billing_address_id
string  | nullÂ
required
Example:
addr_01G8ZH853YPY9B94857DY91YGW
shipping_address_id
string  | nullÂ
required
Example:
addr_01G8ZH853YPY9B94857DY91YGW
region_id
stringÂ
required
Example:
reg_01G1G5V26T9H8Y0M4JNE3YGA4G
tax_rate
number  | nullÂ
required
Example:
0
draft_order_id
string  | nullÂ
required
Example:
null
draft_order
object  | nullÂ
optional
canceled_at
string <date-time> | nullÂ
required
no_notification
boolean  | nullÂ
required
Example:
false
external_id
string  | nullÂ
required
Example:
null
sales_channel_id
string  | nullÂ
optional
Example:
null
shipping_total
integer  | nullÂ
optional
Example:
1000
shipping_tax_total
integerÂ
optional
Example:
1000
raw_discount_total
integerÂ
optional
Example:
800
discount_total
integerÂ
optional
Example:
800
tax_total
integerÂ
optional
Example:
0
item_tax_total
integer  | nullÂ
optional
Example:
0
refunded_total
integerÂ
optional
Example:
0
total
integerÂ
optional
Example:
8200
subtotal
integerÂ
optional
Example:
8000
paid_total
integerÂ
optional
Example:
8000
refundable_amount
integerÂ
optional
Example:
8200
gift_card_total
integerÂ
optional
Example:
0
gift_card_tax_total
integerÂ
optional
Example:
0
created_at
string <date-time>
required
updated_at
string <date-time>
required
status
enum<string>Â
required
Allowed values:
pendingcompletedarchivedcanceledrequires_action
Default:
pending
fulfillment_status
enum<string>Â
required
Allowed values:
not_fulfilledpartially_fulfilledfulfilledpartially_shippedshippedpartially_returnedreturnedcanceledrequires_action
Default:
not_fulfilled
payment_status
enum<string>Â
required
Allowed values:
not_paidawaitingcapturedpartially_refundedrefundedcanceledrequires_action
Default:
not_paid
currency_code
stringÂ
required
Example:
usd
payments
array [object]Â
optional
fulfillments
array [object]Â
optional
returns
array [object]Â
optional
claims
array [object]Â
optional
refunds
array [object]Â
optional
swaps
array [object]Â
optional
edits
array [object]Â
optional
idempotency_key
string  | nullÂ
required
metadata
object  | nullÂ
required
Example:
{"car":"white"}
gift_card_transactions
array[object (Gift Card Transaction) {9}]Â
optional
currency
objectÂ
Currency
billing_address
objectÂ
Address
shipping_address
objectÂ
Address
sales_channel
objectÂ
Sales Channel
shipping_methods
array[object (Shipping Method) {20}]Â
optional
region
objectÂ
Region
discounts
array[object (Discount) {18}]Â
optional
gift_cards
array[object (Gift Card) {15}]Â
optional
returnable_items
array[object (Line Item) {42}]Â
optional
items
array[object (Line Item) {42}]Â
optional
🟠400Client Error or Multiple Errors
🟠404Not Found Error
🟠409Invalid State Error
🟠422Invalid Request Error
🔴500Server Error
Modified at 2023-11-27 13:05:07