Checkouts
This endpoint triggers a checkout for a given cart or for a given quote. Customer must be active while checkout is proceed. Checkout is an atomic operation either it succeeds or fails. When a checkout request fails a proper validation message will be returned. Depending of the issue the checkout payload or cart content can be corrected to satisfy the validation rules and the request can be retried.
The checkout process performs the following operations:
Validates checkout
checks if cart data is provided
checks if customer data is provided
checks if only one payment method is provided
checks if customer mixin is compliant with the customer mixin schema
checks if customer address mixin is compliant with the address mixin schema
Validates cart data
checks if product prices are valid (is existing, has valid date range, quantity is valid for a wholesale price)
checks if the free shipping discount is properly applied (it fails when cart contains a free shipping coupon but the shipping calculation is not equal to zero)
checks if products in cart are valid (is existing, has a valid tax code) and still in stock
checks if used coupons are valid
checks if the currency in the cart is the same as configured for the site
checks if the selected delivery window capacity is valid
checks if the cart's delivery window has all required fields
Creates an order.
Handles the payment.
Closes the cart.
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$
Customer’s saasToken
retrieved when logging in a customer. The header is required for customer's checkout. If the checkout is done by a guest then the header can be skipped.
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI2MTQ0MzU2MyIsImV4cCI6MTY5Nzk3MDUyOH0.F0b5jr6KeSoBCj-suTLuasmydaJEudc1ZrESkQXSCGk
POST /checkout/{tenant}/checkouts/order HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1167
{
"cartId": "9b36757a-5ea1-4689-9ed3-fb630eb5048c",
"paymentMethods": [
{
"provider": "payment-gateway",
"customAttributes": {
"customer": "635544345",
"modeId": "9a33c7a5-9535-42af-a936-2fa6ece27579"
},
"method": "invoice"
}
],
"currency": "EUR",
"shipping": {
"methodId": "4-more_hours_timeframe",
"zoneId": "deliveryarea",
"methodName": "Delivery method name",
"amount": 10,
"shippingTaxCode": "STANDARD"
},
"deliveryWindowId": "cbda2a28-f0cc-11ed-a05b-0242ac120003",
"addresses": [
{
"contactName": "John Doe",
"companyName": "Emporix",
"street": "Fritz-Elsaas",
"streetNumber": "20",
"streetAppendix": "",
"zipCode": "70173",
"city": "Stuttgart",
"country": "DE",
"state": "",
"contactPhone": "123456789",
"type": "SHIPPING",
"metadata": {
"mixins": {}
},
"mixins": {}
},
{
"contactName": "John Doe",
"companyName": "Emporix",
"street": "Fritz-Elsaas",
"streetNumber": "20",
"streetAppendix": "",
"zipCode": "70173",
"city": "Stuttgart",
"country": "DE",
"state": "",
"contactPhone": "123456789",
"type": "BILLING",
"metadata": {
"mixins": {}
},
"mixins": {}
}
],
"customer": {
"id": "8765472",
"title": "MR",
"firstName": "John",
"middleName": "",
"lastName": "Doe",
"contactPhone": "56432245",
"email": "[email protected]",
"company": "Emporix",
"metadata": {
"mixins": {}
},
"mixins": {}
}
}
{
"orderId": "B702231",
"paymentDetails": null,
"checkoutId": ""
}
Was this helpful?