Checkout endpoint v2
This page describes the checkout
endpoint, which can be used to
interact with your external e-commerce solution’s REST checkout service.
In v2, all the rest-call paths have been slightly changed to be more descriptive and intuitive. The v2 checkout endpoint sets the address of a cartId
to ensure the correct resource is consistently identified. For example, the v1 /checkouts/address/{cartId}
becomes in v2 /carts/{cartId}/address
.
In general, the checkout process involves four steps:
-
Set an address.
-
Get shipping methods.
-
Set a shipping method.
-
Create an order.
Note that in Adobe Commerce (formerly Magento), steps 1 and 2 are combined in step 2. Get shipping methods, where you must provide the address
object as a required parameter.
Magento is now Adobe Commerce, powered by Magento. In the examples and configuration below, we may refer to Adobe Commerce as Magento. |
POST
Sets the address for checkout and gets a list of shipping methods for a cart. Make sure the cart has at least one item, otherwise empty is returned.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The JSON param for the address object. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The user’s access token. |
|
|
PUT
Returns the payment method and total amounts for the cart.
Request URL
.rest/ecommerce/v2/carts/{cartId}/shippingmethod
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The shipping information wrapper. |
|
|
|
required The user’s access token. |
|
|
POST
Creates an order and returns an orderId
.
Request URL
/.rest/ecommerce/v2/orders/carts/{cartId}
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The JSON param for the |
|
|
|
required The user’s access token. |
|
|
PUT
Sets an address. The shipping address is set by default and is required for a successful checkout process. The billing address is set when the address object contains the field addressType
with a billing
value.
The billing address is optional.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/address
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The shipping address (does not require |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
POST
Gets the shipping method for a cart by location and currency.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The JSON param for the address object. commercetools requires only the |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
PUT
Sets the shipping method for a cart and returns the cart with the shipping method.
Request URL
.rest/ecommerce/v2/carts/{cartId}/shippingmethod
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The shipping information wrapper. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
POST
Creates and returns an order.
Request URL
/.rest/ecommerce/v2/orders/carts/{cartId}
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
GET
Returns a shipping method.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
In the case of Salesforce Commerce, you must prepare a token from Salesforce Commerce. A guest token is required for anonymous users. For logged in users, a token is also required.
-
To obtain a guest token, you must have a Salesforce Commerce API
client_id
to use in the query parameters. -
To obtain a logged-in user token, you must have a Salesforce Commerce API
client_id
to use in the query parameters and pass valid user credentials as HTTP Basic in base 64 in the formusername:password
.
Query example: https://magnolia1-tech-prtnr-eu02-dw.demandware.net/s/RefArchGlobal/dw/shop/v20_3/customers/auth?client_id=0a0dddf0-aaf0-0000-b000-000000c00a0e
In both cases, in the response header, you have an item named Authorization with a value such as Bearer xyzabc
, xyzabc
is your token
(exclude Bearer
).
PUT
Set existing addressId of logged in user.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/address
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The shipping address (does not require |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The user’s access token. |
|
|
POST
Creates a new shipping method.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The JSON param for the address object. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The user’s access token. |
|
|
PUT
Returns the payment method and total amounts for the cart.
Request URL
.rest/ecommerce/v2/carts/{cartId}/shippingmethod
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The shipping information wrapper. |
|
|
|
required The user’s access token. |
|
|
POST
Creates and returns an order.
Request URL
/.rest/ecommerce/v2/orders/carts/{cartId}
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The user’s access token. |
|
|
GET
Returns a shipping method.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The user’s access token. |
|
|
Also see the User endpoint, which can be used to log in a user and retrieve their address and payment information from your SAP Commerce Cloud service. |
PUT
Sets address. The shipping address is set by default and is required for
a successful checkout process. The billing address is set when the
address object contains the field addressType
with a billing
value.
The billing address is optional.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/address
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The shipping address (does not require |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
POST
Creates a new shipping method.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The JSON param for the address object. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
PUT
Returns the payment method and total amounts for the cart.
Request URL
.rest/ecommerce/v2/carts/{cartId}/shippingmethod
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The shipping information wrapper. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
POST
Creates and returns an order.
Request URL
/.rest/ecommerce/v2/orders/carts/{cartId}
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|
GET
Returns a shipping method.
Request URL
/.rest/ecommerce/v2/carts/{cartId}/shippingmethods
Parameters
Parameter | Description | Type | Data Type |
---|---|---|---|
|
required The definition name. |
|
|
|
required The connection name. |
|
|
|
required The ID for the checkout cart. |
|
|
|
required The The unique ID of the user. |
|
|
|
required The user’s access token. |
|
|