Skip to main content
Skip to main content

CartsResource

carts.CartsResource

Properties

lineItemsLineItemsResourceRequired

Methods

addShippingMethod

addShippingMethod(cart_id, payload, customHeaders?): ResponsePromise<StoreCartsRes>

Adds a shipping method to cart

Parameters

cart_idstringRequired
Id of cart
Contains id of shipping option and optional data
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

complete

complete(cart_id, customHeaders?): ResponsePromise<StoreCompleteCartRes>

Completes a cart. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header Idempotency-Key. If not provided, we will generate one for the request.

Parameters

cart_idstringRequired
is required
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCompleteCartRes>

ResponsePromiseResponsePromise<StoreCompleteCartRes>Required

create

create(payload?, customHeaders?): ResponsePromise<StoreCartsRes>

Creates a cart

Parameters

is optional and can contain a region_id and items. The cart will contain the payload, if provided. Otherwise it will be empty
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

createPaymentSessions

createPaymentSessions(cart_id, customHeaders?): ResponsePromise<StoreCartsRes>

Creates payment sessions. Initializes the payment sessions that can be used to pay for the items of the cart. This is usually called when a customer proceeds to checkout.

Parameters

cart_idstringRequired
is required
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

deleteDiscount

deleteDiscount(cart_id, code, customHeaders?): ResponsePromise<StoreCartsRes>

Removes a discount from cart.

Parameters

cart_idstringRequired
is required
codestringRequired
discount code to remove
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

deletePaymentSession

deletePaymentSession(cart_id, provider_id, customHeaders?): ResponsePromise<StoreCartsRes>

Removes a payment session from a cart. Can be useful in case a payment has failed

Parameters

cart_idstringRequired
is required
provider_idstringRequired
the provider id of the session e.g. "stripe"
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

refreshPaymentSession

refreshPaymentSession(cart_id, provider_id, customHeaders?): ResponsePromise<StoreCartsRes>

Refreshes a payment session.

Parameters

cart_idstringRequired
is required
provider_idstringRequired
the provider id of the session e.g. "stripe"
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

retrieve

retrieve(cart_id, customHeaders?): ResponsePromise<StoreCartsRes>

Retrieves a cart

Parameters

cart_idstringRequired
is required
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

setPaymentSession

setPaymentSession(cart_id, payload, customHeaders?): ResponsePromise<StoreCartsRes>

Refreshes a payment session.

Parameters

cart_idstringRequired
is required
the provider id of the session e.g. "stripe"
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

update

update(cart_id, payload, customHeaders?): ResponsePromise<StoreCartsRes>

Updates a cart

Parameters

cart_idstringRequired
is required
payloadStorePostCartsCartReqRequired
is required and can contain region_id, email, billing and shipping address
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required

updatePaymentSession

updatePaymentSession(cart_id, provider_id, payload, customHeaders?): ResponsePromise<StoreCartsRes>

Updates the payment method

Parameters

cart_idstringRequired
is required
provider_idstringRequired
is required
is required
customHeadersRecord<string, any>Required

Default: `{}`

Returns

ResponsePromise<StoreCartsRes>

ResponsePromiseResponsePromise<StoreCartsRes>Required
Was this section helpful?