curl --request POST \
--url https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"send_invoice": true,
"due_at": "2023-12-25"
}
'import requests
url = "https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue"
payload = {
"send_invoice": True,
"due_at": "2023-12-25"
}
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({send_invoice: true, due_at: '2023-12-25'})
};
fetch('https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue', 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}/issue",
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([
'send_invoice' => true,
'due_at' => '2023-12-25'
]),
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}/issue"
payload := strings.NewReader("{\n \"send_invoice\": true,\n \"due_at\": \"2023-12-25\"\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}/issue")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"send_invoice\": true,\n \"due_at\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue")
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 \"send_invoice\": true,\n \"due_at\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>"
}Issue an invoice
Issues a scheduled invoice now, ahead of its billing date. The invoice is calculated, final tax is committed, its date of issue is today, and autopay charges it as it would on its billing date. The billing date itself does not change.
Set send_invoice to send the customer’s usual invoice notifications, as on the billing date (a customer autopay can charge is not emailed the invoice); when false no notifications are sent.
due_date_basis is optional — omit it and the invoice keeps its own basis. Send CUSTOM with a due_at to name the due date outright; either one without the other is rejected.
Only a scheduled invoice can be issued. The request is refused with a 400 when invoice review would draft the invoice, when billing is turned off for the subscription (it has no billing start date), when it bills a period before the subscription’s billing start date, when the subscription was imported and hasn’t reached its billing start cutover, when it bills usage for a period that hasn’t ended, and when it has nothing to bill.
curl --request POST \
--url https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"send_invoice": true,
"due_at": "2023-12-25"
}
'import requests
url = "https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue"
payload = {
"send_invoice": True,
"due_at": "2023-12-25"
}
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({send_invoice: true, due_at: '2023-12-25'})
};
fetch('https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue', 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}/issue",
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([
'send_invoice' => true,
'due_at' => '2023-12-25'
]),
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}/issue"
payload := strings.NewReader("{\n \"send_invoice\": true,\n \"due_at\": \"2023-12-25\"\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}/issue")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"send_invoice\": true,\n \"due_at\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/invoices/{invoice_id}/issue")
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 \"send_invoice\": true,\n \"due_at\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>"
}Body
What the issued invoice's due date follows. Omit it to keep the invoice's own basis. ISSUE_DATE counts the payment terms from today, SERVICE_PERIOD from the billing date, and CUSTOM names the date outright and must be sent with due_at.
ISSUE_DATE- Issue dateSERVICE_PERIOD- Service periodCUSTOM- Custom
ISSUE_DATE, SERVICE_PERIOD, CUSTOM