Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Checkout Functions

The Checkout drop-in provides API functions that enable you to programmatically control behavior, fetch data, and integrate with Adobe Commerce backend services.

Version: 3.1.0
FunctionDescription
authenticateCustomerAPI function for the drop-in..
estimateShippingMethodsCalls the estimateShippingMethods mutation..
getCartRetrieves the current cart’s checkout data from Adobe Commerce.
getCheckoutAgreementsReturns a list with the available checkout agreements.
getCompanyCreditAPI function for the drop-in..
getCustomerAPI function for the drop-in..
getNegotiableQuoteRetrieves a negotiable quote for B2B customers.
getStoreConfigThe storeConfig query defines information about a store’s configuration.
getStoreConfigCacheAPI function for the drop-in..
initializeCheckoutAPI function for the drop-in..
isEmailAvailableCalls the isEmailAvailable query..
resetCheckoutAPI function for the drop-in..
setBillingAddressCalls the setBillingAddressOnCart mutation..
setGuestEmailOnCartCalls the setGuestEmailOnCart mutation..
setPaymentMethodCalls the setPaymentMethodOnCart mutation..
setShippingAddressCalls the setShippingAddressesOnCart mutation..
setShippingMethodsSets one or more shipping methods on the cart.
synchronizeCheckoutAPI function for the drop-in..
function authenticateCustomer(authenticated = false): Promise<any>
ParameterTypeRequiredDescription

The estimateShippingMethods function calls the estimateShippingMethods mutation.

const estimateShippingMethods = async (
input?: EstimateShippingInput
): Promise<ShippingMethod[] | undefined>
ParameterTypeReq?Description
inputEstimateShippingInputNoAn object of type EstimateShippingInput, which contains a criteria object including the following fields: country_code, region_name, region_id, and zip.

Emits the shipping/estimate event.

Returns an array of ShippingMethod objects or null.

The getCart function retrieves the current cart’s checkout data from Adobe Commerce. It automatically uses the cart ID from internal state and calls either the getCart or customerCart GraphQL query depending on authentication status. The returned data includes billing address, shipping addresses, available and selected payment methods, email, total quantity, and virtual cart status—all the information needed to complete the checkout process.

const getCart = async (): Promise<any>

Does not emit any drop-in events.

Returns a Cart model containing complete checkout information.

The getCheckoutAgreements function returns a list with the available checkout agreements. Each agreement has a name and the mode (manual or automatic).

const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]>

Does not emit any drop-in events.

Returns an array of CheckoutAgreement objects.

const getCompanyCredit = async (): Promise<CompanyCredit | null>

Does not emit any drop-in events.

Returns CompanyCredit or null.

const getCustomer = async (): Promise<Customer | null>

Does not emit any drop-in events.

Returns Customer or null.

The getNegotiableQuote function retrieves a negotiable quote for B2B customers. The function calls the negotiableQuote query.

const getNegotiableQuote = async (
input: GetNegotiableQuoteInput = {}
): Promise<any>
ParameterTypeReq?Description
inputGetNegotiableQuoteInputNoInput parameters including the quote UID to retrieve.

Does not emit any drop-in events.

Returns void.

The storeConfig query defines information about a store’s configuration. You can query a non-default store by changing the header in your GraphQL request.

const getStoreConfig = async (): Promise<any>

Does not emit any drop-in events.

Returns void.

const getStoreConfigCache = async (): any

Does not emit any drop-in events.

Returns void.

function initializeCheckout(input: InitializeInput): Promise<any>
ParameterTypeRequiredDescription
inputInitializeInputYes

The isEmailAvailable function calls the isEmailAvailable query.

const isEmailAvailable = async (
email: string
): Promise<EmailAvailability>
ParameterTypeReq?Description
emailstringYesA string representing the email address to check for availability.

Does not emit any drop-in events.

Returns EmailAvailability.

const resetCheckout = async (): any

Emits the checkout/updated event.

Returns void.

The setBillingAddress function calls the setBillingAddressOnCart mutation.

const setBillingAddress = async (
input: BillingAddressInputModel
): Promise<any>
ParameterTypeReq?Description
inputBillingAddressInputModelYesThe billing address to set on the cart, including street, city, region, country, and postal code.

Does not emit any drop-in events.

Returns void.

The setGuestEmailOnCart function calls the setGuestEmailOnCart mutation.

const setGuestEmailOnCart = async (
email: string
): Promise<any>
ParameterTypeReq?Description
emailstringYesThe guest customer’s email address for order confirmation and communication.

Does not emit any drop-in events.

Returns void.

The setPaymentMethod function calls the setPaymentMethodOnCart mutation.

const setPaymentMethod = async (
input: PaymentMethodInputModel
): Promise<any>
ParameterTypeReq?Description
inputPaymentMethodInputModelYesThe payment method code and additional payment data required by the selected payment processor.

Does not emit any drop-in events.

Returns void.

The setShippingAddress function calls the setShippingAddressesOnCart mutation.

const setShippingAddress = async (
input: ShippingAddressInputModel
): Promise<any>
ParameterTypeReq?Description
inputShippingAddressInputModelYesThe shipping address to set on the cart, including street, city, region, country, and postal code.

Does not emit any drop-in events.

Returns void.

The setShippingMethods function sets one or more shipping methods on the cart. The function calls the setShippingMethodsOnCart mutation.

const setShippingMethods = async (
input: Array<ShippingMethodInputModel>
): Promise<any>
ParameterTypeReq?Description
inputArray<ShippingMethodInputModel>YesAn array of shipping method objects, each containing a carrier code and method code.

Does not emit any drop-in events.

Returns void.

function synchronizeCheckout(data: SynchronizeInput): Promise<any>
ParameterTypeRequiredDescription
dataSynchronizeInputYes

The following data models are used by functions in this drop-in.

The Cart object is returned by the following functions: getCart.

interface Cart {
type: 'cart';
availablePaymentMethods?: PaymentMethod[];
billingAddress?: CartAddress;
email?: string;
id: string;
isEmpty: boolean;
isGuest: boolean;
isVirtual: boolean;
selectedPaymentMethod?: PaymentMethod;
shippingAddresses: CartShippingAddress[];
}

The CheckoutAgreement object is returned by the following functions: getCheckoutAgreements.

interface CheckoutAgreement {
content: AgreementContent;
id: number;
mode: AgreementMode;
name: string;
text: string;
}

The CompanyCredit object is returned by the following functions: getCompanyCredit.

type CompanyCredit = {
availableCredit: Money;
exceedLimit?: boolean;
};

The Customer object is returned by the following functions: getCustomer.

interface Customer {
firstName: string;
lastName: string;
email: string;
}

The EmailAvailability object is returned by the following functions: isEmailAvailable.

type EmailAvailability = boolean;

The ShippingMethod object is returned by the following functions: estimateShippingMethods.

type ShippingMethod = {
amount: Money;
carrier: Carrier;
code: string;
title: string;
value: string;
amountExclTax?: Money;
amountInclTax?: Money;
};