Once a Cart is ready to checkout, you can easily convert your Cart to an Order. The Cart will remain and can be modified and checked out again if required.

Once a successful Checkout is completed, the response will contain the order.

We'll automatically delete carts 7 days after they were last updated.

There are a number of actions that happen to your inventory when checking out and paying for an order. For more information please be sure to evaluate our detailed article explaining the processes.

post
With Customer ID

https://api.moltin.com
/v2/carts/:reference/checkout
You can checkout a Cart with an existing customer ID
Request
Response
Body Parameters
customer.id
required
string
The ID of the customer
billing_address.first_name
required
string
First name of the billing recipient
billing_address.last_name
required
string
Last name of the billing recipient
billing_address.company_name
optional
string
Company name of the billing recipient
billing_address.line_1
required
string
First line of the billing address
billing_address.line_2
optional
string
Second line of the billing address
billing_address.postcode
required
string
Postcode of the billing address
bililng_address.county
required
string
County / state / region of the billing address
billing_address.country
required
string
Country of the billing address
shipping_address.first_name
required
string
First name of the shipping recipient
shipping_address.last_name
required
string
Last name of the shipping recipient
shipping_address.phone_number
optional
string
Phone number of the shipping recipient
shipping_address.company_name
optional
string
Company of the shipping recipient
shipping_address.line_1
required
string
First line of the shipping address
shipping_address.line_2
optional
string
Second line of the shipping address
shipping_address.city
optional
string
City of the shipping address
shipping_address.postcode
required
string
Post code of the shipping address
shipping_address.county
required
string
County / state/ region of the shipping address
shipping_address.country
required
string
Country of the shipping address
shipping_address.instructions
optional
string
Shipping instructions
201: Created
{
"data": {
"type": "order",
"id": "c79a24c1-d639-4ac7-9eb5-3565efd9c84b",
"status": "incomplete",
"payment": "unpaid",
"shipping": "unfulfilled",
"customer": {
"name": "Ron Swanson",
"email": "ronswanson@example.com"
},
"shipping_address": {
"first_name": "Ron",
"last_name": "Swanson",
"phone_number": "",
"company_name": "Moltin",
"line_1": "British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK",
"instructions": ""
},
"billing_address": {
"first_name": "Ron",
"last_name": "Swanson",
"company_name": "Moltin",
"line_1": "British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK"
},
"links": {},
"meta": {
"display_price": {
"with_tax": {
"amount": 47500,
"currency": "USD",
"formatted": "$475.00"
},
"without_tax": {
"amount": 47500,
"currency": "USD",
"formatted": "$475.00"
}
},
"timestamps": {
"created_at": "2018-05-09T09:53:16.045565913Z",
"updated_at": "2018-05-09T09:53:16.045566558Z"
}
},
"relationships": {
"items": {
"data": [
{
"type": "item",
"id": "5ff8e482-da0b-4c43-b9ae-a13d384f10bd"
}
]
}
}
}
}
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/carts/:reference/checkout \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"customer": {
"id": "c8c1c511-beef-4812-9b7a-9f92c587217c"
},
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"company_name": "Moltin",
"line_1": "2nd Floor British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK"
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"phone_number": "(555) 555-1234",
"company_name": "Moltin",
"line_1": "2nd Floor British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK",
"instructions": "Leave in porch"
}
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const reference = 'XXXX'
const customerId = 'XXXX'
const billing = {
first_name: 'John',
last_name: 'Doe',
line_1: '2nd Floor British India House',
line_2: '15 Carliol Square',
city: 'Newcastle Upon Tyne',
postcode: 'NE1 6UF',
county: 'Tyne & Wear',
country: 'United Kingdom'
}
Moltin.Cart(reference)
.Checkout(customerId, billing, shipping)
.then(order => {
// Do something
})

shipping is optional. billing will be shipping if not provided.

post
With Customer object

