curl --request POST \
--url https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate \
--header 'Content-Type: application/json' \
--data '
{
"termination_date": "2023-12-25",
"void_invoice_ids": [
123
],
"void_date": "2023-12-25",
"reverse_remaining_revenue": false,
"credit_unused_revenue": true,
"successor_contract_id": 123,
"successor_target_kind": "prepaid_commit",
"successor_target_id": 123,
"credit_memo_date": "2023-12-25"
}
'import requests
url = "https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate"
payload = {
"termination_date": "2023-12-25",
"void_invoice_ids": [123],
"void_date": "2023-12-25",
"reverse_remaining_revenue": False,
"credit_unused_revenue": True,
"successor_contract_id": 123,
"successor_target_kind": "prepaid_commit",
"successor_target_id": 123,
"credit_memo_date": "2023-12-25"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
termination_date: '2023-12-25',
void_invoice_ids: [123],
void_date: '2023-12-25',
reverse_remaining_revenue: false,
credit_unused_revenue: true,
successor_contract_id: 123,
successor_target_kind: 'prepaid_commit',
successor_target_id: 123,
credit_memo_date: '2023-12-25'
})
};
fetch('https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'termination_date' => '2023-12-25',
'void_invoice_ids' => [
123
],
'void_date' => '2023-12-25',
'reverse_remaining_revenue' => false,
'credit_unused_revenue' => true,
'successor_contract_id' => 123,
'successor_target_kind' => 'prepaid_commit',
'successor_target_id' => 123,
'credit_memo_date' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate"
payload := strings.NewReader("{\n \"termination_date\": \"2023-12-25\",\n \"void_invoice_ids\": [\n 123\n ],\n \"void_date\": \"2023-12-25\",\n \"reverse_remaining_revenue\": false,\n \"credit_unused_revenue\": true,\n \"successor_contract_id\": 123,\n \"successor_target_kind\": \"prepaid_commit\",\n \"successor_target_id\": 123,\n \"credit_memo_date\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate")
.header("Content-Type", "application/json")
.body("{\n \"termination_date\": \"2023-12-25\",\n \"void_invoice_ids\": [\n 123\n ],\n \"void_date\": \"2023-12-25\",\n \"reverse_remaining_revenue\": false,\n \"credit_unused_revenue\": true,\n \"successor_contract_id\": 123,\n \"successor_target_kind\": \"prepaid_commit\",\n \"successor_target_id\": 123,\n \"credit_memo_date\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"termination_date\": \"2023-12-25\",\n \"void_invoice_ids\": [\n 123\n ],\n \"void_date\": \"2023-12-25\",\n \"reverse_remaining_revenue\": false,\n \"credit_unused_revenue\": true,\n \"successor_contract_id\": 123,\n \"successor_target_kind\": \"prepaid_commit\",\n \"successor_target_id\": 123,\n \"credit_memo_date\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"contract_terminated": true,
"contract_draft_id": 123,
"voided_invoice_ids": [
123
],
"drafted_invoice_ids": [
123
],
"credit_memo_id": 123,
"successor_credit_memo_id": 123,
"reversal_transaction_count": 0,
"reversal_transaction_ids": [
123
]
}Terminate Contract
Terminate a contract and optionally void associated invoices.
If the user has permission to terminate contracts and void invoices, both operations are performed atomically. If the user lacks permission for either operation, a draft is created instead, and the response indicates which operations were drafted.
Returns 400 if any of the provided void_invoice_ids are invalid (not found, already voided, has payments, void date is before the invoice date, or in a closed period).
curl --request POST \
--url https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate \
--header 'Content-Type: application/json' \
--data '
{
"termination_date": "2023-12-25",
"void_invoice_ids": [
123
],
"void_date": "2023-12-25",
"reverse_remaining_revenue": false,
"credit_unused_revenue": true,
"successor_contract_id": 123,
"successor_target_kind": "prepaid_commit",
"successor_target_id": 123,
"credit_memo_date": "2023-12-25"
}
'import requests
url = "https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate"
payload = {
"termination_date": "2023-12-25",
"void_invoice_ids": [123],
"void_date": "2023-12-25",
"reverse_remaining_revenue": False,
"credit_unused_revenue": True,
"successor_contract_id": 123,
"successor_target_kind": "prepaid_commit",
"successor_target_id": 123,
"credit_memo_date": "2023-12-25"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
termination_date: '2023-12-25',
void_invoice_ids: [123],
void_date: '2023-12-25',
reverse_remaining_revenue: false,
credit_unused_revenue: true,
successor_contract_id: 123,
successor_target_kind: 'prepaid_commit',
successor_target_id: 123,
credit_memo_date: '2023-12-25'
})
};
fetch('https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'termination_date' => '2023-12-25',
'void_invoice_ids' => [
123
],
'void_date' => '2023-12-25',
'reverse_remaining_revenue' => false,
'credit_unused_revenue' => true,
'successor_contract_id' => 123,
'successor_target_kind' => 'prepaid_commit',
'successor_target_id' => 123,
'credit_memo_date' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate"
payload := strings.NewReader("{\n \"termination_date\": \"2023-12-25\",\n \"void_invoice_ids\": [\n 123\n ],\n \"void_date\": \"2023-12-25\",\n \"reverse_remaining_revenue\": false,\n \"credit_unused_revenue\": true,\n \"successor_contract_id\": 123,\n \"successor_target_kind\": \"prepaid_commit\",\n \"successor_target_id\": 123,\n \"credit_memo_date\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate")
.header("Content-Type", "application/json")
.body("{\n \"termination_date\": \"2023-12-25\",\n \"void_invoice_ids\": [\n 123\n ],\n \"void_date\": \"2023-12-25\",\n \"reverse_remaining_revenue\": false,\n \"credit_unused_revenue\": true,\n \"successor_contract_id\": 123,\n \"successor_target_kind\": \"prepaid_commit\",\n \"successor_target_id\": 123,\n \"credit_memo_date\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meetcampfire.com/rr/api/v1/contracts/{id}/terminate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"termination_date\": \"2023-12-25\",\n \"void_invoice_ids\": [\n 123\n ],\n \"void_date\": \"2023-12-25\",\n \"reverse_remaining_revenue\": false,\n \"credit_unused_revenue\": true,\n \"successor_contract_id\": 123,\n \"successor_target_kind\": \"prepaid_commit\",\n \"successor_target_id\": 123,\n \"credit_memo_date\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"contract_terminated": true,
"contract_draft_id": 123,
"voided_invoice_ids": [
123
],
"drafted_invoice_ids": [
123
],
"credit_memo_id": 123,
"successor_credit_memo_id": 123,
"reversal_transaction_count": 0,
"reversal_transaction_ids": [
123
]
}Body
Date the termination credit memo posts on, or the first open date after it when books are closed. Defaults to the termination date and cannot be earlier than it. Only reversals of periods that have already elapsed move to this date; future scheduled reversals keep their dates. The termination date is the service cutoff, while invoices dated up to the date the credit memo posts are included in what is credited. Requires reverse_remaining_revenue=true.
Response
Response serializer for contract termination with hints about drafted operations.