createPaymentInstrument
Creates a new saved payment instrument with the given id for the signed-in customer.
This method communicates with the createPaymentInstrument endpoint of the Vue Storefront API Middleware. In turn, it receives data from the createCustomerPaymentInstrument or the Add payment instrument for customer endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Signature
export declare function createPaymentInstrument(
props: CustomerCreatePaymentInstrumentParams
): Promise<import("commerce-sdk/dist/customer/customer").ShopperCustomers.CustomerPaymentInstrument>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | CustomerCreatePaymentInstrumentParams | 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 Customer Payment Instrument.
Referenced Types
CustomerCreatePaymentInstrumentParamsShopperCustomers.CustomerPaymentInstrument
Examples
Creating a saved customer Payment Instrument.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.createPaymentInstrument({
paymentInstrumentId: 'Home',
});