curl --request POST \
--url https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"send_invoice": false,
"should_use_current_billing_address": false,
"should_use_current_buyer_address": false
}
'import requests
url = "https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate"
payload = {
"send_invoice": False,
"should_use_current_billing_address": False,
"should_use_current_buyer_address": False
}
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: false,
should_use_current_billing_address: false,
should_use_current_buyer_address: false
})
};
fetch('https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate', 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}/regenerate",
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' => false,
'should_use_current_billing_address' => false,
'should_use_current_buyer_address' => false
]),
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}/regenerate"
payload := strings.NewReader("{\n \"send_invoice\": false,\n \"should_use_current_billing_address\": false,\n \"should_use_current_buyer_address\": false\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}/regenerate")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"send_invoice\": false,\n \"should_use_current_billing_address\": false,\n \"should_use_current_buyer_address\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate")
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\": false,\n \"should_use_current_billing_address\": false,\n \"should_use_current_buyer_address\": false\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>",
"sent_at": "2023-11-07T05:31:56Z",
"fully_paid_at": "2023-11-07T05:31:56Z",
"grand_total": 123,
"remaining_amount": 123,
"currency": "<string>",
"is_renewal_estimate": true,
"payment_url": "<string>",
"accounts_payable_emails": [
"jsmith@example.com"
],
"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>"
}
}Regenerate an invoice
Recalculates the invoice from the current order and subscription data, regenerates the stored PDF, and creates a new invoice version. Use this after upstream changes (for example order or billing updates) that should be reflected on an already-generated invoice. The existing stored PDF is replaced, and it may have already been sent to the customer. By default the regeneration is silent; pass send_invoice: true to also email the regenerated invoice to the buyer’s invoice recipients (reissue). Voided invoices and invoices that have not been generated yet cannot be regenerated.
Tax is re-priced against the address the invoice was issued at, not the customer’s current one, so regenerating cannot move an issued invoice into a different tax jurisdiction as a side effect. Pass should_use_current_billing_address: true to re-price against the customer’s current billing address instead, and should_use_current_buyer_address: true to update the invoice’s buyer address to the buyer’s current one.
The request blocks until the new PDF is stored, so a 200 means the regeneration is complete and any requested email has been sent.
curl --request POST \
--url https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"send_invoice": false,
"should_use_current_billing_address": false,
"should_use_current_buyer_address": false
}
'import requests
url = "https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate"
payload = {
"send_invoice": False,
"should_use_current_billing_address": False,
"should_use_current_buyer_address": False
}
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: false,
should_use_current_billing_address: false,
should_use_current_buyer_address: false
})
};
fetch('https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate', 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}/regenerate",
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' => false,
'should_use_current_billing_address' => false,
'should_use_current_buyer_address' => false
]),
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}/regenerate"
payload := strings.NewReader("{\n \"send_invoice\": false,\n \"should_use_current_billing_address\": false,\n \"should_use_current_buyer_address\": false\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}/regenerate")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"send_invoice\": false,\n \"should_use_current_billing_address\": false,\n \"should_use_current_buyer_address\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/invoices/{invoice_id}/regenerate")
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\": false,\n \"should_use_current_billing_address\": false,\n \"should_use_current_buyer_address\": false\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>",
"sent_at": "2023-11-07T05:31:56Z",
"fully_paid_at": "2023-11-07T05:31:56Z",
"grand_total": 123,
"remaining_amount": 123,
"currency": "<string>",
"is_renewal_estimate": true,
"payment_url": "<string>",
"accounts_payable_emails": [
"jsmith@example.com"
],
"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>"
}
}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.
Accounts payable emails of the party billed (billed_company_id), the addresses the invoice is emailed to. For a partner-billed invoice, the partner's. Otherwise, for a standalone invoice the emails it was created or last updated with, and for a subscription invoice its subscription's accounts payable emails. On a partner-billed invoice, empty for a buyer token reader who is not the payer, such as the end customer.