Delete a vaulted payment method for the customerId attached to the client session by id. You can get the id from any instance of PrimerVaultedPaymentMethod returned by fetchVaultedPaymentMethods.

KOTLIN
suspend fun deleteVaultedPaymentMethod(vaultedPaymentMethodId: String): Result<Unit>

Parameters

Returns

The deleteVaultedPaymentMethod method performs the deletion of vaulted payment method and returns a result object of type Result.

The Result class represents the outcome of the operation, indicating success or failure.

By inspecting the returned Result object, you can determine the success or failure of the deletion of the vaulted payment method. This allows you to handle different scenarios based on the result.

Example

Refer to the following example for fetching vaulted payment methods.

KOTLIN
private fun deleteVaultedPaymentMethod(vaultedPaymentMethodId: String) {
  // 👇 delete vaulted payment method by calling suspend function within the scope
  scope.launch {
    vaultManager.deleteVaultedPaymentMethod(vaultedPaymentMethodId).onSuccess {
      // display success message to the user, remove vaulted payment method from the list...
    }.onFailure { throwable ->
      // handle error
    }
  }
}