Cancel Purchase

This method allows a purchase to be cancelled after it has moved from draft to purchased. If the purchase is in draft status, then remove it with the Delete Draft Purchase request

Request Parameters

cancellationOptionEnum:{None, Unearned, Full}"None" means reverse none of the charges generated by the purchase. "Unearned" means reverse the charges only for the unearned amounts. "Full" means reverse all the generated charges regardless of earning.Yes
purchaseIdIntegerThe ID of the purchaseYes
curl –X POST\ 
-H "Content-Type: application/json" \ 
-H "Authorization: Basic {APIKey}" \ 
-d "{purchaseId:164359,cancellationOption:'None'}"
//Json data for payload 
string jsonData = "{'purchaseId':164359,'cancellationOption':'None'}"; 
//Setup API key 
string apiKey = "{APIKey}"; 
//Configure URI 
WebRequest request = WebRequest.Create("HTTPS://"); 
//Add Content type 
request.ContentType = "application/json"; 
//Add Api key authorization 
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey); 
//Set request method 
request.Method = "POST"; 
//Add the json data to request 
using (var streamWriter = new StreamWriter(request.GetRequestStream())) 
//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 JSON 
import json 
#Import library Requests 
import requests 
#Pass in a dictionary to the Headers parameter 
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'} 
#Pass in a dict to the Payload parameter 
payload = {'purchaseId':164359,'cancellationOption':'None'} 
#Pass in your URI, Payload and Headers 
r =', data=json.dumps(payload), headers=headers) 
  "purchaseId": 123456789,
  "cancellationOption": "Unearned"
This call returns a 204 no content response upon success
    "ErrorId": 0,
    "HttpStatusCode": 400,
    "Errors": [
            "Key": "purchaseCancel.CancellationOption",
            "Value": "Allowable Cancel Options are: None, Unearned, Full"