Get a list of VaultedPaymentMethod for the customerId attached to the client session. Build your own UI to display, manage and perform payments with them.

The list of vaulted payment methods is not affected by the checkout builder’s conditions. For example, if you configured the checkout builder to not show Paypal with the current client session, but Paypal was vaulted previously, fetchVaultedPaymentMethods will still return it.

The mentioned issue will be addressed and resolved in an upcoming release, improving the overall functionality of the Vault Manager.

TYPESCRIPT
    async fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>

Returns

The fetchVaultedPaymentMethods method fetches the vaulted payment methods for the customerId attached to the client session and returns a Promise of VaultedPaymentMethod[].

In case of successful operation, this method will return:

Example

The VaultManager needs to be configured before fetchVaultedPaymentMethods can be called. Refer to the following example for configuring the VaultManager.

TYPESCRIPT
async function handleFetchPaymentMethods() {
  try {
    //Ensure the Vault Manager has been configured
    const availablePaymentMethods =
      await vaultManager.fetchVaultedPaymentMethods();
    console.log("Payment methods fetched successfully");
  } catch (error) {
    console.error("Error fetching payment methods:", error);
  }
}