Logo
Salesforce Developers API Documentation

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

Variable Description Where to find it? (Some assume trial webstore)
orgUrl The 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.
orgId Salesforce org Id. Use the Login org admin (SOAP) endpoint under Setup Queries folder to return the id. (This uses orgUsername and orgPassword)
orgUsername Org administrator username Specified when the org was created.
orgPassword Org administrator password Specified when the org was created.
apiVersion The 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
webstoreName The name of the webstore. Specified at webstore creation time.
webstoreId The Id of the webstore. Use the Get webstore id endpoint under Setup Queries folder to return the id. (This uses webstoreName)
buyerUsername Registered buyer/shopper username. Specified when creating the trial webstore.
buyerPassword Registered buyer/shopper password. Specified when creating the trial webstore.
buyerAccountId Account Id associated with the shopper/buyer. Use the Get buyer account id endpoint under Setup Queries folder to return the id. (This uses buyerUsername)
productSearchTerm Search term used to find the product. Defaulted to coffee, which will return results in the trial webstore.


1. Setup Queries - Get buyer account Id

GET {{orgUrl}}/services/data/v{{apiVersion}}/query/?q=SELECT+Id,+Username,+AccountId+FROM+User+WHERE+UserName+=+'{{buyerUsername}}'



2. End2End Buyer/Shopper Journey - Login buyer/shopper (SOAP)

POST {{orgUrl}}/services/Soap/u/{{apiVersion}}



3. End2End Buyer/Shopper Journey - Get product

GET {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/products/:productId



4. End2End Buyer/Shopper Journey - Delete cart (if needed)

DELETE {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/carts/:cartId



5. End2End Buyer/Shopper Journey - Create a cart

POST {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/carts



6. End2End Buyer/Shopper Journey - Add item to the cart

POST {{orgUrl}}/services/data/v{{apiVersion}}/commerce/webstores/{{webstoreId}}/carts/:cartId/cart-items

ENDPOINTS