replaceOrgCartPaymentType
Updates the payment type for the B2B cart in SAP Commerce Cloud. Optionally, it updates purchaseOrderNumber if it's present.
This method sends a POST request to the replaceOrgCartPaymentType endpoint of the Alokai Middleware. In turn, it exchanges data with the replaceOrgCartPaymentType endpoint exposed by the SAP OCC API B2B Carts Controller.
This method is only for an authenticated customer as it uses vsf-sap-token cookie. In case there is no cookie, it won't work.
Signature
export declare function replaceOrgCartPaymentType<Res extends Cart = Cart,
Props extends ReplaceOrgCartPaymentTypeProps = ReplaceOrgCartPaymentTypeProps>(
props: Props,
options?: MethodOptions
): Promise<Res>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | Props | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Returns a representation of a Cart.
Referenced Types
- Cart
ReplaceOrgCartPaymentTypeProps- MethodOptions
Examples
Updates the payment type for the B2B cart (make sure you are an authenticated customer). HINT: Fetch available payment types using getPaymentTypes SDK method. Then pass code property of selected Payment Type object from the array.
import { sdk } from '~/sdk';
const cart = await sdk.commerce.replaceOrgCartPaymentType({ cartId: '00035084', paymentType: 'ACCOUNT' });Updates the payment type for the B2B cart and selecting response fields.
import { sdk } from '~/sdk';
const cart = await sdk.commerce.replaceOrgCartPaymentType({ cartId: '00035084', paymentType: 'ACCOUNT', fields: 'code,guid,user(FULL)' });Updates the payment type and purchase order number for the B2B cart (make sure you are an authenticated customer).
import { sdk } from '~/sdk';
const cart = await sdk.commerce.replaceOrgCartPaymentType({ cartId: '00035084', paymentType: 'ACCOUNT', purchaseOrderNumber: '567213' });