You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
replaceCartPaymentDetails
Assign payment details to the cart in SAP Commerce Cloud.
This method exchanges data with the replaceCartPaymentDetails endpoint exposed by the SAP OCC API Cart Payments Controller.
This method will only work for either a current user cart or a guest cart (i.e. cart with an email added to it). It will not work with an anonymous cart. In case of a guest cart, remember to pass cart guid as the cartId param. In case of a current user cart, pass cart code instead.
Signature
export declare function replaceCartPaymentDetails(
context: SapccIntegrationContext,
props: ReplaceCartPaymentDetailsProps
): Promise<void>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SapccIntegrationContext | |
props | Required | ReplaceCartPaymentDetailsProps | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
This method does not return anything.
Referenced Types
Examples
Assigning payment details to a cart.
import { sdk } from '~/sdk';
await sdk.commerce.replaceCartPaymentDetails({ cartId: '00035084', paymentDetailsId: '8796814737431' });