Interfaces

Interface: UseCheckout

react-autonomy.UseCheckout

UseCheckout contains checkout-related functions returned by useCheckout.

Properties

completeAddressStep

completeAddressStep: (order?: CheckoutOrderInput) => Promise<OrderBig>

Type declaration

▸ (order?): Promise<OrderBig>

The completeAddressStep function saves shipping and billing addresses, and advances the checkout to the next step in the checkout process. completeAddressStep, completeDeliveryStep, and completePaymentStep must be called sequentially in this exact order to correctly complete a checkout.

Note: This function does not work with Stripe Checkout, because Stripe Checkout captures addresses as part of the hosted checkout experience.



JS


Parameters

Name

Type

order?

Returns

Promise<OrderBig>

Defined in



completeDeliveryStep

completeDeliveryStep: (order?: CheckoutOrderInput) => Promise<OrderBig>

Type declaration

▸ (order?): Promise<OrderBig>

The completeDeliveryStep function saves a chosen delivery method and advances the checkout to the next step in the checkout process. Shipping costs and taxes will be added to the order. completeAddressStep, completeDeliveryStep, and completePaymentStep must be called sequentially in this exact order to correctly complete a checkout.

Note: This function does not work with Stripe Checkout, because Stripe Checkout captures delivery method as part of the hosted checkout experience.



JS


Parameters

Name

Type

order?

Returns

Promise<OrderBig>

Defined in



completePaymentStep

completePaymentStep: (order?: CheckoutOrderInput) => Promise<OrderBig>

Type declaration

▸ (order?): Promise<OrderBig>

The completePaymentStep function saves a payment nonce from a third party payment provider, and advances the checkout to the next step in the checkout process. completeAddressStep, completeDeliveryStep, and completePaymentStep must be called sequentially in this exact order to correctly complete a checkout.

Note: This function does not work with Stripe Checkout, because Stripe Checkout captures payment as part of the hosted checkout experience.



JS


Parameters

Name

Type

order?

Returns

Promise<OrderBig>

Defined in



finalizeCheckout

finalizeCheckout: (options?: FinalizeCheckout) => Promise<OrderBig>

Type declaration

▸ (options?): Promise<OrderBig>

The finalizeCheckout function should be called when checkout has been completed.



JS


Parameters

Name

Type

options?

Returns

Promise<OrderBig>

Defined in



getStates

getStates: (options: GetStates) => Promise<CountryStates>

Type declaration

▸ (options): Promise<CountryStates>

The getStates function is used to retrieve information about countries and states available in the system to be used when we need to update the order's address. It takes the ISO code of the country and returns the list of states along with other information related to the country itself.



JS


Parameters

Name

Type

options

GetStates

Returns

Promise<CountryStates>

Defined in



modifyCheckout

modifyCheckout: (input: CheckoutOrderInput | CheckoutInput) => Promise<OrderBig>

Type declaration

▸ (input): Promise<OrderBig>

The modifyCheckout function can be used to update any information about a checkout, including addresses, delivery methods, and payment information. completeAddressStep, completeDeliveryStep, and completePaymentStep use modifyCheckout internally.



JS


Parameters

Name

Type

input

Returns

Promise<OrderBig>

Defined in



prepareCheckout

prepareCheckout: (options?: PrepareCheckout) => Promise<OrderBig>

Type declaration

▸ (options?): Promise<OrderBig>

The prepareCheckout function prepares the cart for checkout by attaching a checkoutSessionId to be passed to Stripe's checkout. It should be called just before redirecting to Stripe's checkout.

Note: This function only works with Stripe Checkout.



JS


Parameters

Name

Type

options?

Returns

Promise<OrderBig>

Defined in