curl --request POST \
--url https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void"
payload = { "reason": "<string>" }
headers = {
"X-SALESBRICKS-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SALESBRICKS-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void', 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.salesbricks.com/api/v2/invoices/{invoice_id}/void",
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([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SALESBRICKS-KEY: <api-key>"
],
]);
$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.salesbricks.com/api/v2/invoices/{invoice_id}/void"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SALESBRICKS-KEY", "<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.salesbricks.com/api/v2/invoices/{invoice_id}/void")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"billed_company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_number": "<string>",
"due_at": "2023-11-07T05:31:56Z",
"bill_at": "2023-11-07T05:31:56Z",
"issued_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"fully_paid_at": "2023-11-07T05:31:56Z",
"grand_total": 123,
"remaining_amount": 123,
"currency": "<string>",
"is_renewal_estimate": true,
"payment_url": "<string>",
"customer_name": "<string>",
"time_zone": "<string>",
"payments": [
{
"payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_number": "<string>",
"invoice_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"paid_amount": 123,
"paid_at": "2023-11-07T05:31:56Z",
"currency": "<string>",
"error": "<string>"
}
],
"attachments": [
"<unknown>"
],
"line_items": [
{
"brick_name": "<string>",
"brick_id": "<string>",
"brick_code": "<string>",
"quantity": 123,
"tax": 123,
"grand_total": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z"
}
],
"metadata": "<unknown>",
"purchase_order": {
"code": "<string>"
}
}{
"error": {
"code": "ERR_BAD_REQUEST",
"message": "Bad request — the input payload is malformed, missing required fields, or contains invalid data."
}
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Not found — the resource you are looking for does not exist."
}
}Void an invoice
Voids an invoice so it is no longer collectible, exactly as voiding it in the app does. The invoice’s PDF is regenerated to show it as void, the customer’s invoice recipients are emailed, the invoice.voided webhook fires, and the invoice is voided in your connected accounting system.
An invoice with any amount paid, or a payment still processing, cannot be voided — refund it first. Voiding an invoice that is already voided is refused rather than repeated.
curl --request POST \
--url https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void"
payload = { "reason": "<string>" }
headers = {
"X-SALESBRICKS-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SALESBRICKS-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void', 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.salesbricks.com/api/v2/invoices/{invoice_id}/void",
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([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SALESBRICKS-KEY: <api-key>"
],
]);
$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.salesbricks.com/api/v2/invoices/{invoice_id}/void"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SALESBRICKS-KEY", "<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.salesbricks.com/api/v2/invoices/{invoice_id}/void")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/invoices/{invoice_id}/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"billed_company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_number": "<string>",
"due_at": "2023-11-07T05:31:56Z",
"bill_at": "2023-11-07T05:31:56Z",
"issued_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"fully_paid_at": "2023-11-07T05:31:56Z",
"grand_total": 123,
"remaining_amount": 123,
"currency": "<string>",
"is_renewal_estimate": true,
"payment_url": "<string>",
"customer_name": "<string>",
"time_zone": "<string>",
"payments": [
{
"payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_number": "<string>",
"invoice_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"paid_amount": 123,
"paid_at": "2023-11-07T05:31:56Z",
"currency": "<string>",
"error": "<string>"
}
],
"attachments": [
"<unknown>"
],
"line_items": [
{
"brick_name": "<string>",
"brick_id": "<string>",
"brick_code": "<string>",
"quantity": 123,
"tax": 123,
"grand_total": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z"
}
],
"metadata": "<unknown>",
"purchase_order": {
"code": "<string>"
}
}{
"error": {
"code": "ERR_BAD_REQUEST",
"message": "Bad request — the input payload is malformed, missing required fields, or contains invalid data."
}
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Not found — the resource you are looking for does not exist."
}
}Body
Response
ID of the end customer this invoice is for — the company that consumes the subscription. Never collect or charge payment methods against this id: on a partner-billed invoice the paying party is a different company, and billed_company_id is always the id to collect against.
ID of the company actually billed for this invoice — the party whose Stripe customer POST /invoices/{invoice_id}/pay charges. Equal to customer_id unless the invoice is partner-billed, in which case it is the partner's company. Collect and list payment methods against this id, never customer_id. Always present and never null, including on the renewal estimate returned by GET /subscriptions/{subscription_id}/invoices/next, which resolves the company its renewal would bill.
Current status of the invoice. One of:
MUTED— Invoice will not be sent. Muted invoices come from migration cut-overs or from muting invoices in the product settings.SCHEDULED— Scheduled to be issued on a future date.OUTSTANDING— Issued and awaiting payment.DUE— Payment is due.PAST_DUE— Payment is past its due date.PAID— Fully paid.PARTIALLY_PAID— Partially paid, with a remaining balance.ADJUSTED— Adjusted after issuance.CREDITED— Settled by applying credit.UNPAID— Unpaid.PAUSED— Collection is paused.VOIDED— Voided and no longer collectible.
Total amount due for this invoice.
Invoices that have not been generated yet (e.g. SCHEDULED) report the total expected at the time they were created. That figure does NOT include usage metered since — a usage invoice whose meters have not been priced reports 0. Pass ?calculate_expected_usage=true to re-price against the order and include estimated usage instead; it is slower, so it is off by default on list endpoints.
Link to the page where your customer pays this invoice online, the same link the invoice PDF carries. Safe to send to your customer: it needs no token and does not expire. Null when you have no Stripe account that can take payments connected, when the invoice has not been issued yet (SCHEDULED or DRAFT), and on a renewal estimate. Not to be confused with POST /invoices/{invoice_id}/pay, which charges a saved payment method directly.