Calculate Invoice Payment
curl --request POST \
--url https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"transactions": [
{
"transaction_id": 123,
"amount": 0,
"posted_at": "2023-12-25",
"withholding_amount": 500000000000000000
}
],
"credit_memos": [
{
"credit_memo_id": 123,
"amount": 0,
"posted_at": "2023-12-25"
}
],
"empty_transactions": [
{
"amount": 0,
"payment_date": "2023-12-25",
"withholding_amount": 500000000000000000
}
]
}
'import requests
url = "https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment"
payload = {
"transactions": [
{
"transaction_id": 123,
"amount": 0,
"posted_at": "2023-12-25",
"withholding_amount": 500000000000000000
}
],
"credit_memos": [
{
"credit_memo_id": 123,
"amount": 0,
"posted_at": "2023-12-25"
}
],
"empty_transactions": [
{
"amount": 0,
"payment_date": "2023-12-25",
"withholding_amount": 500000000000000000
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
transactions: [
{
transaction_id: 123,
amount: 0,
posted_at: '2023-12-25',
withholding_amount: 500000000000000000
}
],
credit_memos: [{credit_memo_id: 123, amount: 0, posted_at: '2023-12-25'}],
empty_transactions: [
{amount: 0, payment_date: '2023-12-25', withholding_amount: 500000000000000000}
]
})
};
fetch('https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment', 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/coa/api/v1/invoice/{invoice_id}/calculate-payment",
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([
'transactions' => [
[
'transaction_id' => 123,
'amount' => 0,
'posted_at' => '2023-12-25',
'withholding_amount' => 500000000000000000
]
],
'credit_memos' => [
[
'credit_memo_id' => 123,
'amount' => 0,
'posted_at' => '2023-12-25'
]
],
'empty_transactions' => [
[
'amount' => 0,
'payment_date' => '2023-12-25',
'withholding_amount' => 500000000000000000
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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/coa/api/v1/invoice/{invoice_id}/calculate-payment"
payload := strings.NewReader("{\n \"transactions\": [\n {\n \"transaction_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ],\n \"credit_memos\": [\n {\n \"credit_memo_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\"\n }\n ],\n \"empty_transactions\": [\n {\n \"amount\": 0,\n \"payment_date\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/coa/api/v1/invoice/{invoice_id}/calculate-payment")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactions\": [\n {\n \"transaction_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ],\n \"credit_memos\": [\n {\n \"credit_memo_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\"\n }\n ],\n \"empty_transactions\": [\n {\n \"amount\": 0,\n \"payment_date\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transactions\": [\n {\n \"transaction_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ],\n \"credit_memos\": [\n {\n \"credit_memo_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\"\n }\n ],\n \"empty_transactions\": [\n {\n \"amount\": 0,\n \"payment_date\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"total_due": 0,
"applied_payments": 0,
"applied_credits": 0,
"applied_withholding": 0,
"term_discounts": 0,
"remaining_due": 0
}{}{}Accounts Receivable
Calculate Invoice Payment
Calculate the payment details for an invoice.
This endpoint calculates:
- Total amount due on the invoice
- Applied payments (existing + proposed)
- Applied credits (existing + proposed credit memos)
- Payment term discounts (based on payment dates) - ALL OR NOTHING: discount only applies if paying full invoice
- Remaining balance due
Supports payment terms with early payment discounts (all-or-nothing).
POST
/
coa
/
api
/
v1
/
invoice
/
{invoice_id}
/
calculate-payment
Calculate Invoice Payment
curl --request POST \
--url https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"transactions": [
{
"transaction_id": 123,
"amount": 0,
"posted_at": "2023-12-25",
"withholding_amount": 500000000000000000
}
],
"credit_memos": [
{
"credit_memo_id": 123,
"amount": 0,
"posted_at": "2023-12-25"
}
],
"empty_transactions": [
{
"amount": 0,
"payment_date": "2023-12-25",
"withholding_amount": 500000000000000000
}
]
}
'import requests
url = "https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment"
payload = {
"transactions": [
{
"transaction_id": 123,
"amount": 0,
"posted_at": "2023-12-25",
"withholding_amount": 500000000000000000
}
],
"credit_memos": [
{
"credit_memo_id": 123,
"amount": 0,
"posted_at": "2023-12-25"
}
],
"empty_transactions": [
{
"amount": 0,
"payment_date": "2023-12-25",
"withholding_amount": 500000000000000000
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
transactions: [
{
transaction_id: 123,
amount: 0,
posted_at: '2023-12-25',
withholding_amount: 500000000000000000
}
],
credit_memos: [{credit_memo_id: 123, amount: 0, posted_at: '2023-12-25'}],
empty_transactions: [
{amount: 0, payment_date: '2023-12-25', withholding_amount: 500000000000000000}
]
})
};
fetch('https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment', 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/coa/api/v1/invoice/{invoice_id}/calculate-payment",
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([
'transactions' => [
[
'transaction_id' => 123,
'amount' => 0,
'posted_at' => '2023-12-25',
'withholding_amount' => 500000000000000000
]
],
'credit_memos' => [
[
'credit_memo_id' => 123,
'amount' => 0,
'posted_at' => '2023-12-25'
]
],
'empty_transactions' => [
[
'amount' => 0,
'payment_date' => '2023-12-25',
'withholding_amount' => 500000000000000000
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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/coa/api/v1/invoice/{invoice_id}/calculate-payment"
payload := strings.NewReader("{\n \"transactions\": [\n {\n \"transaction_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ],\n \"credit_memos\": [\n {\n \"credit_memo_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\"\n }\n ],\n \"empty_transactions\": [\n {\n \"amount\": 0,\n \"payment_date\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/coa/api/v1/invoice/{invoice_id}/calculate-payment")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactions\": [\n {\n \"transaction_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ],\n \"credit_memos\": [\n {\n \"credit_memo_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\"\n }\n ],\n \"empty_transactions\": [\n {\n \"amount\": 0,\n \"payment_date\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meetcampfire.com/coa/api/v1/invoice/{invoice_id}/calculate-payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transactions\": [\n {\n \"transaction_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ],\n \"credit_memos\": [\n {\n \"credit_memo_id\": 123,\n \"amount\": 0,\n \"posted_at\": \"2023-12-25\"\n }\n ],\n \"empty_transactions\": [\n {\n \"amount\": 0,\n \"payment_date\": \"2023-12-25\",\n \"withholding_amount\": 500000000000000000\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"total_due": 0,
"applied_payments": 0,
"applied_credits": 0,
"applied_withholding": 0,
"term_discounts": 0,
"remaining_due": 0
}{}{}Authorizations
Token-based authentication with required prefix "Token"
Path Parameters
ID of the invoice
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Response
Required range:
-1000000000000000000 < x < 1000000000000000000Required range:
-1000000000000000000 < x < 1000000000000000000Required range:
-1000000000000000000 < x < 1000000000000000000Required range:
-1000000000000000000 < x < 1000000000000000000Required range:
-1000000000000000000 < x < 1000000000000000000Required range:
-1000000000000000000 < x < 1000000000000000000⌘I