Delete Credit Card Payment

This function allows you to delete a credit card payment method on a customer. There is no body returned. This delete action cannot be undone. Also, please note that if you have multiple payment methods you must set a new default payment method before deleting the default payment method. If there is only one payment method you can delete it normally.

Path Parameters

PropertyTypeDescription
paymentMethodIdIntegerThis is the ID of the Payment Method you want to delete.
Examples
curl -X DELETE "https://secure.fusebill.com/v1/paymentMethods/{paymentMethodId}/creditCard" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic {APIKey}"
//path parameter, payment id
int pathParameter = {paymentMethodId};
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/paymentMethods/" + pathParameter+"/CreditCard");
//Set Content Length
request.ContentLength = 0;
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + apiKey);
//Set request method
request.Method = "DELETE";
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  result = streamReader.ReadToEnd();
}
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in your URI and Headers
r = requests.delete('https://secure.fusebill.com/v1/paymentMethods/{id}/creditCard', headers=headers)
print(r.content)
Response
returns a 204 No Content response upon success
{
    "ErrorId": 0,
    "HttpStatusCode": 400,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Cannot delete a default payment method. Please mark another payment method as the default first."
        }
    ]
}
Language
Authorization