Starter Store provides all the functionalities required to implement your checkout process using your e-commerce backend. The Boot application includes components like Cart, Shipment options, Payments registration, and Order placement.
The Checkout components and pages allow customers to add/remove products to their cart, select shipment options, make a payment (through integration with payment providers), and place the order. These operations are available in almost every e-commerce backend.
This paragraph describes the checkout process designed in the Starter Store Boot application. Please consider that this represents just an example of the checkout flow: it can be customized to meet your requirements. In the next paragraph we will see how the e-commerce APIs are used by the boot application: using this configuration as an example, you will be able to use BRIEF to design your own flow.
The cart component is used directly in pages containing a products grid (or more generally, a products result): you can use the Add to Cart button allowing this operation. In addition, in the Starter Store Boot application, the status of the cart is available under the /carts page: there you can change the number of the items or delete them.
Once customers decide to proceed with checkout, they can start this process directly from the cart page, using the checkout button. If the customer is not authenticated, the login form will appear. After the login, the user will be redirected to the Shipment Address page: based on the shipment address saved in the account configuration, the user will be able to select only one of them.
The next phase is related to the Payment process. It is important to understand that the payment in this specific case consists of two important operations:
- Transferring money via the payment provider,
- Registration of the payment in your e-commerce backend.
These two concepts are connected with each other but must be considered as two different steps. Most of the e-commerce systems don't support OOTB integration with payment providers, this needs to be designed and implemented by system integrators. This effort is required in the Starter Store as well.
On the other hand, the Starter Store boot application fully supports payment registration in the e-commerce backend.
Once the payment process is completed, a new order will be created in the e-commerce backend. The list of orders is available directly in your account details section.
The Checkout components used in the Starter Store Boot application are command chain delivery components. In addition, BRIEF enables the creation of RESTful JAX-RS resources needed to customise the Shipment and Payment details during the checkout process: those custom REST endpoints can be invoked by application not part of the Starter Store (e.g. standalone JS application).
StarterStorore JAX-RS resources are extending the AbstractStarterStoreResource: this class offers all the utilities you need in order to create your custom plain resource and at the same time, use all the concepts provided by BRIEF, like commerce and connector exchanges, commerce context etc.
In addition, the Starter Store Boot application provides a built-in HST component, called CheckoutComponent, that's actually responsible for the checkout process. This will ensure that customers are authenticated before starting the checkout and that this follows a specific flow. It's also responsible for retrieving user details, like customer default shipment address.
The Cart implementation consists of a set of command chain delivery component. Every command has been upgraded to use the CartRepository interface defined with the Commerce Connector SDK API: you can have a look a the CartRepository table defined in the Connector SDK API Detail page.
A specific command has been created for each cart operation:
Is important to mention that, based on the StarterStore request phase (RESOURCE, ACTION, RENDERING), those commands can behave differently.
Shipment has been exposed as a custom JAX-RS services available in BRIEF. You can find its definition in the OrderResource class. The REST endpoints made available by this component are:
- shipmentAddresses, where is possible to specify the shipment address to associate during checkout. The commerce connector component used to update cart shipment address is cartShipmentAddressUpdate.
- billingAddresses, where is possible to specify the shipment method to use during checkout.
- shipmentOptions, where is possible to specify the shipment method to use during checkout. The commerce connector component used to update cart shipment method is cartShipmentMethodUpdate
The Payment component is a custom JAX-RS service included in BRIEF. You can find the related definition in the OrderResource class. The REST endpoint available are
- paymentMethod: this endpoint will only register the payment method to use during the checkout
Order functionality is fully based on the Commerce Connector SDK API. An interface, called OrderRepository has been defined and documented in the Connector SDK API Detail page, under the OrderRepository table : more details can be found there. BRIEF defines a set of REST endpoints directly invoking the repository implementation. Those endpoints are:
- confirmations, responsible for the final order placement. The related REST endpoint definition uses the orderCreate connector component.
In addition, authenticated customers can also retrieve a list of placed orders. This option is available in the account section, under My orders. This component is just a GenericCommandChainComponent using the orderQuery connector component.