Cert++
Close

Background calculators triggered by checkout API calls

Key Takeaway

Checkout API calls trigger the calculators, and the client must wait for 200 OK before sending the next call.

When a storefront calls the Commerce Checkout APIs, Salesforce automatically runs background calculators for the cart. Together they compute pricing, promotions, inventory, shipping, and tax. You never call the calculators directly. Which calculators run depends on the API call and the fields in its payload. The calculators work in the background, so the API uses status codes to tell the client when the results are ready.

What Start Checkout does

Start Checkout (PUT /commerce/webstores/{webstoreId}/checkouts) requires cartId. The resource accepts both POST and PUT, but Salesforce recommends PUT.

Start Checkout first checks whether the cart already has an active checkout session. If it finds one, it returns that session. Start Checkout creates a new session and returns the new checkoutId only when none exists.

Start Checkout always runs the pricing, promotions, and inventory calculators. Start Checkout also runs the shipping and tax calculators, but only if a delivery address is available. A delivery address can be available at checkout start in three ways:

  • The request includes deliveryAddressInput. A guest user also supplies an address this way.
  • The request sets shouldUseDefaultAddress to true, so the system uses the Contact Point Address or Profile address.
  • A registered user has a saved shipping address.

When the address comes from deliveryAddressInput or shouldUseDefaultAddress, the system validates the address and applies it to the CartDeliveryGroup object.

Salesforce Accredited B2B Commerce Developer Professional Study Guide

Checklist progress

0/124Learned

Customize existing checkout flows in order to address the most common customer needs and provide an optimal Storefront experience

0/19

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Salesforce Accredited B2B Commerce Developer Professional studiers. 757 members and growing.