deleteCardOnFile
Delete an existing Card-on-File.
Reference
Example
This example demonstrates how to catch errors that might be thrown by a function that tries deleting an existing Card-on-File.
suspend fun deleteExistingCardOnFile() {
try {
val brdge = BrdgeAPI(clientAPIKey = Constants.prodClientAPIKey, domain = BrdgeDomain.Production)
brdge.paymentInstrumentTokenization.createCardOnFile(
token = this.multiUseToken
)
} catch (blankTokenError: BrdgeDeleteCardOnFileValidationError.TokenBlank) {
errorMessage = "Token is empty"
} catch (notFoundError: BrdgeNetworkError.NotFound) {
errorMessage = "Token not found"
} catch (unauthorizedError: BrdgeNetworkError.Unauthorised) {
errorMessage = "Unauthorised..."
} catch (apiError: BrdgeNetworkError.ApiError) {
errorMessage = apiError.message
} catch (urlError: BrdgeNetworkError.UrlError) {
errorMessage = "No internet connection, please try again..."
} catch (e: Exception) {
errorMessage = "Something went wrong... Please try again."
}
}
Content copied to clipboard
Parameters
token
Multi-use token associated with the Card on File to be deleted
Throws
BR-DGE Delete Card On File errors.
This will be thrown if the BR-DGE REST API error is not a validation error or the validation error code cannot be matched to validation errors. Very common error to be thrown is BrdgeNetworkError.NotFound when a given token cannot be found.
This is an internal SDK error.