CartEndpoint

All actions perform through this endpoint do not require authentication but are scoped to the visitor's session.

Static Methods

Method Name Description
create(): Promise<{ cart: LCheckout }> Create a new cart.
oneClickCheckout(data: object, cart?: LCheckout): Promise<{ cart: LCheckout, error?: string }> Initiate a "one click" checkout.

Instance Methods

Method Name Description
subscribe(fn: Function): void Get updated cart details any time a cart is added or changed.
create(data: object): Promise<{ cart: LCheckout }> Create a new cart.
get(): Promise<{ cart: LCheckout }> Get an existing cart.
update(data: object): Promise<{ cart: LCheckout }> Update an existing cart.
delete(): Promise<{ success: boolean }> Not implemented
empty(): Promise<{ cart: LCheckout }> Remove all the items from a cart.
addDiscount(code: string): Promise<{ cart: LCheckout }> Add discount code to the cart.
addProduct(data: object): Promise<{ cart: LCheckout }> Add product to the cart.
addSponsorship(data: object): Promise<{ cart: LCheckout }> Add a child sponsorship to the cart.
updateItem(id, data: object): Promise<{ cart: LCheckout }> Update an item in the cart.
removeItem(id): Promise<{ cart: LCheckout }> Remove an item from the cart.
checkout(data): Promise<{ cart: LCheckout }> Submit the required for a successful checkout (i.e. name, address, etc...).
oneClickCheckout(data): Promise<{ cart: LCheckout, error?: string }> Initiate a "one click" checkout.
complete(): Promise<{ cart: LCheckout }> Complete a cart. Use to complete checkout for zero-dollar carts.