Interfaces
Interface: UseCheckout
module react autonomy docid\ zoz6w56ubppacr0po0gls usecheckout usecheckout contains checkout related functions returned by function usecheckout docid\ go7z uks4fuvnkd67yrqj properties completeaddressstep • completeaddressstep ( order? interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel ) => promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > type declaration ▸ ( order? ) promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > 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 import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { completeaddressstep } = usecheckout() completeaddressstep({ billaddressattributes { name 'customer', address1 '123 oak street', city 'portland', zipcode '04102', phone '1111111111', countryid 233, stateid 3367, }, usebilling true, }) } parameters name type order? interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel returns promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > defined in packages/react autonomy/src/hooks/use checkout ts 103 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l103 completedeliverystep • completedeliverystep ( order? interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel ) => promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > type declaration ▸ ( order? ) promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > 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 import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { completedeliverystep } = usecheckout() completedeliverystep({ shipmentsattributes \[ { id 5930, selectedshippingrateid 11608, }, ], }) } parameters name type order? interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel returns promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > defined in packages/react autonomy/src/hooks/use checkout ts 132 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l132 completepaymentstep • completepaymentstep ( order? interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel ) => promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > type declaration ▸ ( order? ) promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > 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 import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { completepaymentstep } = usecheckout() completepaymentstep({ paymentsattributes \[ { paymentmethodtype 'square', sourceattributes { nonce 'fake valid visa nonce', }, }, ], }) } parameters name type order? interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel returns promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > defined in packages/react autonomy/src/hooks/use checkout ts 163 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l163 finalizecheckout • finalizecheckout ( options? interface finalizecheckout docid\ d2pnfezsyeyylhpdtrepn ) => promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > type declaration ▸ ( options? ) promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > the finalizecheckout function should be called when checkout has been completed import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { finalizecheckout } = usecheckout() finalizecheckout({ ordernumber 'bb123', checkoutsessionid '123', }) } parameters name type options? interface finalizecheckout docid\ d2pnfezsyeyylhpdtrepn returns promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > defined in packages/react autonomy/src/hooks/use checkout ts 182 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l182 getstates • getstates ( options type alias getstates docid\ kscredg07y176hvztm6cq ) => promise < interface countrystates docid bmuvvwrgmu bs m3kfhk > type declaration ▸ ( options ) promise < interface countrystates docid bmuvvwrgmu bs m3kfhk > 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 import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { getstates } = usecheckout() getstates({ countryiso 'usa' }) } parameters name type options type alias getstates docid\ kscredg07y176hvztm6cq returns promise < interface countrystates docid bmuvvwrgmu bs m3kfhk > defined in packages/react autonomy/src/hooks/use checkout ts 201 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l201 modifycheckout • modifycheckout ( input interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel | interface checkoutinput docid 0sjji8iupszxdbhscgbug ) => promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > type declaration ▸ ( input ) promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > 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 https //chord stoplight io/docs/chord oms/91f77b1801684 update checkout import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { modifycheckout } = usecheckout() modifycheckout({ order { email 'boom\@bim com', }, state 'address', }) } parameters name type input interface checkoutorderinput docid\ q7be onfkgdy7h8yx6iel | interface checkoutinput docid 0sjji8iupszxdbhscgbug returns promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > defined in packages/react autonomy/src/hooks/use checkout ts 226 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l226 preparecheckout • preparecheckout ( options? type alias preparecheckout docid 1j4mydnmc0juzguufulc4 ) => promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > type declaration ▸ ( options? ) promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > 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 import { usecheckout } from '@chordcommerce/react autonomy' export default () => { const { preparecheckout } = usecheckout() preparecheckout() } parameters name type options? type alias preparecheckout docid 1j4mydnmc0juzguufulc4 returns promise < interface orderbig docid\ dviaog1oicyzdwppppgmo > defined in packages/react autonomy/src/hooks/use checkout ts 247 https //github com/chordcommerce/chord ui/blob/2b105e1/packages/react autonomy/src/hooks/use checkout ts#l247