removeCard
Method removing a stored credit card from the customer's account.
The method works only for authenticated customer. It communicates with the removeCard endpoint of the Vue Storefront API Middleware and passes the stored credit card's reference to it. In turn, it obtains the customer's reference based on the access token and calls the DELETE /storedPaymentMethods Adyen endpoint using aforementioned reference and the stored credit card's reference.
Signature
export declare function removeCard(
props: RemoveCardParams,
options?: MethodOptions
): Promise<void>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | RemoveCardParams | 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 Promise<void>
Referenced Types
Examples
Creating a session, mounting the payment element and using the removeCard method within the dropinConfiguration.
import { sdk } from '~/sdk.config.ts';
const session = await sdk.adyen.createSession();
await sdk.adyen.mountPaymentElement({
session,
paymentDOMElement: "#payment-element",
adyenConfiguration: {
async onPaymentCompleted(result, component) {},
},
dropinConfiguration: {
showRemovePaymentMethodButton: true,
async onDisableStoredPaymentMethod(recurringDetailReference, resolve, reject) {
try {
await sdk.adyen.removeCard({ recurringDetailReference })
resolve();
} catch (err) {
// Do something with err...
reject();
}
}
}
});