curl --location --request POST 'https://api.stateset.com/v1/carts/cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/checkout' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"payment_method": {
"type": "card",
"payment_method_id": "pm_saved_123"
},
"billing_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"shipping_method_id": "ship_standard",
"customer_note": "Please leave at front door"
}'
const order = await stateset.carts.checkout(
'cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
payment_method: {
type: "card",
payment_method_id: "pm_saved_123"
},
billing_address: {
line1: "123 Main St",
city: "San Francisco",
state: "CA",
postal_code: "94105",
country: "US"
},
shipping_method_id: "ship_standard",
customer_note: "Please leave at front door"
}
);
order = stateset.carts.checkout(
'cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
payment_method={
"type": "card",
"payment_method_id": "pm_saved_123"
},
billing_address={
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
shipping_method_id="ship_standard",
customer_note="Please leave at front door"
)
{
"id": "order_123456",
"object": "order",
"cart_id": "cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"order_number": "ORD-2024-123456",
"customer_id": "cust_abc123",
"status": "processing",
"payment_status": "paid",
"fulfillment_status": "unfulfilled",
"items": [
{
"id": "oi_abc123",
"product_id": "prod_123",
"variant_id": "var_blue_large",
"product_name": "Wireless Headphones",
"variant_name": "Blue - Large",
"sku": "WH-BL-L",
"quantity": 3,
"unit_price": 9999,
"discount_amount": 2999,
"subtotal": 26997
},
{
"id": "oi_def456",
"product_id": "prod_789",
"variant_id": "var_red_medium",
"product_name": "T-Shirt",
"variant_name": "Red - Medium",
"sku": "TS-RD-M",
"quantity": 1,
"unit_price": 2499,
"discount_amount": 250,
"subtotal": 2249
}
],
"subtotal": 32496,
"discount_amount": 3249,
"tax_amount": 2268,
"shipping_amount": 599,
"total": 32114,
"currency": "USD",
"payment": {
"id": "pay_xyz789",
"method": "card",
"last4": "4242",
"brand": "visa",
"status": "succeeded",
"amount": 32114
},
"shipping_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"shipping_method": {
"id": "ship_standard",
"name": "Standard Shipping",
"amount": 599,
"estimated_delivery": "2024-06-25"
},
"customer_note": "Please leave at front door",
"created_at": "2024-06-20T17:00:00Z",
"updated_at": "2024-06-20T17:00:00Z",
"metadata": {
"source": "web_checkout"
}
}
Checkout Cart
Convert a cart into an order and process payment
POST
/
v1
/
carts
/
:id
/
checkout
curl --location --request POST 'https://api.stateset.com/v1/carts/cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/checkout' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"payment_method": {
"type": "card",
"payment_method_id": "pm_saved_123"
},
"billing_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"shipping_method_id": "ship_standard",
"customer_note": "Please leave at front door"
}'
const order = await stateset.carts.checkout(
'cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
payment_method: {
type: "card",
payment_method_id: "pm_saved_123"
},
billing_address: {
line1: "123 Main St",
city: "San Francisco",
state: "CA",
postal_code: "94105",
country: "US"
},
shipping_method_id: "ship_standard",
customer_note: "Please leave at front door"
}
);
order = stateset.carts.checkout(
'cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
payment_method={
"type": "card",
"payment_method_id": "pm_saved_123"
},
billing_address={
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
shipping_method_id="ship_standard",
customer_note="Please leave at front door"
)
{
"id": "order_123456",
"object": "order",
"cart_id": "cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"order_number": "ORD-2024-123456",
"customer_id": "cust_abc123",
"status": "processing",
"payment_status": "paid",
"fulfillment_status": "unfulfilled",
"items": [
{
"id": "oi_abc123",
"product_id": "prod_123",
"variant_id": "var_blue_large",
"product_name": "Wireless Headphones",
"variant_name": "Blue - Large",
"sku": "WH-BL-L",
"quantity": 3,
"unit_price": 9999,
"discount_amount": 2999,
"subtotal": 26997
},
{
"id": "oi_def456",
"product_id": "prod_789",
"variant_id": "var_red_medium",
"product_name": "T-Shirt",
"variant_name": "Red - Medium",
"sku": "TS-RD-M",
"quantity": 1,
"unit_price": 2499,
"discount_amount": 250,
"subtotal": 2249
}
],
"subtotal": 32496,
"discount_amount": 3249,
"tax_amount": 2268,
"shipping_amount": 599,
"total": 32114,
"currency": "USD",
"payment": {
"id": "pay_xyz789",
"method": "card",
"last4": "4242",
"brand": "visa",
"status": "succeeded",
"amount": 32114
},
"shipping_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"shipping_method": {
"id": "ship_standard",
"name": "Standard Shipping",
"amount": 599,
"estimated_delivery": "2024-06-25"
},
"customer_note": "Please leave at front door",
"created_at": "2024-06-20T17:00:00Z",
"updated_at": "2024-06-20T17:00:00Z",
"metadata": {
"source": "web_checkout"
}
}
This endpoint initiates the checkout process, converting a cart into an order. It validates inventory, calculates final totals, and processes payment.
Authentication
This endpoint requires a valid API key withcarts:write and orders:write permissions.
Authorization: Bearer YOUR_API_KEY
Path Parameters
string
required
The unique identifier of the cart to checkout
Request Body
object
required
object
required
object
Shipping address (uses billing if not provided)
Show Address properties
Show Address properties
Same structure as billing address
string
required
Selected shipping method ID
string
Special instructions for the order
string
Purchase order number (for B2B)
object
Additional order metadata
Response
Returns the created order object.curl --location --request POST 'https://api.stateset.com/v1/carts/cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/checkout' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"payment_method": {
"type": "card",
"payment_method_id": "pm_saved_123"
},
"billing_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"shipping_method_id": "ship_standard",
"customer_note": "Please leave at front door"
}'
const order = await stateset.carts.checkout(
'cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
payment_method: {
type: "card",
payment_method_id: "pm_saved_123"
},
billing_address: {
line1: "123 Main St",
city: "San Francisco",
state: "CA",
postal_code: "94105",
country: "US"
},
shipping_method_id: "ship_standard",
customer_note: "Please leave at front door"
}
);
order = stateset.carts.checkout(
'cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
payment_method={
"type": "card",
"payment_method_id": "pm_saved_123"
},
billing_address={
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
shipping_method_id="ship_standard",
customer_note="Please leave at front door"
)
{
"id": "order_123456",
"object": "order",
"cart_id": "cart_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"order_number": "ORD-2024-123456",
"customer_id": "cust_abc123",
"status": "processing",
"payment_status": "paid",
"fulfillment_status": "unfulfilled",
"items": [
{
"id": "oi_abc123",
"product_id": "prod_123",
"variant_id": "var_blue_large",
"product_name": "Wireless Headphones",
"variant_name": "Blue - Large",
"sku": "WH-BL-L",
"quantity": 3,
"unit_price": 9999,
"discount_amount": 2999,
"subtotal": 26997
},
{
"id": "oi_def456",
"product_id": "prod_789",
"variant_id": "var_red_medium",
"product_name": "T-Shirt",
"variant_name": "Red - Medium",
"sku": "TS-RD-M",
"quantity": 1,
"unit_price": 2499,
"discount_amount": 250,
"subtotal": 2249
}
],
"subtotal": 32496,
"discount_amount": 3249,
"tax_amount": 2268,
"shipping_amount": 599,
"total": 32114,
"currency": "USD",
"payment": {
"id": "pay_xyz789",
"method": "card",
"last4": "4242",
"brand": "visa",
"status": "succeeded",
"amount": 32114
},
"shipping_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"shipping_method": {
"id": "ship_standard",
"name": "Standard Shipping",
"amount": 599,
"estimated_delivery": "2024-06-25"
},
"customer_note": "Please leave at front door",
"created_at": "2024-06-20T17:00:00Z",
"updated_at": "2024-06-20T17:00:00Z",
"metadata": {
"source": "web_checkout"
}
}
⌘I