Newer Version Available

This content describes an older version of this product. View Latest

Commerce Webstore Checkout

Get, delete, or update a Commerce store checkout.

If a store is segmented into markets, this API looks at the language parameter appended to the URL to determine the shopper’s locale and returns the appropriate values.

Resource
1/commerce/webstores/webstoreId/checkouts/activeOrCheckoutId
Resource example
1https://yourInstance.salesforce.com/services/data/65.0/commerce/webstores/0ZESG000001n96S4AQ/checkouts/2z9R000000008LfIAI
Available version
55.0
If you want to use this resource with a WebStore of type B2CE, open a case with Salesforce Support and provide this information:
  • Salesforce organization ID
  • Tenant ID (You can find this ID on the Manage Cloud-to-Cloud Connections page in Setup)
  • B2C Commerce Business Manager login URL
  • B2C Commerce site IDs
HTTP methods
DELETE, GET, PATCH

During the checkout process, you must make a GET request to /commerce/webstores/webstoreId/checkouts/activeOrCheckoutId or /commerce/webstores/webstoreId/checkouts/checkoutId at least once after making a PATCH request to /commerce/webstores/webstoreId/checkouts. We recommend continuously polling the GET request until the API returns a 200 OK status, indicating that the response is ready for consumption.

Note

To resolve a 409 error returned on a PATCH or DELETE request, retry your request until it returns a 2xx status with updated data. To avoid returning a 409 error on PATCH or DELETE requests, make sure that you don’t have any custom code that modifies the cart or a checkout session while calling PATCH or DELETE.

Path parameter for DELETE, GET, and PATCH
Parameter Name Type Description Required or Optional Available Version
webstoreId String The ID of the web store. Required 55.0
activeOrCheckoutId String Values for activeOrCheckoutId are:
  • checkoutId—ID of the checkout.
  • active—Active checkout.
Required 55.0
Request parameters for GET
Parameter Name Type Description Required or Optional Available Version
effective​AccountId String ID of the account for which the request is made. If unspecified, defaults to the account ID for the context user. Optional 51.0
Response for DELETE
204: Successful Delete

A DELETE request clears all payment information for the checkout, including WebCart.BillingAddress.

Note

Request body for PATCH

Keep these considerations in mind when you use the PATCH API:

  • Must include data for only one sub-resource in a single call, such as contact information (contactInfo), shipping information (deliveryAddress, desiredDeliveryDate, and shippingInstructions), or delivery method (deliveryMethodId). The request fails if the request includes any of the following combinations:
    • deliveryAddress and deliveryMethodId
    • desiredDeliveryDate and deliveryMethodId
    • shippingInstructions and deliveryMethodId
    • desiredDeliveryDate and contactInfo
    • shippingInstructions and contactInfo
    • deliveryMethodId and contactInfo
  • The PATCH request triggers Cart Calculate API (CCA) when updates are made using the deliveryAddress, desiredDeliveryDate, deliveryMethod, or custom fields. CCA then performs cart calculations by executing the following default services: promotions, post-shipping, shipping, and taxes. For more details, see CCA. See Cart Calculate API.
Root XML tag
<checkout>
JSON examples
Here’s an example of a request including contact information and Cart custom fields:

The PATCH request fails if it includes contact information with Cart Delivery Group custom fields or with both Cart and Cart Delivery Group custom fields.

Note

1{
2  "contactInfo": {
3    "firstName": "Alan",
4    "lastName": "Johnson",
5    "email": "al**@jo*****.com",
6    "phoneNumber": "******3944"
7  },
8  "customFields": [
9    {
10      "attributes": {
11        "type": "WebCart"
12      },
13      "Id": "0a6xx0000000000",
14      "MyCustomTextField__c": "Foo",
15      "MyCustomNumberField__c": 12.34,
16      "MyCustomPercentField__c": 0.2345,
17      "MyCustomGeolocationField__c": {
18        "latitude": 33.345,
19        "longitude": 45.567
20      }
21    }
22  ]
23}
Here’s an example of a request including delivery method and custom fields:

A PATCH request that includes deliveryMethodId clears all payment information for the checkout, including WebCart.BillingAddress.

Note

1{
2  "deliveryMethodId": "7cdLT000000EzA5YAK",
3  "customFields": [
4    {
5      "attributes": {
6        "type": "WebCart"
7      },
8      "Id": "0a6xx0000000000",
9      "MyCustomTextField__c": "Foo",
10      "MyCustomNumberField__c": 12.34,
11      "MyCustomPercentField__c": 0.2345,
12      "MyCustomGeolocationField__c": {
13        "latitude": 33.345,
14        "longitude": 45.567
15      }
16    },
17    {
18      "attributes": {
19        "type": "CartDeliveryGroup"
20      },
21      "Id": "0a7SB000000oBujYAE",
22      "MyCustomTextField__c": "Bar",
23      "MyCustomNumberField__c": 4.55,
24      "MyCustomPhoneField__c": "******1212",
25      "MyCustomAddressField__c": {
26        "street": "100 Folsom Street",
27        "city": "San Francisco",
28        "state": "California", //This field isn't currently supported in custom fields.
29        "stateCode": "US_CA",
30        "postalCode": "93555",
31        "country": "United States", //This field isn't currently supported in custom fields.
32        "countryCode": "US",
33        "geocodeAccuracy": "City",
34        "latitude": 34,
35        "longitude": 85.9
36      }
37    }
38  ]
39}
Here’s an example of a request including shipping information (deliveryAddress, desiredDeliveryDate, and shippingInstructions) and custom fields:

