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.
| Function | Description |
|---|---|
authenticateCustomer | API function for the drop-in.. |
estimateShippingMethods | Calls the estimateShippingMethods mutation.. |
getCart | Retrieves the current cart’s checkout data from Adobe Commerce. |
getCheckoutAgreements | Returns a list with the available checkout agreements. |
getCompanyCredit | API function for the drop-in.. |
getCustomer | API function for the drop-in.. |
getNegotiableQuote | Retrieves a negotiable quote for B2B customers. |
getStoreConfig | The storeConfig query defines information about a store’s configuration. |
getStoreConfigCache | API function for the drop-in.. |
initializeCheckout | API function for the drop-in.. |
isEmailAvailable | Calls the isEmailAvailable query.. |
resetCheckout | API function for the drop-in.. |
setBillingAddress | Calls the setBillingAddressOnCart mutation.. |
setGuestEmailOnCart | Calls the setGuestEmailOnCart mutation.. |
setPaymentMethod | Calls the setPaymentMethodOnCart mutation.. |
setShippingAddress | Calls the setShippingAddressesOnCart mutation.. |
setShippingMethods | Sets one or more shipping methods on the cart. |
synchronizeCheckout | API function for the drop-in.. |
authenticateCustomer
Section titled “authenticateCustomer”Signature
Section titled “Signature”function authenticateCustomer(authenticated = false): Promise<any>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|
estimateShippingMethods
Section titled “estimateShippingMethods”The estimateShippingMethods function calls the estimateShippingMethods mutation.
const estimateShippingMethods = async ( input?: EstimateShippingInput): Promise<ShippingMethod[] | undefined>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | EstimateShippingInput | No | An object of type EstimateShippingInput, which contains a criteria object including the following fields: country_code, region_name, region_id, and zip. |
Events
Section titled “Events”Emits the shipping/estimate event.
Returns
Section titled “Returns”Returns an array of ShippingMethod objects or null.
getCart
Section titled “getCart”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>Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns a Cart model containing complete checkout information.
getCheckoutAgreements
Section titled “getCheckoutAgreements”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[]>Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns an array of CheckoutAgreement objects.
getCompanyCredit
Section titled “getCompanyCredit”const getCompanyCredit = async (): Promise<CompanyCredit | null>Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns CompanyCredit or null.
getCustomer
Section titled “getCustomer”const getCustomer = async (): Promise<Customer | null>Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns Customer or null.
getNegotiableQuote
Section titled “getNegotiableQuote”The getNegotiableQuote function retrieves a negotiable quote for B2B customers. The function calls the negotiableQuote query.
const getNegotiableQuote = async ( input: GetNegotiableQuoteInput = {}): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | GetNegotiableQuoteInput | No | Input parameters including the quote UID to retrieve. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
getStoreConfig
Section titled “getStoreConfig”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>Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
getStoreConfigCache
Section titled “getStoreConfigCache”const getStoreConfigCache = async (): anyEvents
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
initializeCheckout
Section titled “initializeCheckout”Signature
Section titled “Signature”function initializeCheckout(input: InitializeInput): Promise<any>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
input | InitializeInput | Yes |
isEmailAvailable
Section titled “isEmailAvailable”The isEmailAvailable function calls the isEmailAvailable query.
const isEmailAvailable = async ( email: string): Promise<EmailAvailability>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | A string representing the email address to check for availability. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns EmailAvailability.
resetCheckout
Section titled “resetCheckout”const resetCheckout = async (): anyEvents
Section titled “Events”Emits the checkout/updated event.
Returns
Section titled “Returns”Returns void.
setBillingAddress
Section titled “setBillingAddress”The setBillingAddress function calls the setBillingAddressOnCart mutation.
const setBillingAddress = async ( input: BillingAddressInputModel): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | BillingAddressInputModel | Yes | The billing address to set on the cart, including street, city, region, country, and postal code. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
setGuestEmailOnCart
Section titled “setGuestEmailOnCart”The setGuestEmailOnCart function calls the setGuestEmailOnCart mutation.
const setGuestEmailOnCart = async ( email: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | The guest customer’s email address for order confirmation and communication. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
setPaymentMethod
Section titled “setPaymentMethod”The setPaymentMethod function calls the setPaymentMethodOnCart mutation.
const setPaymentMethod = async ( input: PaymentMethodInputModel): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | PaymentMethodInputModel | Yes | The payment method code and additional payment data required by the selected payment processor. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
setShippingAddress
Section titled “setShippingAddress”The setShippingAddress function calls the setShippingAddressesOnCart mutation.
const setShippingAddress = async ( input: ShippingAddressInputModel): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | ShippingAddressInputModel | Yes | The shipping address to set on the cart, including street, city, region, country, and postal code. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
setShippingMethods
Section titled “setShippingMethods”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>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | Array<ShippingMethodInputModel> | Yes | An array of shipping method objects, each containing a carrier code and method code. |
Events
Section titled “Events”Does not emit any drop-in events.
Returns
Section titled “Returns”Returns void.
synchronizeCheckout
Section titled “synchronizeCheckout”Signature
Section titled “Signature”function synchronizeCheckout(data: SynchronizeInput): Promise<any>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
data | SynchronizeInput | Yes |
Data Models
Section titled “Data Models”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[];}CheckoutAgreement
Section titled “CheckoutAgreement”The CheckoutAgreement object is returned by the following functions: getCheckoutAgreements.
interface CheckoutAgreement { content: AgreementContent; id: number; mode: AgreementMode; name: string; text: string;}CompanyCredit
Section titled “CompanyCredit”The CompanyCredit object is returned by the following functions: getCompanyCredit.
type CompanyCredit = { availableCredit: Money; exceedLimit?: boolean;};Customer
Section titled “Customer”The Customer object is returned by the following functions: getCustomer.
interface Customer { firstName: string; lastName: string; email: string;}EmailAvailability
Section titled “EmailAvailability”The EmailAvailability object is returned by the following functions: isEmailAvailable.
type EmailAvailability = boolean;ShippingMethod
Section titled “ShippingMethod”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;};