Documentation is still being updated. Some content maybe unfinished.
curl --request PUT \
--url {protocol}://{host}/wp-json/cocart/preview/checkout \
--header 'Content-Type: application/json' \
--data '
{
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
},
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>"
},
"payment_method": "<string>",
"shipping_method": "<string>",
"currency": "EUR"
}
'{
"cart_key": "abc123def456",
"cart_hash": "d41d8cd98f00b204e9800998ecf8427e",
"currency": {
"code": "USD",
"symbol": "$",
"base_currency": "USD",
"exchange_rate": 1
},
"customer_id": 123,
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"cart_contents": {
"c4ca4238a0b923820dcc509a6f75849b": {
"key": "c4ca4238a0b923820dcc509a6f75849b",
"product_id": 456,
"variation_id": 0,
"quantity": 2,
"product_name": "Premium T-Shirt",
"product_title": "Premium T-Shirt",
"product_price": "$19.99",
"line_total": "39.98",
"line_subtotal": "39.98"
}
},
"cart_totals": {
"subtotal": "39.98",
"subtotal_tax": "0.00",
"shipping_total": "5.00",
"shipping_tax": "0.00",
"discount_total": "0.00",
"discount_tax": "0.00",
"cart_contents_total": "39.98",
"cart_contents_tax": "0.00",
"fee_total": "0.00",
"fee_tax": "0.00",
"total": "44.98",
"total_tax": "0.00"
},
"shipping_methods": {
"flat_rate:1": {
"id": "flat_rate:1",
"label": "Flat Rate",
"cost": "5.00",
"method_id": "flat_rate",
"instance_id": "1"
}
},
"needs_payment": true,
"needs_shipping": true,
"payment_method": "stripe"
}Update checkout information such as billing/shipping addresses, payment method, or shipping method
curl --request PUT \
--url {protocol}://{host}/wp-json/cocart/preview/checkout \
--header 'Content-Type: application/json' \
--data '
{
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
},
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>"
},
"payment_method": "<string>",
"shipping_method": "<string>",
"currency": "EUR"
}
'{
"cart_key": "abc123def456",
"cart_hash": "d41d8cd98f00b204e9800998ecf8427e",
"currency": {
"code": "USD",
"symbol": "$",
"base_currency": "USD",
"exchange_rate": 1
},
"customer_id": 123,
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"cart_contents": {
"c4ca4238a0b923820dcc509a6f75849b": {
"key": "c4ca4238a0b923820dcc509a6f75849b",
"product_id": 456,
"variation_id": 0,
"quantity": 2,
"product_name": "Premium T-Shirt",
"product_title": "Premium T-Shirt",
"product_price": "$19.99",
"line_total": "39.98",
"line_subtotal": "39.98"
}
},
"cart_totals": {
"subtotal": "39.98",
"subtotal_tax": "0.00",
"shipping_total": "5.00",
"shipping_tax": "0.00",
"discount_total": "0.00",
"discount_tax": "0.00",
"cart_contents_total": "39.98",
"cart_contents_tax": "0.00",
"fee_total": "0.00",
"fee_tax": "0.00",
"total": "44.98",
"total_tax": "0.00"
},
"shipping_methods": {
"flat_rate:1": {
"id": "flat_rate:1",
"label": "Flat Rate",
"cost": "5.00",
"method_id": "flat_rate",
"instance_id": "1"
}
},
"needs_payment": true,
"needs_shipping": true,
"payment_method": "stripe"
}Checkout data to update
Show child attributes
Show child attributes
Payment method ID
Shipping method ID
Currency code for the order (e.g., USD, EUR, GBP). If not provided, store default will be used.
^[A-Z]{3}$"EUR"
Checkout data updated successfully
Unique identifier for the cart session
MD5 hash of cart contents
Currency information including code, symbol, and exchange rate
Show child attributes
Customer ID, if logged in
Show child attributes
Show child attributes
Cart contents with product details
Show child attributes
Show child attributes
Available shipping methods
Show child attributes
Whether the cart needs payment
Whether the cart needs shipping
Selected payment method
Was this page helpful?