The PATCH request fails if it includes only shipping instructions along with custom fields for either Cart or Cart Delivery Group.

Note

1{
2  "deliveryAddress": {
3    "name": "Alan Johnson",
4    "firstName": "Alan",
5    "lastName": "Johnson",
6    "region": "CA",
7    "country": "US",
8    "city": "San Francisco",
9    "street": "415 Mission St",
10    "postalCode": "94105"
11  },
12  "desiredDeliveryDate": "2021-05-28T16:41:41.090Z",
13  "shippingInstructions": "type code 1234 on gate keypad",
14  "customFields": [
15    {
16      "attributes": {
17        "type": "WebCart"
18      },
19      "Id": "0a6xx0000000000",
20      "MyCustomTextField__c": "Foo",
21      "MyCustomNumberField__c": 12.34,
22      "MyCustomPercentField__c": 0.2345,
23      "MyCustomGeolocationField__c": {
24        "latitude": 33.345,
25        "longitude": 45.567
26      }
27    },
28    {
29      "attributes": {
30        "type": "CartDeliveryGroup"
31      },
32      "Id": "0a7SB000000oBujYAE",
33      "MyCustomTextField__c": "Bar",
34      "MyCustomNumberField__c": 4.55,
35      "MyCustomPhoneField__c": "******1212",
36      "MyCustomAddressField__c": {
37        "street": "100 Folsom Street",
38        "city": "San Francisco",
39        "state": "California", //This field isn't currently supported in custom fields.
40        "stateCode": "US_CA",
41        "postalCode": "93555",
42        "country": "United States", //This field isn't currently supported in custom fields.
43        "countryCode": "US",
44        "geocodeAccuracy": "City",
45        "latitude": 34,
46        "longitude": 85.9
47      }
48    }
49  ]
50}
Here’s an example of a request including shipping information (deliveryAddress, desiredDeliveryDate, and shippingInstructions) without custom fields:

Any combination of these three sub-resources is valid if custom fields aren’t included in the request.

Note

1{
2  "deliveryAddress": {
3    "name": "Alan Johnson",
4    "firstName": "Alan",
5    "lastName": "Johnson",
6    "region": "CA",
7    "country": "US",
8    "city": "San Francisco",
9    "street": "415 Mission St",
10    "postalCode": "94105"
11  },
12  "desiredDeliveryDate": "2021-05-28T16:41:41.090Z",
13  "shippingInstructions": "type code 1234 on gate keypad"
14}
Here’s an example of a request for a guest user, including contact information and delivery address:
1{
2  "contactInfo": {
3    "firstName": "Alan",
4    "lastName": "Johnson",
5    "email": "al**@jo*****.com",
6    "phoneNumber": "******3944"
7  },
8  "deliveryAddress": {
9    "name": "Alan Johnson",
10    "firstName": "Alan",
11    "lastName": "Johnson",
12    "region": "CA",
13    "country": "US",
14    "city": "San Francisco",
15    "street": "415 Mission St",
16    "postalCode": "94105"
17  }
18}
Properties
Name Type Description Required or Optional Available Version
contactInfo Contact Information Input Contact information for the checkout. Optional 55.0
customFields sObject Attributes Input[]

Array of sObjects with respective custom fields. Currently, custom fields are supported on WebCart and CartDeliveryGroup entities. You can specify up to 21 sObjects in the array: one WebCart and multiple CartDeliveryGroups.

Field-level security rules from the shopper profile are applied to the custom fields. The rules are applied for registered shoppers and for the guest shopper profile.

You can specify this property only if you specify at least one other property. For example, you can set custom fields in PATCH checkouts when you specify the guest contact information or a delivery method (in addition to setting the delivery address).

The custom fields can be of type Checkbox, Currency, Date, Email, LongTextArea, Number, Percent, Phone, Text, TextArea, Url, Address, or Location. We currently don’t support updating the country and state fields through customFields as part of the address update using request. Instead, specify the countryCode and stateCode.

Use the yyyy-MM-dd format to specify date fields.

Use the yyyy-MM-ddTHH:mm:ss.SSS+/-HH:mm or yyyy-MM-ddTHH:mm:ss.SSSZ formats to specify dateTime fields. When a timezone is added to a UTC dateTime, the result is the date and time in that timezone.

Use the HH:mm.ss.SSS or HH:mm.ss.SSSZ formats to specify time fields. When a timezone is added to a UTC time, the result is the time in that timezone.

The customFields property isn't supported in stores built on an Aura template.

Optional 60.0
delivery​Address Checkout Address Input Shipping address for the checkout. Optional 55.0
delivery​MethodId String Delivery method ID for the checkout.

When Shipping is disabled for your web store, updation of delivery method isn’t supported.

Optional 55.0
desired​Delivery​Date String Desired delivery date for the checkout. Optional 55.0
shipping​Instructions String Special shipping instructions for the checkout. Optional 55.0
Response body for GET and PATCH
Checkout