Salesforce Commerce B2B/D2C

Number of APIs: 18

Salesforce Commerce B2B/D2C APIs

This Qodex collection contains API endpoints from various Salesforce Commerce B2B/D2C API domains.

Get started

Follow this documentation to get started with Salesforce Qodex collections.

⚠️ Disclaimers:

ℹ️ Report issues and ask questions here.

Though not strictly required to use the collection, for ease of use some APIs in the collection assume data found in a commerce B2B/D2C trial webstore created through the SFDX commerce plugin. For more information on how to create a trial webstore please see How to Create Scratch Orgs and Stores.

Variables Reference

The collection relies on the following variables:

Note: Not every folder needs all of the variables. Look at the documentation of each folder for specific details

VariableDescriptionWhere to find it? (Some assume trial webstore)
orgUrlThe base URL for the Salesforce org.Through the following SFDX command :
sfdx force:org:display -u . The orgUrl is the Instance Url in the response.
orgIdSalesforce org Id.Use the Login org admin (SOAP) endpoint under Setup Queries folder to return the id. (This uses orgUsername and orgPassword)
orgUsernameOrg administrator usernameSpecified when the org was created.
orgPasswordOrg administrator passwordSpecified when the org was created.
apiVersionThe Salesforce API version (e.g.: 57.0).Log into the org -> Go to Setup -> type apex classes in the Quick Find box >> click New in the Apex Classes page -> click on the Version Setting tab to see all the supported versions
webstoreNameThe name of the webstore.Specified at webstore creation time.
webstoreIdThe Id of the webstore.Use the Get webstore id endpoint under Setup Queries folder to return the id. (This uses webstoreName)
buyerUsernameRegistered buyer/shopper username.Specified when creating the trial webstore.
buyerPasswordRegistered buyer/shopper password.Specified when creating the trial webstore.
buyerAccountIdAccount Id associated with the shopper/buyer.Use the Get buyer account id endpoint under Setup Queries folder to return the id. (This uses buyerUsername)
productSearchTermSearch term used to find the product.Defaulted to coffee, which will return results in the trial webstore.
  1. End2End Buyer/Shopper Journey - Search products by search term POST {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/search/product-search

  2. End2End Buyer/Shopper Journey - Update checkout with payment POST {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/checkouts/:checkoutId/payments

  3. Setup Queries - Get buyer account Id GET {{orgUrl}}/services/data/v{{apiVersion}}/query/?q=SELECT+Id,+Username,+AccountId+FROM+User+WHERE+UserName+=+'{{buyerUsername}}'

  4. End2End Buyer/Shopper Journey - Login buyer/shopper (SOAP) POST {{orgUrl}}/services/Soap/u/{{apiVersion}}

  5. End2End Buyer/Shopper Journey - Get product GET {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/products/:productId

  6. End2End Buyer/Shopper Journey - Delete cart (if needed) DELETE {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/carts/:cartId

  7. End2End Buyer/Shopper Journey - Create a cart POST {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/carts

  8. End2End Buyer/Shopper Journey - Add item to the cart POST {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/carts/:cartId/cart-items

  9. End2End Buyer/Shopper Journey - Get shipping address GET {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/accounts/{{buyerAccountId}}/addresses?addressType=Shipping&sortOrder=CreatedDateDesc&excludeUnsupportedCountries=true

  10. End2End Buyer/Shopper Journey - Update shipping address (if address exists) PATCH {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/accounts/{{buyerAccountId}}/addresses/:addressId