Attach an NF-e issued through Cubbo's Brazilian invoicing provider
curl --request POST \
--url https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invoice_type": "WEBMANIA",
"invoices": [
{
"key": "00000000000000000000000000000000000000000000",
"identifier": "123456",
"purpose": "REPLENISHMENT_INVOICE",
"operation_type": "ENTRADA",
"operation_nature": "Remessa para armazenagem"
}
]
}
'import requests
url = "https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice"
payload = {
"invoice_type": "WEBMANIA",
"invoices": [
{
"key": "00000000000000000000000000000000000000000000",
"identifier": "123456",
"purpose": "REPLENISHMENT_INVOICE",
"operation_type": "ENTRADA",
"operation_nature": "Remessa para armazenagem"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
invoice_type: 'WEBMANIA',
invoices: [
{
key: '00000000000000000000000000000000000000000000',
identifier: '123456',
purpose: 'REPLENISHMENT_INVOICE',
operation_type: 'ENTRADA',
operation_nature: 'Remessa para armazenagem'
}
]
})
};
fetch('https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice', 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.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice",
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([
'invoice_type' => 'WEBMANIA',
'invoices' => [
[
'key' => '00000000000000000000000000000000000000000000',
'identifier' => '123456',
'purpose' => 'REPLENISHMENT_INVOICE',
'operation_type' => 'ENTRADA',
'operation_nature' => 'Remessa para armazenagem'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice"
payload := strings.NewReader("{\n \"invoice_type\": \"WEBMANIA\",\n \"invoices\": [\n {\n \"key\": \"00000000000000000000000000000000000000000000\",\n \"identifier\": \"123456\",\n \"purpose\": \"REPLENISHMENT_INVOICE\",\n \"operation_type\": \"ENTRADA\",\n \"operation_nature\": \"Remessa para armazenagem\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"invoice_type\": \"WEBMANIA\",\n \"invoices\": [\n {\n \"key\": \"00000000000000000000000000000000000000000000\",\n \"identifier\": \"123456\",\n \"purpose\": \"REPLENISHMENT_INVOICE\",\n \"operation_type\": \"ENTRADA\",\n \"operation_nature\": \"Remessa para armazenagem\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoice_type\": \"WEBMANIA\",\n \"invoices\": [\n {\n \"key\": \"00000000000000000000000000000000000000000000\",\n \"identifier\": \"123456\",\n \"purpose\": \"REPLENISHMENT_INVOICE\",\n \"operation_type\": \"ENTRADA\",\n \"operation_nature\": \"Remessa para armazenagem\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"new_invoice_ids": [
8801
]
}Replenishments
Attach an NF-e issued through Cubbo's Brazilian invoicing provider
Brazil only. Registers on the replenishment an NF-e (Nota Fiscal eletrônica, the Brazilian fiscal invoice) that was already authorized through the invoicing provider Cubbo integrates for your store, identified by its 44-digit access key. Cubbo stores the reference as pre-approved and then confirms the document with the provider in the background, downloading its XML and PDF.
- Exactly one invoice per request (the
invoicesarray must contain a single item). purposesays what the document covers:REPLENISHMENT_INVOICEfor the NF-e of entry of the goods,REPLENISHMENT_ADJUSTMENT_INVOICEfor an adjustment note. A replenishment can hold only one active invoice per purpose; cancelled invoices do not count, so a cancelled one can be replaced.- If the access key is already registered in Cubbo, no new invoice is created: the existing one
is re-synchronized with the provider and the response lists its key under
update_invoice_ids. - A previously recorded invoice issuing error on the replenishment is cleared.
- For
REPLENISHMENT_INVOICE, Cubbo derives the expected quantities per lot from the invoice, which makes the variance report available for the replenishment.
POST
/
replenishments
/
{replenishment_id}
/
attach-invoice
Attach an NF-e issued through Cubbo's Brazilian invoicing provider
curl --request POST \
--url https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invoice_type": "WEBMANIA",
"invoices": [
{
"key": "00000000000000000000000000000000000000000000",
"identifier": "123456",
"purpose": "REPLENISHMENT_INVOICE",
"operation_type": "ENTRADA",
"operation_nature": "Remessa para armazenagem"
}
]
}
'import requests
url = "https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice"
payload = {
"invoice_type": "WEBMANIA",
"invoices": [
{
"key": "00000000000000000000000000000000000000000000",
"identifier": "123456",
"purpose": "REPLENISHMENT_INVOICE",
"operation_type": "ENTRADA",
"operation_nature": "Remessa para armazenagem"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
invoice_type: 'WEBMANIA',
invoices: [
{
key: '00000000000000000000000000000000000000000000',
identifier: '123456',
purpose: 'REPLENISHMENT_INVOICE',
operation_type: 'ENTRADA',
operation_nature: 'Remessa para armazenagem'
}
]
})
};
fetch('https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice', 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.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice",
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([
'invoice_type' => 'WEBMANIA',
'invoices' => [
[
'key' => '00000000000000000000000000000000000000000000',
'identifier' => '123456',
'purpose' => 'REPLENISHMENT_INVOICE',
'operation_type' => 'ENTRADA',
'operation_nature' => 'Remessa para armazenagem'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice"
payload := strings.NewReader("{\n \"invoice_type\": \"WEBMANIA\",\n \"invoices\": [\n {\n \"key\": \"00000000000000000000000000000000000000000000\",\n \"identifier\": \"123456\",\n \"purpose\": \"REPLENISHMENT_INVOICE\",\n \"operation_type\": \"ENTRADA\",\n \"operation_nature\": \"Remessa para armazenagem\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"invoice_type\": \"WEBMANIA\",\n \"invoices\": [\n {\n \"key\": \"00000000000000000000000000000000000000000000\",\n \"identifier\": \"123456\",\n \"purpose\": \"REPLENISHMENT_INVOICE\",\n \"operation_type\": \"ENTRADA\",\n \"operation_nature\": \"Remessa para armazenagem\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cubbo.com/v1/replenishments/{replenishment_id}/attach-invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoice_type\": \"WEBMANIA\",\n \"invoices\": [\n {\n \"key\": \"00000000000000000000000000000000000000000000\",\n \"identifier\": \"123456\",\n \"purpose\": \"REPLENISHMENT_INVOICE\",\n \"operation_type\": \"ENTRADA\",\n \"operation_nature\": \"Remessa para armazenagem\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"new_invoice_ids": [
8801
]
}Authorizations
Body
application/json
Response
Invoice registered. new_invoice_ids holds the ids of the invoices created. When the key was
already known, new_invoice_ids is empty and update_invoice_ids lists the existing keys
(comma-separated string) that were re-synchronized instead.