https://api.moltin.com
/v2/carts/:reference/checkout
You can checkout a Cart with an associated customer name and email.
Request
Response
Path Parameters
reference
required
string
The reference for the cart to checkout
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
customer.email
required
string
Customer email address
customer.name
required
string
Full name of the customer
billing_address.first_name
required
string
First name of the billing recipient
billing_address.last_name
required
string
Last name of the billing recipient
billing_address.company_name
optional
string
Company name of the billing recipient
billing_address.line_1
required
string
First line of the billing address
billing_address.line_2
optional
string
Second line of the billing address
billing_address.city
optional
string
/city of the billing address
billing_address.postcode
required
string
Postcode of the billing address
billing_address.county
required
string
County / state / region of the shipping address
billing_address.country
required
string
Country of the billing address
shipping_address.first_name
required
string
First name of the shipping recipient
shipping_address.last_name
required
string
Last name of the shipping recipient
shipping_address.company_name
optional
string
Company name of the shipping recipient
shipping_address.phone_number
optional
string
Phone number of the shipping recipient
shipping_address.line_1
required
string
First line of the shipping address
shipping_address.line_2
optional
string
Second line of the shipping address
shipping_address.city
optional
string
City of the shipping address
shipping_address.postcode
required
string
Postcode of the shipping address
shipping_address.county
required
string
County / state / region of the shipping address
shipping_address.country
required
string
Country of the shipping address
shipping_address.instructions
optional
string
Shipping instructions
201: Created
{
"data": {
"type": "order",
"id": "5a9b6d0a-3e88-43d5-a12e-e5dedbac517d",
"status": "incomplete",
"payment": "unpaid",
"shipping": "unfulfilled",
"customer": {
"name": "Ron Swanson",
"email": "ronswanson@example.com"
},
"shipping_address": {
"first_name": "Ron",
"last_name": "Swanson",
"phone_number": "",
"company_name": "Moltin",
"line_1": "British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK",
"instructions": ""
},
"billing_address": {
"first_name": "Ron",
"last_name": "Swanson",
"company_name": "Moltin",
"line_1": "British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK"
},
"links": {},
"meta": {
"display_price": {
"with_tax": {
"amount": 47500,
"currency": "USD",
"formatted": "$475.00"
},
"without_tax": {
"amount": 47500,
"currency": "USD",
"formatted": "$475.00"
},
"tax": {
"amount": 0,
"currency": "",
"formatted": ""
}
},
"timestamps": {
"created_at": "2018-05-09T09:53:16.045565913Z",
"updated_at": "2018-05-09T09:53:16.045566558Z"
}
},
"relationships": {
"items": {
"data": [
{
"type": "item",
"id": "5ff8e482-da0b-4c43-b9ae-a13d384f10bd"
}
]
}
}
}
}
cURL
JavaScript SDK
Swift SDK
curl -X POST https://api.moltin.com/v2/carts/:reference/checkout \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"customer": {
"email": "john@moltin.com",
"name": "John Doe"
},
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"company_name": "Moltin",
"line_1": "2nd Floor British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK"
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"company_name": "Moltin",
"phone_number": "(555) 555-1234",
"line_1": "2nd Floor British India House",
"line_2": "15 Carliol Square",
"city": "Newcastle upon Tyne",
"postcode": "NE1 6UF",
"county": "Tyne & Wear",
"country": "UK",
"instructions": "Leave in porch"
}
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const reference = 'XXXX'
const customer = {
email: 'john@moltin.com',
name: 'John Doe'
}
const billing = {
first_name: 'John',
last_name: 'Doe',
line_1: '2nd Floor British India House',
line_2: '15 Carliol Square',
city: 'Newcastle Upon Tyne',
postcode: 'NE1 6UF',
county: 'Tyne & Wear',
country: 'United Kingdom'
}
const shipping = {
first_name: 'John',
last_name: 'Doe',
line_1: '2nd Floor British India House',
line_2: '15 Carliol Square',
city: 'Newcastle Upon Tyne',
postcode: 'NE1 6UF',
county: 'Tyne & Wear',
country: 'United Kingdom'
}
Moltin.Cart(reference)
.Checkout(customer, billing, shipping)
.then(order => {
// Do something
})

shipping is optional. billing will be shipping if not provided.

let moltin = Moltin(withClientID: "<your client ID>")
moltin.cart.checkout(
cart: ...,
withCustomer: ...,
withBillingAddress: ...,
withShippingAddress: ...) { (result) in
switch result {
case .success(let order):
...
default: break
}
}

Next steps

Once a Cart has been converted to an Order using either of the methods above, you will most likely want to capture payment for order.