Interface: UseCheckout
react-autonomy.UseCheckout
UseCheckout contains checkout-related functions returned by useCheckout.
• completeAddressStep: (order?: CheckoutOrderInput) => Promise<OrderBig>
▸ (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.
Name | Type |
---|---|
order? |
Promise<OrderBig>
• completeDeliveryStep: (order?: CheckoutOrderInput) => Promise<OrderBig>
▸ (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.
Name | Type |
---|---|
order? |
Promise<OrderBig>
• completePaymentStep: (order?: CheckoutOrderInput) => Promise<OrderBig>
▸ (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.
Name | Type |
---|---|
order? |
Promise<OrderBig>
• finalizeCheckout: (options?: FinalizeCheckout) => Promise<OrderBig>
▸ (options?): Promise<OrderBig>
The finalizeCheckout function should be called when checkout has been completed.
Name | Type |
---|---|
options? |
Promise<OrderBig>
• getStates: (options: GetStates) => Promise<CountryStates>
▸ (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.
Name | Type |
---|---|
options | GetStates |
Promise<CountryStates>
• modifyCheckout: (input: CheckoutOrderInput | CheckoutInput) => Promise<OrderBig>
▸ (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.
It calls the Chord OMS update checkout endpoint.
Name | Type |
---|---|
input |
Promise<OrderBig>
• prepareCheckout: (options?: PrepareCheckout) => Promise<OrderBig>
▸ (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.
Name | Type |
---|---|
options? |
Promise<OrderBig>