updatePaymentInstrumentInBasket
Updates payment instrument of an existing basket.
This method communicates with the updatePaymentInstrumentInBasket endpoint of the Vue Storefront API Middleware. In turn, it receives data from the updatePaymentInstrumentInBasket or the Updates payment instrument of basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Possible Response
400 - InvalidPaymentMethodIdException - Indicates that the provided payment method is invalid or not applicable. or PaymentInstrumentPermanentlyMaskedException - Indicates that the basket payment instrument with the given id already is permanently masked. - InvalidCustomerException - Indicates that the customer assigned to the basket does not match the verified customer represented by the JWT, not relevant when using OAuth.
404 - PaymentInstrumentNotFoundException - Indicates that the payment instrument with the given payment instrument number is unknown.
Signature
export declare function updatePaymentInstrumentInBasket(
props: BasketPaymentInstrumentUpdateParams & {
basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.Basket>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | BasketPaymentInstrumentUpdateParams & { basketId?: string; } | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a Basket object.
Referenced Types
BasketPaymentInstrumentUpdateParamsShopperBaskets.Basket
Examples
Fetching a category by id.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.updatePaymentInstrumentInBasket({ id: 'root' });Fetching a category by id and changing the levels of nested subcategories through levels.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.updatePaymentInstrumentInBasket({ id: 'root', levels: 2 });Fetching a category by id for a different than the currently active locale.
import { sdk } from '~/sdk.config.ts';
const data: BasketPaymentInstrumentUpdateParams = {
paymentInstrumentId: 'piId',
amount: 10,
paymentMethodId: 'CREDIT_CARD',
};
const basket = await ocapiClient.updatePaymentInstrumentInBasket(
'currentBasket',
data
);