Manage a Customers Wallet

Your customers may wish to remove a saved instrument from their wallet after it has been saved. You can easily allow customers to remove saved instruments from their wallet using the delete instrument feature.

Delete an Instrument

curl --location --request DELETE '{{paymentInstrumentId}}' \
--header 'X-Api-Key: {{yourAPIKey}}' \
--header 'Authorization: Bearer {{yourBearerToken}}' \
var myHeaders = new Headers();
var environment = "substitute environment-value here"
var yourAPIkey = "YOUR-API-KEY";
var accessToken = "ACCESS-TOKEN";
var paymentInstrumentId = 1127915;

myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-Api-Key", yourAPIkey);
myHeaders.append("Authorization", `Bearer ${accessToken}`);

var raw = "";

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'

fetch("https://${environment}${paymentInstrumentId}", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking

var semaphore = DispatchSemaphore (value: 0)

let yourAPIkey = "YOUR-API-KEY";
let environment = "substitute environment-value here"
let accessToken = "ACCESS-TOKEN";
let paymentInstrumentId = 1127915;

var request = URLRequest(url: URL(string: "https://\(environment)\(paymentInstrumentId)")!,timeoutInterval: Double.infinity)
request.addValue(yourAPIkey, forHTTPHeaderField: "X-Api-Key")
request.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")

request.httpMethod = "DELETE"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
  print(String(data: data, encoding: .utf8)!)

var yourAPIkey = "YOUR-API-KEY"
var environment = "substitute environment-value here"
var accessToken = "ACCESS-TOKEN"
var paymentInstrumentId = 1127915

val response = khttp.delete(
  url = "https://$environment" + 
  headers = mapOf("Content-Type" to "application/json1",
                  "X-Api-Key" to yourAPIkey,
                 "Authorization", "Bearer $accessToken")

if(response.statusCode == 204) {
  print("Deleted paymentInstrumentId: $paymentInstrumentId")
} else {

Once an instrument is successfully deleted from a customer's wallet it will no longer be returned when retrieving a customer's wallet.


Instruments Linked to Payment Agreements

An instrument linked to an existing active payment agreement cannot be deleted from a customers wallet. The payment agreement will need to be updated to a new payment instrument or the payment agreement must be expired/deleted before the instrument can be removed.