Checkout Summary
To get a summary of the checkout process, you need to provide an orderId and the payment method that was used. The summary will return a CheckoutSummaryType which contains all the necessary information to show the user a summary of the checkout process.
Overview
- The checkout summary will return a summary of the checkout process.
- The summary will also contain the number of purchases made by the customer.
- The summary will contain the HTML snippet that can be used to render the summary.
Options
orderId- The order id of the order you want to get the summary for.paymentMethod- The payment method to be used for the checkout.
Return Object
The return object contains an instance of CheckoutSummaryType, which includes details such as item information, shipping details, total amount, applicable discounts, and taxes.
typescript
type CheckoutSummaryType = {
htmlSnippet?: string;
order?: CheckoutSummaryOrderType;
nthPurchase?: number;
};htmlSnippet- The HTML snippet that can be used to render the summary.order- The order summary.nthPurchase- The number of purchases made by the customer.
🤓 Take note
Some external payment gateways expect you to render their summary.
Example
typescript
const checkoutSummary = await geinsOMS.checkout.summary({
orderId: 'my-public-order-id',
paymentMethod: 'STANDARD'
});
if (checkoutSummary) {
console.log(checkoutSummary);
}
if (checkoutSummary.nthPurchase === 1) {
shotConfetti('Welcome as a new customer');
} else {
shotConfetti('Thank you for your continued support!');
}