B2B Features
Since version 4.0.0, Alokai's integration for SAP Commerce Cloud allows you to use B2B features of your SAP Commerce Cloud instance.
Assumptionsri:link
We have created our B2B features implementation based on the standard B2B Base Site & Base Store setup provided by SAP Comerce Cloud: the powertools-spa Base Site featuring the powertools Base Store and the powertools-spaContentCatalog
Make sure that B2B features are enabled on your SAP Commerce Cloud instance. Sample configuration of SAP Commerce Cloud fully configured with B2B features can be found here.
Configurationri:link
Configuration is exactly the same as the standard one described in the Quick start guide section of our docs.
The only difference is when providing baseSiteId
, make sure to provide the ID of a B2B store (powertools-spa
in the sample configuration), rather than of a typical B2C store (e.g. apparel-uk-spa
in the sample configuration).
If you try to use a B2B feature while the middleware is misconfigured to still connect to a B2C store, you may face errors such as the one below:
401 Unauthorized
{
"errors": [
{
"message": "It's not allowed to execute this call from the current channel",
"type": "AccessDeniedError"
}
]
}
B2B Features overviewri:link
B2B Productsri:link
- To get a product, use the
getProduct
method.const product = await sdk.sapcc.getProduct({ id: "1992695" });
- To get a list of products from a category, use the
getProductsByCategory
method.const products = await sdk.sapcc.getProductsByCategory({ categoryId: "1", });
B2B Cartsri:link
- To get the current cart, use the
getCurrentOrgCart
method.const currentCart = await sdk.sapcc.getCurrentOrgCart();
- To update the delivery address for a cart, use the
replaceOrgCartDeliveryAddress
method.const updatedCart = await sdk.sapcc.replaceOrgCartDeliveryAddress({ cartId: "00035084", addressId: "8796716793879", });
- To update the quantity of a product in the cart, use the
replaceOrgCartEntries
method.const updatedCartEntries = await sdk.sapcc.replaceOrgCartEntries({ cartId: "00035084" /*...other props*/, });
- To create additional quantity of products in the cart, use the
doAddOrgCartEntries
method.const addedEntries = await sdk.sapcc.doAddOrgCartEntries({ cartId: "00035084" /*...other props*/, });
- To update the cost center for the cart, use the
replaceOrgCartCostCenter
method.const updatedCostCenter = await sdk.sapcc.replaceOrgCartCostCenter({ cartId: "00035084", costCenterId: "Pronto_Services", });
- To update the payment type for the cart, use the
replaceOrgCartPaymentType
method.const updatedPaymentType = await sdk.sapcc.replaceOrgCartPaymentType({ cartId: "00035084", paymentType: "ACCOUNT", });
B2B Usersri:link
- To create a user registration request, use the
createRegistrationRequest
method.const userRegistration = await sdk.sapcc.createRegistrationRequest({ /*...props*/ });
- To get a user, use the
getOrgUser
method.const user = await sdk.sapcc.getOrgUser();
B2B Ordersri:link
- To create a cart from a previous order, use the
createCartFromOrder
method.const newCart = await sdk.sapcc.createCartFromOrder({ orderCode: "00001234", });
- To create an order, use the
placeOrgOrder
method.const newOrder = await sdk.sapcc.placeOrgOrder({ cartId: "00001234", termsChecked: true, });
- To create a replenishment order, use the
createReplenishmentOrder
method.const newReplenishmentOrder = await sdk.sapcc.createReplenishmentOrder( props );
- To get the order history of an organization's branch, use the
getUserBranchOrderHistory
method.const orderHistory = await sdk.sapcc.getUserBranchOrderHistory();
- To get an order from an organization's branch, use the
getBranchOrder
method.const branchOrder = await sdk.sapcc.getBranchOrder({ code: "00001234" });
B2B Order Approvalri:link
- To get a list of orders to be approved for a given user, use the
getOrderApprovals
method.const orderApprovals = await sdk.sapcc.getOrderApprovals();
- To approve or reject an order, use the
doMakeOrderApprovalDecision
method.const approvalDecision = await sdk.sapcc.doMakeOrderApprovalDecision({ orderApprovalCode: "approval-code" /*...other props*/, });
- To get details of an order to be approved, use the
getOrderApproval
method.const orderDetails = await sdk.sapcc.getOrderApproval({ orderApprovalCode: "approval-code", });
B2B Payment Typesri:link
- To get available payment types, use the
getPaymentTypes
method.const paymentTypes = await sdk.sapcc.getPaymentTypes();
B2B Cost Centersri:link
- To get active cost centers, use the
getActiveCostCenters
method.const activeCostCenters = await sdk.sapcc.getActiveCostCenters();
- To get cost center details, use the
getCostCenter
method.const costCenterDetails = await sdk.sapcc.getCostCenter({ costCenterCode: "some-code", });
- To get budgets for a cost center, use the
getBudgetsForCostCenter
method.const budgetsForCostCenter = await sdk.sapcc.getBudgetsForCostCenter({ costCenterCode: "some-code", });
- To get all cost centers, use the
getCostCenters
method.const allCostCenters = await sdk.sapcc.getCostCenters();