JSON API
JSON API: Endpoints
Current Cart
Returns the customer's cart.
GET /!/cargo/cart
Update the cart
Updates the customer's cart. You can post customer information, redeem a discount code, or pass any other order fields here.
POST /!/cargo/cart
-
customer
arrayCustomer information to persist on the cart.
Hide customerShow customer-
name
string -
first_name
string -
last_name
string -
email
string -
Any other fields defined in your user blueprint.
-
-
discount_code
string -
shipping_method
stringRequired when
shipping_option
is provided. -
shipping_option
stringRequired when
shipping_method
is provided. -
shipping_line_1
string -
shipping_line_2
string -
shipping_city
string -
shipping_postcode
string -
shipping_country
stringMust be in ISO3 format.
-
shipping_state
stringMust match one of the states in Cargo's
states.json
file. -
billing_line_1
string -
billing_line_2
string -
billing_city
string -
billing_postcode
string -
billing_country
stringMust be in ISO3 format.
-
billing_state
stringMust match one of the states in Cargo's
states.json
file. -
Any other fields defined in your order blueprint.
Delete the cart
Deletes the customer's cart.
DELETE /!/cargo/cart
Add a line item
Adds a line item to the customer's cart.
POST /!/cargo/cart/line-items
-
product
string required -
variant
stringRequired when adding a variant product.
-
quantity
integerDefaults to
1
-
customer
arrayCustomer information to persist on the cart.
Hide customerShow customer-
name
string -
first_name
string -
last_name
string -
email
string -
Any other fields defined in your user blueprint.
-
-
Any other data you'd like to persist on the line item.
Update a line item
Updates a line item on the customer's cart. The {lineItem}
should be the ID of the line item you wish to update.
PATCH /!/cargo/cart/line-items/{lineItem}
-
variant
stringRequired when the product is a variant product.
-
quantity
integer -
customer
arrayCustomer information to persist on the cart.
Hide customerShow customer-
name
string -
first_name
string -
last_name
string -
email
string -
Any other fields defined in your user blueprint.
-
-
Any other data you'd like to persist on the line item.
Remove a line item
Removes a line item from the customer's cart. The {lineItem}
should be the ID of the line item you wish to remove.
DELETE /!/cargo/cart/line-items/{lineItem}
Available Shipping Methods
Returns the available shipping options for the customer's cart.
This endpoint will return a 422
status code when no shipping address is set on the cart.
GET /!/cargo/cart/shipping
Available Payment Gateways
Returns the available payment gateways for the customer's cart, including the array returned by the payment gateway's setup
method.
Payment Gateways will be returned even when the cart total is £0. In this case, no
setup
data will be returned.
GET /!/cargo/cart/payment-gateways
Checkout: £0 order
When the cart total is equals to £0, you may use this endpoint to create an order without payment.
When successful, this endpoint will return a redirect response to the checkout confirmation page.
When the order requires payment, this endpoint will report a 404
status code.
GET POST /!/cargo/cart/checkout
-
discount_code
string
Checkout: Paid Order
When the order requires payment, you may use this endpoint to create the order. The {gateway}
should be the handle of the payment gateway you wish to check out using.
When successful, this endpoint will return a redirect response to the checkout confirmation page.
When the order does not require payment, this endpoint will return a 404
status code.
GET POST /!/cargo/cart/payments/{gateway}/checkout
-
discount_code
string
States
Returns an array of states for a given country.
GET /!/cargo/states
-
country
string requiredMust be in ISO3 format.