I have created order in world pay using API which return my reusable token. I am using this reusable token to do any next payment for the same order in future. I would like to delete the token now so that user can no longer use it. I have written below C# code to create order and capture the reusable token. can someone know how do i delete reusable token?
WorldpayRestClient restClient = new WorldpayRestClient("https://api.worldpay.com/v1", "Key");
var orderRequest = new OrderRequest()
{
token = token,
amount = 200,
//authorizedAmount=20,
currencyCode = CurrencyCode.GBP.ToString(),
name = "Laptop",
orderDescription = "Laptop description",
customerOrderCode = "ordercode_01",
};
var address = new Address()
{
address1 = "123 House Road",
address2 = "A village",
city = "London",
countryCode = CountryCode.GB.ToString(),
postalCode = "EC1 1AA"
};
orderRequest.billingAddress = address;
try
{
OrderResponse orderResponse = restClient.GetOrderService().Create(orderRequest);
string token = orderResponse.token;
Console.WriteLine("Order code: " + orderResponse.orderCode);
}
catch (WorldpayException error)
{
Console.WriteLine("Error code:" + error.apiError.customCode);
Console.WriteLine("Error description: " + error.apiError.description);
Console.WriteLine("Error message: " + error.apiError.message);
}
any help would be appreciated.
It seems that
delete tokenmethod is not implemented byWorldpayRestClientwhich is third party extension. Create your owndelete-tokenrequest like below. I have takenxxxxjust for example. Please set your actualtokenthere. Also verifyurl.You need to add
headersas shown below. Please addappropriatevalue in it. Check this for more detail about valuesThis is an example how you can make
DELETEweb request.