Invoice creation
If you are struggling to create a new invoice with our API this is the place where you want to be, you will learn every step to successfully create your invoice from scratch.
We'll build the request step by step, so wait until the end of the guide to send your first request!
You can find the technical documentation of this API method here.
Some of the steps will use other API methods to create or retrieve the needed resources. You can find the required models on our API Reference section or on the documentation of the SDK you're using (check the GitHub repo or the Package Manager page).
If you want to download the complete SDKs examples you can find them here.
In this example, we'll suppose you have to manage just one Company, so we simply inserted its ID directly in the code. If instead, you need to be able to manage multiple companies, you'll need to retrieve the ID of the current company in some way. Check the Company-scoped Methods page for more info.
Zapier Actions provide all the fields offered by the APIs, but it does not mean you need to compile all of them! For example, while creating a new Issued Document the Document ID must be left blank!
To follow this guide, you will be required to search the fields used in our example on the Zapier page and insert the related values.
The code of the fields will follow the JSON structure: for example, the "type" field is included in the "data" object, so the Zapier code will be "data.type". You can use the CRTL + F command to search the field's code faster 😉
In this example, we'll insert the values directly, but please remember that Zapier was built to let you select the workflow's previous steps' outputs as input in the Action, for example selecting the values returned by a trigger!
Unfortunately, no. Fatture in Cloud lets you send documents to the SDI only if they were created through the Fatture in Cloud functionalities, so if you have an XML you can't just send it to the SDI using our APIs. Please, check this guide for a more detailed explanation.
ℹ️ Pre-Create Info
First of all, check out our Get Issued Document Pre-Create Info page, it contains most of the information you will need to create a new invoice.
0️⃣ Step Zero: The Document Type
In this guide, we will explain how to create an invoice. We choose this type of document because it is the most common, but keep in mind that the process is almost the same for every issued document.
The available types are:
- invoice: an invoice (we will use this type in this guide)
- quote: a quote
- proforma: a pro forma invoice
- receipt: a tax receipt
- delivery_note: a delivery note
- credit_note: a credit note
- order: an order
- work_report: a work report
- supplier_order: an order by the supplier
- self_own_invoice: a self-invoice in which the issuer of the document appears both as the customer and as the supplier
- self_supplier_invoice: a self-invoice in which the issuer of the document appears as the customer, while the other company acts as the supplier
1️⃣ Step One: The Customer
To create an invoice, we need the customer's details. You have three options:
-
If the customer's details were already inserted in Fatture in Cloud, you can retrieve it using our API and add it to the request. See also: Get the list of existing clients
-
If the client wasn't inserted in Fatture in Cloud, but it will likely be a recurring customer (so you would like to store his details), you can insert it now, and use the returned details to populate the request. See also: Create a new client
-
If the customer is most likely a one-time customer, you can just insert his details directly in the invoice.
The Client's data must be inserted in the entity field, as shown below. If you used the Clients API to store/retrieve the details, please remember to insert the entity.id field to link the invoice accordingly.
If you choose to link an existing customer (or to create a new one) make sure you set all the fields you want to be shown in your invoice: at this moment we don't autocomplete your invoice with the customer details, even if he's already stored in Fatture in Cloud. You can get the info about your client performing a Get Client request.
The partial request looks like this:
// NOTE: this is a partial request, please wait before sending it
{
"data": {
"type": "invoice",
"entity": {
"id": 1, // only if the client already exists
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
}
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our C# SDK https://www.nuget.org/packages/It.FattureInCloud.Sdk/
// If you want to use our Client API:
// Retrieve a client: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/ClientsApi.md#listclients
// Create a new client: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/ClientsApi.md#createclient
// Insertion on-the-fly:
Entity entity = new Entity(
id: 1, // Only if the client already exists
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
// If you want to use our Client API:
// Retrieve a client: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/ClientsApi.md#listclients
// Create a new client: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/ClientsApi.md#CreateClient
// Insertion on-the-fly:
entity := *fattureincloud.NewEntity().
SetId(1). // Only if the client already exists
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
// Now we create the invoice and link the entity
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Java SDK https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
// If you want to use our Client API:
// Retrieve a client: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/ClientsApi.md#listlients
// Create a new client: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/ClientsApi.md#createclient
// Insertion on-the-fly:
Entity entity = new Entity()
.id(1) // Only if the client already exists
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
// If you want to use our Client API:
// Retrieve a client: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ClientsApi.md#listClients
// Create a new client: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ClientsApi.md#createClient
// Insertion on-the-fly:
let entity = new fattureInCloudSdk.Entity();
entity.id = 1; // Only if the client already exists
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
//now we instanciate the invoice and link the entity
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
// If you want to use our Client API:
// Retrieve a client: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/ClientsApi.md#listclients
// Create a new client: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/ClientsApi.md#createclient
// Insertion on-the-fly:
$entity = new Entity;
$entity
->setId(1) // Only if the client already exists
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
//now we instanciate the invoice and link the entity
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
# If you want to use our Client API:
# Retrieve a client: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/ClientsApi.md#list_clients
# Create a new client: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/ClientsApi.md#create_client
# Insertion on-the-fly:
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity
)
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
# If you want to use our Client API:
# Retrieve a client: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/ClientsApi.md#list_clients
# Create a new client: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/ClientsApi.md#create_client
# Insertion on-the-fly:
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia"
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
// If you want to use our Client API:
// Retrieve a client: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/ClientsApi.md#listClients
// Create a new client: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/ClientsApi.md#createClient
// Insertion on-the-fly:
let entity: Entity = {};
entity.id = 1; // Only if the client already exists
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
//now we create the invoice and link the entity
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
};
In Zapier, first, you need to select your Company ID. Luckily, our Actions let you select it from a simple dropdown menu.
Next, you must set the Document Type we described in the previous step, you just need to select the correct value in the available list.
Then you must set up the entity as explained above. The entity fields' codes start with the "data.entity" prefix.
Remember: in this example, you must insert values only in the fields we are suggesting to you! In the image below we can't show all the fields you must fill, so you must search them all as shown before. Here you can find the list of all the fields and values you must fill for this example:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Entity id | data.entity.id | 1 | It must be the ID of an existing Client, or blank. |
Entity name | data.entity.name | Mario Rossi | |
Entity vat number | data.entity.vat_number | 47803200154 | |
Entity tax code | data.entity.tax_code | RSSMRA91M20B967Q | |
Entity address street | data.entity.address_street | Via Italia, 66 | |
Entity address postal code | data.entity.address_postal_code | 20900 | |
Entity address city | data.entity.address_city | Milano | |
Entity address province | data.entity.address_province | MI | |
Entity country | data.entity.country | Italia |
2️⃣ Step Two: The Invoice Data
This section allows the insertion of your invoice's basic data, below you can find the main fields:
-
date: the date of issue.
-
number: the progressive invoice number, if omitted it gets automatically set ('numero documento', eg. 107).
-
numeration: optional invoice numeration ('sezionale documento', eg. "/FPA").
-
visible_subject: short optional invoice description (visible in the invoice PDF).
-
subject: short optional invoice description (not visible in the invoice PDF).
-
language: the document language, see: List Languages
-
currency: the currency used for the invoice payment, see: List Currencies
-
rc_center: optional field that represents the category of the generated revenue (centro di ricavo).
The partial request looks like this:
// NOTE: this is a partial request, please wait before sending it
{
"data": {
"type": "invoice",
"entity": {
"id": 1,
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
},
"date": "2022-01-20",
"number": 1,
"numeration": "/fatt",
"subject": "internal subject",
"visible_subject": "visible subject",
"currency": {
"id": "EUR",
"exchange_rate": "1.00000",
"symbol": "€"
},
"language": {
"code": "it",
"name": "Italiano"
}
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
// Below you can find this section fields:
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
// Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/InfoApi.md#listCurrencies
currency: new Currency(
id: "EUR"
),
// Retrieve the languages: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/InfoApi.md#listLanguages
language: new Language(
code: "it",
name: "italiano"
)
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
// Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/InfoApi.md#listcurrencies
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
// Retrieve the languages: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/InfoApi.md#ListLanguages
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano"))
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
// Below you can find this section fields:
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
// Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/InfoApi.md#listCurrencies
.currency(new Currency().id("EUR"))
// Retrieve the languages: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/InfoApi.md#listLanguages
.language(new Language()
.code("it")
.name("italiano")
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
let entity = new fattureInCloudSdk.Entity();
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
// Below you can find this section fields:
invoice.date = "2022-01-20";
invoice.number = 1;
invoice.numeration = "/fatt";
invoice.subject = "internal subject";
invoice.visible_subject = "visible subject";
// Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/InfoApi.md#listcurrencies
invoice.currency = {
id: "EUR",
};
// Retrieve the languages: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md#listLanguages
invoice.language = {
code: "it",
name: "Italiano",
};
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
// Below you can find this section fields:
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
// Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/InfoApi.md#listcurrencies
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
// Retrieve the languages: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/InfoApi.md#listLanguages
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
# Below you can find this section fields:
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
# Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/InfoApi.md#list_currencies
currency = Currency(
id="EUR"
),
# Retrieve the languages: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/InfoApi.md#list_languages
language = Language(
code="it",
name="italiano"
)
)
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia",
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
# Below you can find this section fields:
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
# Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/InfoApi.md#list_currencies
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
# Retrieve the languages: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/InfoApi.md#list_languages
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
)
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
// Retrieve the currencies: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/InfoApi.md#listCurrencies
currency: {
id: "EUR",
},
// Retrieve the languages: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/InfoApi.md#listLanguages
language: {
code: "it",
name: "italiano",
},
};
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Issued document date | data.date | 2022-01-20 | |
Entity name | data.number | 1 | |
Entity vat number | data.numeration | /fatt | |
Entity tax code | data.subject | internal subject | |
Entity address street | data.visible_subject | visible subject | |
Currency code | data.currency.id | EUR | Check List Currencies |
Currency exchange rate | data.currency.exchange_rate | 1.00000 | Check List Currencies |
Currency symbol | data.currency.symbol | € | Check List Currencies |
Language code | data.language.code | it | Check List Languages |
Language extended name | data.language.name | Italiano | Check List Languages |
3️⃣ Step Three: E-Invoice
If you want to issue an electronic invoice the first thing to do is to set the e_invoice field to true, then the ei_data field needs to be set accordingly to your needs:
-
vat_kind: (esigibilità iva) can be one of the following:
- I => immediata
- D => differita
- S => spit payment
-
payment_method: one of the accepted payment methods
-
bank_iban: automatically to your settings default payment method if it is set bank_name: optional bank name bank
-
bank_beneficiary: set your name if different from your business name
-
original_document_type: optional field for invoice issue reason, can be ordine, contratto, convenzione
-
od_number: reference to the original document
-
od_date: original document issue date
-
cig: codice identificativo della gara
-
cup: codice unico di progetto
-
invoice_number: if document type is credit note this field is the reference to the invoice to be reversed
-
invoice_date: if document type is credit note this field is the date of the invoice to be reversed
There are also some fields to be set in the entity field:
-
e_invoice: must be set to true
-
ei_code: customer einvoice code
-
certified_email: optional customer pec
If you have to set advanced parameters you have to use the ei_raw fields.
The partial request looks like this:
// NOTE: this is a partial request, please wait before sending it
{
"data": {
"type": "invoice",
"entity": {
"id": 1,
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
},
"date": "2022-01-20",
"number": 1,
"numeration": "/fatt",
"subject": "internal subject",
"visible_subject": "visible subject",
"currency": {
"id": "EUR",
"exchange_rate": "1.00000",
"symbol": "€"
},
"language": {
"code": "it",
"name": "Italiano"
},
// Here we set e_invoice and ei_data
"e_invoice": true,
"ei_data": {
"payment_method": "MP05"
}
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
currency: new Currency(
id: "EUR"
),
language: new Language(
code: "it",
name: "italiano"
),
// Here we set e_invoice and ei_data
eInvoice: true,
eiData: new IssuedDocumentEiData(
paymentMethod:"MP05"
)
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano")).
// Here we set e_invoice and ei_data
SetEInvoice(true).
SetEiData(*fattureincloud.NewIssuedDocumentEiData().SetPaymentMethod("MP05"))
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
.currency(new Currency().id("EUR"))
.language(new Language()
.code("it")
.name("italiano"))
// Here we set e_invoice and ei_data
.eInvoice(true)
.eiData(
new IssuedDocumentEiData()
.paymentMethod("MP05")
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
let entity = new fattureInCloudSdk.Entity()
entity.id = 1
entity.name = "Mario Rossi"
entity.vat_number = "47803200154"
entity.tax_code = "RSSMRA91M20B967Q"
entity.address_street = "Via Italia, 66"
entity.address_postal_code = "20900"
entity.address_city = "Milano"
entity.address_province = "MI"
entity.country = "Italia"
let invoice = new fattureInCloudSdk.IssuedDocument()
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice
invoice.entity = entity
invoice.date = "2022-01-20"
invoice.number = 1
invoice.numeration = "/fatt"
invoice.subject = "internal subject"
invoice.visible_subject = "visible subject"
invoice.currency = {
id: "EUR"
}
invoice.language = {
code: "it",
name: "Italiano"
}
// Here we set e_invoice and ei_data
invoice.e_invoice = true
invoice.ei_data = {
payment_method = "MP05"
}
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
// Here we set e_invoice and ei_data
$invoice->setEInvoice(true);
$invoice->setEiData(
new IssuedDocumentEiData(
array(
"payment_method" => "MP05"
)
)
);
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
currency = Currency(
id="EUR"
),
language = Language(
code="it",
name="italiano"
),
# Here we set e_invoice and ei_data
e_invoice = True,
ei_data = IssuedDocumentEiData(
payment_method="MP05"
)
)
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia"
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
),
# Here we set e_invoice and ei_data
e_invoice: true,
ei_data: FattureInCloud_Ruby_Sdk::IssuedDocumentEiData.new(
payment_method: "MP05"
)
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: {
id: "EUR",
},
language: {
code: "it",
name: "italiano",
},
// Here we set e_invoice and ei_data
e_invoice: true,
ei_data: {
payment_method: "MP05",
},
};
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Issued document is an e-invoice | data.e_invoice | true | |
E-invoice payment methid | data.ei_data.payment_method | MP05 | see here for the accepted values of ModalitaPagamento |
4️⃣ Step Four: Contributions and Withholdings
The Contributions and withholdings section allows the insertion of Casse Professionali, Rivalsa, Withholding tax, and other Withholdings / Enasarco.
-
cassa professionisti: you can set up two Casse professionisti and set the fields according to your needs.
-
rivalsa (INPS): you can set up the Rivalsa and charge it to your clients setting the appropriate fields.
-
withholding tax: you can set up the Irpef withholding tax setting the appropriate fields.
-
enasarco and other withholdings: you will find also the fields to set up Enasarco and other Withholdings.
5️⃣ Step Five: Items list
The items composing the invoice are included in the Items List section.
As already seen in step one, you have three possibilities to add items:
-
If you already inserted the Product in the Fatture in Cloud API, you can retrieve it using the Products API. See also: Get a list of the products
-
If this is a new product, and you want to add it to Fatture in Cloud, you can do it now. See also: Create a new product
-
If you don't want to save this product for future use, just insert it in the request.
The items_list is an array of items: Just remember to specify the id if you inserted a product using the Product API and want to link it to the invoice.
If you are not familiar with the invoice item, you can find below the description of the fields:
-
code: optional, a custom code
-
name: product name
-
net_price/gross_price: price per single item, if you set the flag use_gross_prices to true you have to specify the gross_price
-
vat: the only field you have to set is the id, you can get the id of the vat you need by performing a list vat type call or create a vat type if the one you want does not exist yet.
-
discount: optional, discount percentage, automatically set if you specified the default discount in the relative client registry
-
category: useful to categorize your products
-
description: additional details
-
qty: number of products sold
-
measure: optional, unit of measure of the product (eg: kilograms, liters, days, etc...)
-
not_taxable: if this flag is set to true the amount will not be counted as revenue.
-
apply_withholding_tax: if you don't want withholding taxes, rivalsa, and cassa to be applied set this flag to false.
If you want to add a 'bollo a carico del cliente' in a einvoice, you have to add a new item, set the name to 'Bollo in fattura', net_price to 2€, not_taxable to true and the vat.id field to 21 (0% Escluso Art.15), if the invoice is not electronic it's enough to set the field stamp_duty to the amount you want to charge, keep in mind that using the stamp_duty in a einvoice the 'bollo' will be charged to you, not to the customer.
If you choose to link an existing product (or to create a new one) make sure you set all the fields you want to be shown in your invoice: at this moment we don't autocomplete your invoice with the product details, even if it is already stored in Fatture in Cloud. You can get the info about your product performing a Get Product request.
Now we add the items_list to our request:
// NOTE: this is a partial request, please wait before sending it
{
"data": {
"type": "invoice",
"entity": {
"id": 1,
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
},
"date": "2022-01-20",
"number": 1,
"numeration": "/fatt",
"subject": "internal subject",
"visible_subject": "visible subject",
"currency": {
"id": "EUR",
"exchange_rate": "1.00000",
"symbol": "€"
},
"language": {
"code": "it",
"name": "Italiano"
},
"items_list": [
{
"product_id": 4,
"code": "TV3",
"name": "Tavolo in legno",
"net_price": 100,
"category": "cucina",
"discount": 0,
"qty": 1,
"vat": {
"id": 0 #22%
}
}
]
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
currency: new Currency(
id: "EUR"
),
language: new Language(
code: "it",
name: "italiano"
),
// Here we set the Items List
// List your products: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/ProductsApi.md#listProducts
itemsList: new List < IssuedDocumentItemsListItem > {
new IssuedDocumentItemsListItem(
productId: 4,
code: "TV3",
name: "Tavolo in legno",
netPrice: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: new VatType(
id: 0
)
)
}
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano")).
// Here we set the Items List
// List your products: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/ProductsApi.md#listProducts
SetItemsList([]fattureincloud.IssuedDocumentItemsListItem{
*fattureincloud.NewIssuedDocumentItemsListItem().
SetProductId(4).
SetCode("TV3").
SetName("Tavolo in legno").
SetNetPrice(100).
SetCategory("cucina").
SetDiscount(0).
SetQty(1).
SetVat(*fattureincloud.NewVatType().SetId(0)),
})
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
.currency(new Currency().id("EUR"))
.language(new Language()
.code("it")
.name("italiano")
)
// Here we set the Items List
// List your products: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/ProductsApi.md#listProducts
.addItemsListItem(
new IssuedDocumentItemsListItem()
.productId(4)
.code("TV3")
.name("Tavolo in legno")
.netPrice(BigDecimal.valueOf(100))
.category("cucina")
.discount(BigDecimal.valueOf(0))
.qty(BigDecimal.valueOf(1))
.vat(new VatType().id(0))
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
let entity = new fattureInCloudSdk.Entity();
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
invoice.date = "2022-01-20";
invoice.number = 1;
invoice.numeration = "/fatt";
invoice.subject = "internal subject";
invoice.visible_subject = "visible subject";
invoice.currency = {
id: "EUR",
};
invoice.language = {
code: "it",
name: "Italiano",
};
// Here we set the Items List
// List your products: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ProductsApi.md#listProducts
invoice.items_list = [
{
product_id: 4,
code: "tv3",
name: "tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
];
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
// Here we set the Items List
// List your products: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/ProductsApi.md#listproducts
$invoice->setItemsList(
array(
new IssuedDocumentItemsListItem(
array(
"product_id" => 4,
"code" => "TV3",
"name" => "Tavolo in legno",
"net_price" => 100,
"category" => "cucina",
"discount" => 0,
"qty" => 1,
"vat" => new VatType(
array(
"id" => 0
)
)
)
)
)
);
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
currency = Currency(
id="EUR"
),
language = Language(
code="it",
name="italiano"
),
# Here we set the Items List
# List your products: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/ProductsApi.md#list_products
items_list = [
IssuedDocumentItemsListItem(
product_id=4,
code="TV3",
name="Tavolo in legno",
net_price=100.0,
category="cucina",
discount=0.0,
qty=1.0,
vat=VatType(
id=0
)
)
]
)
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia",
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
),
# Here we set the Items List
# List your products: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/ProductsApi.md#list_products
items_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentItemsListItem.new(
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: FattureInCloud_Ruby_Sdk::VatType.new(
id: 0
)
)
)
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: {
id: "EUR",
},
language: {
code: "it",
name: "italiano",
},
// Here we set the Items List
// List your products: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/ProductsApi.md#listProducts
items_list: [
{
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
],
};
The Items List in fact accepts an array of items.
In this example, we'll insert only a single item, but you can check how to insert multiple items in the Zapier Documentation.
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Data.items list - Issued document item product id | data.items_list.product_id | 4 | Check List Products |
Data.items list - Issued document item product code | data.items_list.code | TV3 | |
Data.items list - Issued document item product name | data.items_list.name | Tavolo in legno | |
Data.items list - Issued document item product net price | data.items_list.net_price | 100 | |
Data.items list - Issued document item product category | data.items_list.category | cucina | |
Data.items list - Issued document item product description | data.items_list.discount | 0 | |
Data.items list - Issued document item product qty | data.items_list.qty | 1 | |
Data.items list - Vat type id | data.items_list.vat.id | 0 | Check List VAT Type |
6️⃣ Step Six: Payments List
The Payment List section allows the insertion of all the info about your invoice payments.
-
amount: the amount of the payment.
-
payment_terms: the number of days by which the payment must be made can be set.
-
due_date: the date by which the payment must be made.
-
status: the payment status, can be not_paid, paid, and reversed.
-
payment_account: if the status of the invoice is paid, the payment account id needs to be set, make sure it exists or you will get an error. You can get a list of your payment accounts or create a new one as you need.
Here we suppose that the status is "paid", and we add the new parameters to the request:
// NOTE: this is a partial request, please wait before sending it
{
"data": {
"type": "invoice",
"entity": {
"id": 1,
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
},
"date": "2022-01-20",
"number": 1,
"numeration": "/fatt",
"subject": "internal subject",
"visible_subject": "visible subject",
"currency": {
"id": "EUR",
"exchange_rate": "1.00000",
"symbol": "€"
},
"language": {
"code": "it",
"name": "Italiano"
},
"items_list": [
{
"product_id": 4,
"code": "TV3",
"name": "Tavolo in legno",
"net_price": 100,
"category": "cucina",
"discount": 0,
"qty": 1,
"vat": {
"id": 0
}
}
],
"payments_list": [
{
"amount": 122,
"due_date": "2022-01-23",
"paid_date": "2022-01-22",
"status": "paid",
"payment_account": {
"id": 110
}
}
]
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
currency: new Currency(
id: "EUR"
),
language: new Language(
code: "it",
name: "italiano"
),
itemsList: new List < IssuedDocumentItemsListItem > {
new IssuedDocumentItemsListItem(
productId: 4,
code: "TV3",
name: "Tavolo in legno",
netPrice: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: new VatType(
id: 0
)
)
},
// Here we set the payments list assuming our invoice has already been paid
paymentsList: new List < IssuedDocumentPaymentsListItem > {
new IssuedDocumentPaymentsListItem(
amount: 122,
dueDate: new DateTime(2022, 01, 23),
paidDate: new DateTime(2022, 01, 22),
status: IssuedDocumentStatus.Paid,
// List your payment accounts: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/InfoApi.md#listPaymentAccounts
paymentAccount: new PaymentAccount(
id: 110
)
)
}
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano")).
SetItemsList([]fattureincloud.IssuedDocumentItemsListItem{
*fattureincloud.NewIssuedDocumentItemsListItem().
SetProductId(4).
SetCode("TV3").
SetName("Tavolo in legno").
SetNetPrice(100).
SetCategory("cucina").
SetDiscount(0).
SetQty(1).
SetVat(*fattureincloud.NewVatType().SetId(0)),
}).
// Here we set the Payments List
// List your payment accounts: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/InfoApi.md#listPaymentAccounts
SetPaymentsList([]fattureincloud.IssuedDocumentPaymentsListItem{
*fattureincloud.NewIssuedDocumentPaymentsListItem().
SetAmount(122).
SetDueDate("2022-01-23").
SetPaidDate("2022-01-22").
SetStatus(fattureincloud.IssuedDocumentStatuses.NOT_PAID).
SetPaymentAccount(*fattureincloud.NewPaymentAccount().SetId(110)),
})
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
.currency(new Currency().id("EUR"))
.language(new Language()
.code("it")
.name("italiano")
)
.addItemsListItem(
new IssuedDocumentItemsListItem()
.productId(4)
.code("TV3")
.name("Tavolo in legno")
.netPrice(BigDecimal.valueOf(100))
.category("cucina")
.discount(BigDecimal.valueOf(0))
.qty(BigDecimal.valueOf(1))
.vat(new VatType().id(0))
)
// Here we set the payments list assuming our invoice has already been paid
.addPaymentsListItem(
new IssuedDocumentPaymentsListItem()
.amount(BigDecimal.valueOf(122))
.dueDate(LocalDate.of(2022, 01, 23))
.paidDate(LocalDate.of(2022, 01, 22))
.status(IssuedDocumentStatus.PAID)
// List your payment accounts: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/InfoApi.md#listPaymentAccounts
.paymentAccount(new PaymentAccount().id(110))
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
let entity = new fattureInCloudSdk.Entity();
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
invoice.date = "2022-01-20";
invoice.number = 1;
invoice.numeration = "/fatt";
invoice.subject = "internal subject";
invoice.visible_subject = "visible subject";
invoice.currency = {
id: "EUR",
};
invoice.language = {
code: "it",
name: "Italiano",
};
invoice.items_list = [
{
product_id: 4,
code: "tv3",
name: "tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
];
// Here we set the payments list assuming our invoice has already been paid
invoice.payments_list = [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
// List your payment accounts: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md#listPaymentAccounts
payment_account: {
id: 10,
},
},
];
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
$invoice->setItemsList(
array(
new IssuedDocumentItemsListItem(
array(
"product_id" => 4,
"code" => "TV3",
"name" => "Tavolo in legno",
"net_price" => 100,
"category" => "cucina",
"discount" => 0,
"qty" => 1,
"vat" => new VatType(
array(
"id" => 0
)
)
)
)
)
);
// Here we set the payments list assuming our invoice has already been paid
$invoice->setPaymentsList(
array(
new IssuedDocumentPaymentsListItem(
array(
"amount" => 122,
"due_date" => new DateTime("2022-01-23"),
"paid_date" => new DateTime("2022-01-22"),
"status" => IssuedDocumentStatus::PAID,
// List your payment accounts: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/InfoApi.md#listpaymentaccounts
"payment_account" => new PaymentAccount(
array(
"id" => 110
)
)
)
)
)
);
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
currency = Currency(
id="EUR"
),
language = Language(
code="it",
name="italiano"
),
items_list = [
IssuedDocumentItemsListItem(
product_id=4,
code="TV3",
name="Tavolo in legno",
net_price=100.0,
category="cucina",
discount=0.0,
qty=1.0,
vat=VatType(
id=0
)
)
],
# Here we set the payments list assuming our invoice has already been paid
payments_list = [
IssuedDocumentPaymentsListItem(
amount=122.0,
due_date=datetime.date(2022, 1, 23),
paid_date=datetime.date(2022, 1, 22),
status=IssuedDocumentStatus("paid"),
# List your payment accounts: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/InfoApi.md#list_payment_accounts
payment_account=PaymentAccount(
id=110
)
)
]
)
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia",
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
),
items_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentItemsListItem.new(
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: FattureInCloud_Ruby_Sdk::VatType.new(
id: 0
)
)
),
# Here we set the payments list assuming our invoice has already been paid
payments_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentPaymentsListItem.new(
amount: 122,
due_date: Date.new(2022, 01, 23),
paid_date: Date.new(2022, 01, 22),
status: FattureInCloud_Ruby_Sdk::IssuedDocumentStatus::PAID,
# List your payment accounts: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/InfoApi.md#list_payment_accounts
payment_account: FattureInCloud_Ruby_Sdk::PaymentAccount.new(
id: 110
)
)
)
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: {
id: "EUR",
},
language: {
code: "it",
name: "italiano",
},
items_list: [
{
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
],
// Here we set the payments list assuming our invoice has already been paid
payments_list: [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
// List your payment accounts: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/InfoApi.md#listPaymentAccounts
payment_account: {
id: 10,
},
},
],
};
The Payments List in fact accepts an array of items.
In this example, we'll insert only a single item, but you can check how to insert multiple items in the Zapier Documentation.
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Data.payments list - Issued document payment amount | data.payments_list.amount | 122 | |
Data.payments list - Issued document payment due date | data.payments_list.due_date | 2022-01-23 | |
Data.payments list - Issued document payment date | data.payments_list.paid_date | 2022-01-22 | |
Data.payments list - Issued document status | data.payments_list.status | paid | |
Data.payments list - Payment account id | data.payments_list.payment_account.id | 110 | Check List Payment Accounts |
If you want to know more about the calculation of the amounts you can visit the calculating totals page.
7️⃣ Step Seven: Advanced Options
The Advanced Options section allows the management of the payment methods and the direct generation of DDT and accompanying invoices.
-
payment_method: you can use this field to communicate to the customer how to pay the invoice; the only required parameter is the payment method id, make sure it exists or you will get an error. You can get a list of your payment methods or create a new one according to your needs.
-
show_payment_method: if this flag is set to true, it shows the payment method details in the invoice.
-
delivery_note: if this flag is set to true, you can set all the delivery note-related parameters and a DDT will be automatically created.
-
accompanying_invoice: if this flag is set to true, you can set all the accompanying invoice-related parameters and it will be automatically created.
-
amount_due_discount: with this parameter you can set a discount or surcharge on the total of the invoice.
-
use_split_payment: this flag can be set to true if the split payment is needed.
Below we add the Payment Method to the request:
// NOTE: this is a partial request, please wait before sending it
{
"data": {
"type": "invoice",
"entity": {
"id": 1,
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
},
"date": "2022-01-20",
"number": 1,
"numeration": "/fatt",
"subject": "internal subject",
"visible_subject": "visible subject",
"currency": {
"id": "EUR",
"exchange_rate": "1.00000",
"symbol": "€"
},
"language": {
"code": "it",
"name": "Italiano"
},
"items_list": [
{
"product_id": 4,
"code": "TV3",
"name": "Tavolo in legno",
"net_price": 100,
"category": "cucina",
"discount": 0,
"qty": 1,
"vat": {
"id": 0
}
}
],
"payments_list": [
{
"amount": 122,
"due_date": "2022-01-23",
"paid_date": "2022-01-22",
"status": "paid",
"payment_account": {
"id": 110
}
}
],
"payment_method": {
"id": 386683
}
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
currency: new Currency(
id: "EUR"
),
language: new Language(
code: "it",
name: "italiano"
),
itemsList: new List < IssuedDocumentItemsListItem > {
new IssuedDocumentItemsListItem(
productId: 4,
code: "TV3",
name: "Tavolo in legno",
netPrice: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: new VatType(
id: 0
)
)
},
paymentsList: new List < IssuedDocumentPaymentsListItem > {
new IssuedDocumentPaymentsListItem(
amount: 122,
dueDate: new DateTime(2022, 01, 23),
paidDate: new DateTime(2022, 01, 22),
status: IssuedDocumentStatus.Paid,
paymentAccount: new PaymentAccount(
id: 110
)
)
},
// Here we add the payment method
// List your payment methods: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/InfoApi.md#listpaymentmethods
paymentMethod: new PaymentMethod(
id: 386683
)
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano")).
SetItemsList([]fattureincloud.IssuedDocumentItemsListItem{
*fattureincloud.NewIssuedDocumentItemsListItem().
SetProductId(4).
SetCode("TV3").
SetName("Tavolo in legno").
SetNetPrice(100).
SetCategory("cucina").
SetDiscount(0).
SetQty(1).
SetVat(*fattureincloud.NewVatType().SetId(0)),
}).
SetPaymentsList([]fattureincloud.IssuedDocumentPaymentsListItem{
*fattureincloud.NewIssuedDocumentPaymentsListItem().
SetAmount(122).
SetDueDate("2022-01-23").
SetPaidDate("2022-01-22").
SetStatus(fattureincloud.IssuedDocumentStatuses.NOT_PAID).
SetPaymentAccount(*fattureincloud.NewPaymentAccount().SetId(110)),
}).
// Here we add the payment method
// List your payment methods: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/InfoApi.md#listpaymentmethods
SetPaymentMethod(*fattureincloud.NewPaymentMethod().SetId(386683))
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
.currency(new Currency().id("EUR"))
.language(new Language()
.code("it")
.name("italiano")
)
.addItemsListItem(
new IssuedDocumentItemsListItem()
.productId(4)
.code("TV3")
.name("Tavolo in legno")
.netPrice(BigDecimal.valueOf(100))
.category("cucina")
.discount(BigDecimal.valueOf(0))
.qty(BigDecimal.valueOf(1))
.vat(new VatType().id(0))
)
.addPaymentsListItem(
new IssuedDocumentPaymentsListItem()
.amount(BigDecimal.valueOf(122))
.dueDate(LocalDate.of(2022, 01, 23))
.paidDate(LocalDate.of(2022, 01, 22))
.status(IssuedDocumentStatus.PAID)
.paymentAccount(new PaymentAccount().id(110))
)
// Here we add the payment method
// List your payment methods: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/InfoApi.md#listpaymentmethods
.paymentMethod(
new PaymentMethod().id(386683)
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
let entity = new fattureInCloudSdk.Entity();
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
invoice.date = "2022-01-20";
invoice.number = 1;
invoice.numeration = "/fatt";
invoice.subject = "internal subject";
invoice.visible_subject = "visible subject";
invoice.currency = {
id: "EUR",
};
invoice.language = {
code: "it",
name: "Italiano",
};
invoice.items_list = [
{
product_id: 4,
code: "tv3",
name: "tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
];
invoice.payments_list = [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
payment_account: {
id: 10,
},
},
];
// Here we add the payment method
// List your payment methods: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md#listpaymentmethods
invoice.payment_method = {
id: 386683,
};
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
$invoice->setItemsList(
array(
new IssuedDocumentItemsListItem(
array(
"product_id" => 4,
"code" => "TV3",
"name" => "Tavolo in legno",
"net_price" => 100,
"category" => "cucina",
"discount" => 0,
"qty" => 1,
"vat" => new VatType(
array(
"id" => 0
)
)
)
)
)
);
$invoice->setPaymentsList(
array(
new IssuedDocumentPaymentsListItem(
array(
"amount" => 122,
"due_date" => new DateTime("2022-01-23"),
"paid_date" => new DateTime("2022-01-22"),
"status" => IssuedDocumentStatus::PAID,
"payment_account" => new PaymentAccount(
array(
"id" => 110
)
)
)
)
)
);
// Here we add the payment method
// List your payment methods: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/InfoApi.md#listpaymentmethods
$invoice->setPaymentMethod(
new PaymentMethod(
array(
"id" => 386683
)
)
);
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
currency = Currency(
id="EUR"
),
language = Language(
code="it",
name="italiano"
),
items_list = [
IssuedDocumentItemsListItem(
product_id=4,
code="TV3",
name="Tavolo in legno",
net_price=100.0,
category="cucina",
discount=0.0,
qty=1.0,
vat=VatType(
id=0
)
)
],
payments_list = [
IssuedDocumentPaymentsListItem(
amount=122.0,
due_date=datetime.date(2022, 1, 23),
paid_date=datetime.date(2022, 1, 22),
status=IssuedDocumentStatus("paid"),
payment_account=PaymentAccount(
id=110
)
)
],
# Here we add the payment method
# List your payment methods: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/InfoApi.md#list_payment_methods
payment_method = PaymentMethod(
id=386683
)
)
# NOTE: this is a partial request, please wait before sending it
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia",
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
),
items_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentItemsListItem.new(
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: FattureInCloud_Ruby_Sdk::VatType.new(
id: 0
)
)
),
payments_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentPaymentsListItem.new(
amount: 122,
due_date: Date.new(2022, 01, 23),
paid_date: Date.new(2022, 01, 22),
status: FattureInCloud_Ruby_Sdk::IssuedDocumentStatus::PAID,
payment_account: FattureInCloud_Ruby_Sdk::PaymentAccount.new(
id: 110
)
)
),
# Here we add the payment method
# List your payment methods: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/InfoApi.md#list_payment_methods
payment_method: FattureInCloud_Ruby_Sdk::PaymentMethod.new(
id: 386683
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: {
id: "EUR",
},
language: {
code: "it",
name: "italiano",
},
items_list: [
{
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
],
payments_list: [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
payment_account: {
id: 10,
},
},
],
// Here we add the payment method
// List your payment methods: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/InfoApi.md#listpaymentmethods
payment_method: {
id: 386683,
},
};
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Payment method id | data.payment_method.id | 386683 | Check List Payment Method |
8️⃣ Step Eight: Attachment
If you want to attach a file to your invoice you can do it by using Upload Attachment method; the response will include an attachment_token, that you can pass to the Invoice Creation request that we're building to effectively attach the file. The token must be assigned to the attachment_token parameter in the request.
The code to upload an attachment with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
Configuration config = new Configuration();
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new IssuedDocumentsApi(config);
var filename = "fattura_XX_XXXX";
var attachment = File.Open("/path/to/file.pdf", FileMode.Open);
var companyId = 12345;
UploadIssuedDocumentAttachmentResponse result = apiInstance.UploadIssuedDocumentAttachment(companyId, filename, attachment);
var attachmentToken = result.Data.AttachmentToken;
companyId := int32(12345)
filename := "fattura_XX_XXXX"
attachment, _ := os.Open("/path/to/file.pdf")
auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "YOUR_ACCESS_TOKEN")
configuration := fattureincloudapi.NewConfiguration()
apiClient := fattureincloudapi.NewAPIClient(configuration)
resp, r, err := apiClient.IssuedDocumentsAPI.UploadIssuedDocumentAttachment(auth, companyId).Filename(filename).Attachment(attachment).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IssuedDocumentsAPI.UploadIssuedDocumentAttachment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
attachmentToken := resp.Data.AttachmentToken
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAuth2AuthenticationCodeFlow = (OAuth) defaultClient.getAuthentication("OAuth2AuthenticationCodeFlow");
OAuth2AuthenticationCodeFlow.setAccessToken("YOUR_ACCESS_TOKEN");
IssuedDocumentsApi apiInstance = new IssuedDocumentsApi(defaultClient);
Integer companyId = 12345;
String filename = "fattura_XX_XXXX";
File attachment = new File("/path/to/file.pdf");
UploadIssuedDocumentAttachmentResponse result = apiInstance.uploadIssuedDocumentAttachment(companyId, filename, attachment);
String attachmentToken = result.getData().getAttachmentToken();
let defaultClient = fattureInCloudSdk.ApiClient.instance;
let OAuth2AuthenticationCodeFlow =
defaultClient.authentications["OAuth2AuthenticationCodeFlow"];
OAuth2AuthenticationCodeFlow.accessToken = "YOUR_ATTACHMENT_TOKEN";
let apiInstance = new fattureInCloudSdk.IssuedDocumentsApi();
let companyId = 12345;
let opts = {
filename: "fattura_XX_XXXX",
attachment: fs.createReadStream("/path/to/file.pdf"),
};
let res = await apiInstance.uploadIssuedDocumentAttachment(companyId, opts);
let attachmentTokent = res.data.attachment_token;
$config = FattureInCloud\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new FattureInCloud\Api\IssuedDocumentsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$company_id = 12345;
$filename = 'filename_example';
$attachment = "/path/to/file.txt";
try {
$result = $apiInstance->uploadIssuedDocumentAttachment($company_id, $filename, $attachment);
print_r($result->data->attachment_token);
} catch (Exception $e) {
echo 'Exception when calling IssuedDocumentsApi->uploadIssuedDocumentAttachment: ', $e->getMessage(), PHP_EOL;
}
configuration = fattureincloud_python_sdk.Configuration()
configuration.access_token = "YOUR_ACCESS_TOKEN"
with fattureincloud_python_sdk.ApiClient(configuration) as api_client:
api_instance = issued_documents_api.IssuedDocumentsApi(api_client)
company_id = 12345
filename = "fattura_XX_XXXX"
attachment = open('/path/to/file.pdf', 'rb')
api_response = api_instance.upload_issued_document_attachment(company_id, filename=filename, attachment=attachment)
attachmen_token = api_response.data.attachment_token
FattureInCloud_Ruby_Sdk.configure do |config|
config.access_token = 'YOUR_ATTACHMENT_TOKEN'
end
api_instance = FattureInCloud_Ruby_Sdk::IssuedDocumentsApi.new
company_id = 12345
opts = {
filename: 'fattura_XX_XXXX',
attachment: File.open('/path/to/file.pdf')
}
res = api_instance.upload_issued_document_attachment(company_id, opts)
attachment_token = res.data.attachment_token
const apiConfig = new Configuration({
accessToken: "YOUR_ACCESS_TOKEN",
});
let apiInstance = new IssuedDocumentsApi(apiConfig);
let companyId = 12345;
let filename = "fattura_XX_XXXX";
let attachment = fs.createReadStream("path/to/file.pdf");
let res = await apiInstance.uploadIssuedDocumentAttachment(
companyId,
filename,
attachment
);
let attachemntToken = res.data.data?.attachment_token;
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Issued Document attachment token | data.attachment_token | FAKE_TOKEN | Check Upload Attachment Method |
You can set the Access Token in the dedicated section, for more informations look here.
9️⃣ Step Nine: Customisation
The customization section allows the choice of the invoice template and is useful to add some details.
-
template/delivery_note_template/acc_inv_template: invoice/delivery note/accompanying invoice template, only the id of the template has to be specified, you can retrieve it using the list templates method.
-
h_margins/v_margins: horizontal/vertical margins.
-
show_payments: if this flag is set to false, the expiration dates of the payments will not be shown on the document.
-
show_tspay_button: if this flag is set to true, when the invoice is received by the client it can be paid directly via TS Pay and, without further operations, the invoice will result as paid.
-
show_notification_button: if this flag is set to true when the client pays the invoice he can notify the payment by clicking the button.
Here there is our final JSON, complete with the attachment and our favorite invoice template:
// NOTE: this is a complete request, but please customize it before trying to send it!
{
"data": {
"type": "invoice",
"entity": {
"id": 1,
"name": "Mario Rossi",
"vat_number": "47803200154",
"tax_code": "RSSMRA91M20B967Q",
"address_street": "Via Italia, 66",
"address_postal_code": "20900",
"address_city": "Milano",
"address_province": "MI",
"address_extra": "",
"country": "Italia"
},
"date": "2022-01-20",
"number": 1,
"numeration": "/fatt",
"subject": "internal subject",
"visible_subject": "visible subject",
"currency": {
"id": "EUR",
"exchange_rate": "1.00000",
"symbol": "€"
},
"language": {
"code": "it",
"name": "Italiano"
},
"items_list": [
{
"product_id": 4,
"code": "TV3",
"name": "Tavolo in legno",
"net_price": 100,
"category": "cucina",
"discount": 0,
"qty": 1,
"vat": {
"id": 0
}
}
],
"payment_method": {
"id": 386683
},
"payments_list": [
{
"amount": 122,
"due_date": "2022-01-23",
"paid_date": "2022-01-22",
"status": "paid",
"payment_account": {
"id": 110
}
}
],
"attachment_token": "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
"template": {
"id": 150
}
}
}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
currency: new Currency(
id: "EUR"
),
language: new Language(
code: "it",
name: "italiano"
),
itemsList: new List < IssuedDocumentItemsListItem > {
new IssuedDocumentItemsListItem(
productId: 4,
code: "TV3",
name: "Tavolo in legno",
netPrice: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: new VatType(
id: 0
)
)
},
paymentsList: new List < IssuedDocumentPaymentsListItem > {
new IssuedDocumentPaymentsListItem(
amount: 122,
dueDate: new DateTime(2022, 01, 23),
paidDate: new DateTime(2022, 01, 22),
status: IssuedDocumentStatus.Paid,
paymentAccount: new PaymentAccount(
id: 110
)
)
},
paymentMethod: new PaymentMethod(
id: 386683
),
// Finally we can add the attachment token of our uploaded file and a template
// Upload your attachment: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/IssuedDocumentsApi.md#uploadIssuedDocumentAttachment
attachmentToken: "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
// List your templates: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/InfoApi.md#listTemplates
template: new DocumentTemplate(
id: 150
)
);
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano")).
SetItemsList([]fattureincloud.IssuedDocumentItemsListItem{
*fattureincloud.NewIssuedDocumentItemsListItem().
SetProductId(4).
SetCode("TV3").
SetName("Tavolo in legno").
SetNetPrice(100).
SetCategory("cucina").
SetDiscount(0).
SetQty(1).
SetVat(*fattureincloud.NewVatType().SetId(0)),
}).
SetPaymentsList([]fattureincloud.IssuedDocumentPaymentsListItem{
*fattureincloud.NewIssuedDocumentPaymentsListItem().
SetAmount(122).
SetDueDate("2022-01-23").
SetPaidDate("2022-01-22").
SetStatus(fattureincloud.IssuedDocumentStatuses.NOT_PAID).
SetPaymentAccount(*fattureincloud.NewPaymentAccount().SetId(110)),
}).
SetPaymentMethod(*fattureincloud.NewPaymentMethod().SetId(386683)).
// Finally we can add the attachment token of our uploaded file and a template
// Upload your attachment: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/IssuedDocumentsApi.md#uploadIssuedDocumentAttachment
SetAttachmentToken("YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw").
// List your templates: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/InfoApi.md#listTemplates
SetTemplate(*fattureincloud.NewDocumentTemplate().SetId(150))
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
.currency(new Currency().id("EUR"))
.language(new Language()
.code("it")
.name("italiano")
)
.addItemsListItem(
new IssuedDocumentItemsListItem()
.productId(4)
.code("TV3")
.name("Tavolo in legno")
.netPrice(BigDecimal.valueOf(100))
.category("cucina")
.discount(BigDecimal.valueOf(0))
.qty(BigDecimal.valueOf(1))
.vat(new VatType().id(0))
)
.addPaymentsListItem(
new IssuedDocumentPaymentsListItem()
.amount(BigDecimal.valueOf(122))
.dueDate(LocalDate.of(2022, 01, 23))
.paidDate(LocalDate.of(2022, 01, 22))
.status(IssuedDocumentStatus.PAID)
.paymentAccount(new PaymentAccount().id(110))
)
.paymentMethod(
new PaymentMethod().id(386683)
)
// Finally we can add the attachment token of our uploaded file and a template
// Upload your attachment: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/IssuedDocumentsApi.md#uploadIssuedDocumentAttachment
.attachmentToken("YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw")
// List your templates: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/InfoApi.md#listTemplates
.template(new DocumentTemplate().id(150));
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
let entity = new fattureInCloudSdk.Entity();
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
invoice.date = "2022-01-20";
invoice.number = 1;
invoice.numeration = "/fatt";
invoice.subject = "internal subject";
invoice.visible_subject = "visible subject";
invoice.currency = {
id: "EUR",
};
invoice.language = {
code: "it",
name: "Italiano",
};
invoice.items_list = [
{
product_id: 4,
code: "tv3",
name: "tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
];
invoice.payments_list = [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
payment_account: {
id: 10,
},
},
];
invoice.payment_method = {
id: 386683,
};
// Finally we can add the attachment token of our uploaded file and a template
// Upload your attachment: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/IssuedDocumentsApi.md#uploadIssuedDocumentAttachment
invoice.attachment_token =
"YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw";
// List your templates: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md#listTemplates
invoice.template = {
id: 150,
};
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// In this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
$invoice->setItemsList(
array(
new IssuedDocumentItemsListItem(
array(
"product_id" => 4,
"code" => "TV3",
"name" => "Tavolo in legno",
"net_price" => 100,
"category" => "cucina",
"discount" => 0,
"qty" => 1,
"vat" => new VatType(
array(
"id" => 0
)
)
)
)
)
);
$invoice->setPaymentMethod(
new PaymentMethod(
array(
"id" => 386683
)
)
);
$invoice->setPaymentsList(
array(
new IssuedDocumentPaymentsListItem(
array(
"amount" => 122,
"due_date" => new DateTime("2022-01-23"),
"paid_date" => new DateTime("2022-01-22"),
"status" => IssuedDocumentStatus::PAID,
"payment_account" => new PaymentAccount(
array(
"id" => 110
)
)
)
)
)
);
// Finally we can add the attachment token of our uploaded file and a template
// Upload your attachment: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/IssuedDocumentsApi.md#uploadissueddocumentattachment
$invoice->setAttachmentToken("YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw");
// List your templates: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/InfoApi.md#listtemplates
$invoice->setTemplate(
new DocumentTemplate(
array(
"id" => 150
)
)
);
# NOTE: this is a complete request, but please customize it!!!
# In the next step we'll explain how to perform the request to the API.
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
currency = Currency(
id="EUR"
),
language = Language(
code="it",
name="italiano"
),
items_list = [
IssuedDocumentItemsListItem(
product_id=4,
code="TV3",
name="Tavolo in legno",
net_price=100.0,
category="cucina",
discount=0.0,
qty=1.0,
vat=VatType(
id=0
)
)
],
payments_list = [
IssuedDocumentPaymentsListItem(
amount=122.0,
due_date=datetime.date(2022, 1, 23),
paid_date=datetime.date(2022, 1, 22),
status=IssuedDocumentStatus("paid"),
payment_account=PaymentAccount(
id=110
)
)
],
payment_method = PaymentMethod(
id=386683
),
# Finally we can add the attachment token of our uploaded file and a template
# Upload your attachment: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/IssuedDocumentsApi.md#upload_issued_document_attachment
attachment_token = "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
# List your templates: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/InfoApi.md#list_templates
template = DocumentTemplate(
id=150
)
)
# NOTE: this is a complete request, but please customize it!!!
# In the next step we'll explain how to perform the request to the API.
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia",
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
),
items_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentItemsListItem.new(
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: FattureInCloud_Ruby_Sdk::VatType.new(
id: 0
)
)
),
payments_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentPaymentsListItem.new(
amount: 122,
due_date: Date.new(2022, 01, 23),
paid_date: Date.new(2022, 01, 22),
status: FattureInCloud_Ruby_Sdk::IssuedDocumentStatus::PAID,
payment_account: FattureInCloud_Ruby_Sdk::PaymentAccount.new(
id: 110
)
)
),
payment_method: FattureInCloud_Ruby_Sdk::PaymentMethod.new(
id: 386683
),
# Finally we can add the attachment token of our uploaded file and a template
# Upload your attachment: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/IssuedDocumentsApi.md#upload_issued_document_attachment
attachment_token: "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
# List your templates: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/InfoApi.md#list_templates
template: FattureInCloud_Ruby_Sdk::DocumentTemplate.new(
id: 150
)
)
// NOTE: this is a partial request, please wait before sending it
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: {
id: "EUR",
},
language: {
code: "it",
name: "italiano",
},
items_list: [
{
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
],
payments_list: [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
payment_account: {
id: 10,
},
},
],
payment_method: {
id: 386683,
},
// Finally we can add the attachment token of our uploaded file and a template
// Upload your attachment: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/IssuedDocumentsApi.md#uploadIssuedDocumentAttachment
attachment_token: "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
// List your templates: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/InfoApi.md#listTemplates
template: {
id: 150,
},
};
As done in the previous step, we'll show you the list of the fields to be populated for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
Template id | data.template.id | 10 | Check List Templates Method |
Please, remember that this request will most probably fail if executed as-is! For example, the IDs specified in the request must exist in order to avoid getting an error response! Remember to check the various methods explained in this guide to fill the request fields correctly!
✅ Create the document!
Now we are ready to create an invoice, so let's create an invoice using the request we just built:
POST /c/1235/issued_documents HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: api-v2.fattureincloud.it
Content-Length: 900
{"data":{"type":"invoice","entity":{"id":1,"name":"Mario Rossi","vat_number":"47803200154","tax_code":"RSSMRA91M20B967Q","address_street":"Via Italia, 66","address_postal_code":"20900","address_city":"Milano","address_province":"MI","address_extra":"","country":"Italia"},"date":"2022-01-20","number":1,"numeration":"\/fatt","subject":"internal subject","visible_subject":"visible subject","currency":{"id":"EUR","exchange_rate":"1.00000","symbol":"\u20ac"},"language":{"code":"it","name":"Italiano"},"items_list":[{"product_id":4,"code":"TV3","name":"Tavolo in legno","net_price":100,"category":"cucina","discount":0,"qty":1,"vat":{"id":0}}],"payment_method":{"id":386683},"payments_list":[{"amount":122,"due_date":"2022-01-23","paid_date":"2022-01-22","status":"paid","payment_account":{"id":110}}],"attachment_token":"YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw","template":{"id":150}}}
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
using System;
using System.Collections.Generic;
using It.FattureInCloud.Sdk.Api;
using It.FattureInCloud.Sdk.Client;
using It.FattureInCloud.Sdk.Model;
namespace test {
class Program {
static void Main(string[] args) {
Configuration config = new Configuration();
//set your access token
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new IssuedDocumentsApi(config);
//set your company id
var companyId = 12345;
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
Entity entity = new Entity(
id: 1,
name: "Mario Rossi",
vatNumber: "47803200154",
taxCode: "RSSMRA91M20B967Q",
addressStreet: "Via Italia, 66",
addressPostalCode: "20900",
addressCity: "Milano",
addressProvince: "MI",
country: "Italia"
);
IssuedDocument invoice = new IssuedDocument(
type: IssuedDocumentType.Invoice,
entity: entity,
date: new DateTime(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visibleSubject: "visible subject",
currency: new Currency(
id: "EUR"
),
language: new Language(
code: "it",
name: "italiano"
),
itemsList: new List < IssuedDocumentItemsListItem > {
new IssuedDocumentItemsListItem(
productId: 4,
code: "TV3",
name: "Tavolo in legno",
netPrice: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: new VatType(
id: 0
)
)
},
paymentsList: new List < IssuedDocumentPaymentsListItem > {
new IssuedDocumentPaymentsListItem(
amount: 122,
dueDate: new DateTime(2022, 01, 23),
paidDate: new DateTime(2022, 01, 22),
status: IssuedDocumentStatus.Paid,
paymentAccount: new PaymentAccount(
id: 110
)
)
},
paymentMethod: new PaymentMethod(
id: 386683
),
attachmentToken: "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
template: new DocumentTemplate(
id: 150
)
);
// Here we put our invoice in the request object
CreateIssuedDocumentRequest createIssuedDocumentRequest = new CreateIssuedDocumentRequest(
data: invoice
);
// Now we are all set for the final call
// Create the invoice: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/IssuedDocumentsApi.md#createissueddocument
try {
CreateIssuedDocumentResponse result = apiInstance.CreateIssuedDocument(companyId, createIssuedDocumentRequest);
Console.WriteLine(result);
} catch (ApiException e) {
Console.WriteLine("Exception when calling IssuedDocumentsApi.CreateIssuedDocument: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
}
}
}
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
package main
import (
"context"
"encoding/json"
"fmt"
"os"
fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)
func main() {
//set your access token
auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "YOUR_ACCESS_TOKEN")
configuration := fattureincloudapi.NewConfiguration()
apiClient := fattureincloudapi.NewAPIClient(configuration)
//set your company id
companyId := int32(12345)
entity := *fattureincloud.NewEntity().
SetId(1).
SetName("Mario Rossi").
SetVatNumber("RSSMRA91M20B967Q").
SetTaxCode("RSSMRA91M20B967Q").
SetAddressStreet("Via Italia, 66").
SetAddressPostalCode("20900").
SetAddressCity("Milano").
SetAddressProvince("MI").
SetCountry("Italia")
invoice := *fattureincloud.NewIssuedDocument().
SetEntity(entity).
SetType(fattureincloud.IssuedDocumentTypes.INVOICE).
SetDate("2022-01-20").
SetNumber(1).
SetNumeration("/fatt").
SetSubject("internal subject").
SetVisibleSubject("visible subject").
SetCurrency(*fattureincloud.NewCurrency().SetId("EUR")).
SetLanguage(*fattureincloud.NewLanguage().SetCode("it").SetName("italiano")).
SetItemsList([]fattureincloud.IssuedDocumentItemsListItem{
*fattureincloud.NewIssuedDocumentItemsListItem().
SetProductId(4).
SetCode("TV3").
SetName("Tavolo in legno").
SetNetPrice(100).
SetCategory("cucina").
SetDiscount(0).
SetQty(1).
SetVat(*fattureincloud.NewVatType().SetId(0)),
}).
SetPaymentsList([]fattureincloud.IssuedDocumentPaymentsListItem{
*fattureincloud.NewIssuedDocumentPaymentsListItem().
SetAmount(122).
SetDueDate("2022-01-23").
SetPaidDate("2022-01-22").
SetStatus(fattureincloud.IssuedDocumentStatuses.NOT_PAID).
SetPaymentAccount(*fattureincloud.NewPaymentAccount().SetId(110)),
}).
SetPaymentMethod(*fattureincloud.NewPaymentMethod().SetId(386683)).
SetAttachmentToken("YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw").
SetTemplate(*fattureincloud.NewDocumentTemplate().SetId(150))
// Here we put our invoice in the request object
createIssuedDocumentRequest := *fattureincloud.NewCreateIssuedDocumentRequest().SetData(invoice)
// Now we are all set for the final call
// Create the invoice: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/IssuedDocumentsApi.md#createIssuedDocument
resp, r, err := apiClient.IssuedDocumentsAPI.CreateIssuedDocument(auth, companyId).CreateIssuedDocumentRequest(createIssuedDocumentRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IssuedDocumentsAPI.CreateIssuedDocument``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
json.NewEncoder(os.Stdout).Encode(resp)
}
import it.fattureincloud.sdk.ApiClient;
import it.fattureincloud.sdk.ApiException;
import it.fattureincloud.sdk.Configuration;
import it.fattureincloud.sdk.auth.*;
import it.fattureincloud.sdk.model.*;
import it.fattureincloud.sdk.api.IssuedDocumentsApi;
import java.math.BigDecimal;
import java.time.LocalDate;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
//set your access token
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
OAuth OAuth2AuthenticationCodeFlow = (OAuth) defaultClient.getAuthentication("OAuth2AuthenticationCodeFlow");
OAuth2AuthenticationCodeFlow.setAccessToken("YOUR ACCESS TOKEN");
IssuedDocumentsApi apiInstance = new IssuedDocumentsApi(defaultClient);
//set your company id
Integer companyId = 12345;
// NOTE: this is a complete request, but please customize it!!!
// In the next step we'll explain how to perform the request to the API.
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
Entity entity = new Entity()
.id(1)
.name("Mario Rossi")
.vatNumber("47803200154")
.taxCode("RSSMRA91M20B967Q")
.addressStreet("Via Italia, 66")
.addressPostalCode("20900")
.addressCity("Milano")
.addressProvince("MI")
.country("Italy");
IssuedDocument invoice = new IssuedDocument()
.type(IssuedDocumentType.INVOICE)
.entity(entity)
.date(LocalDate.of(2022, 1, 20))
.number(1)
.numeration("/fatt")
.subject("internal subject")
.visibleSubject("visible subject")
.currency(new Currency().id("EUR"))
.language(new Language()
.code("it")
.name("italiano")
)
.addItemsListItem(
new IssuedDocumentItemsListItem()
.productId(4)
.code("TV3")
.name("Tavolo in legno")
.netPrice(BigDecimal.valueOf(100))
.category("cucina")
.discount(BigDecimal.valueOf(0))
.qty(BigDecimal.valueOf(1))
.vat(new VatType().id(0))
)
.addPaymentsListItem(
new IssuedDocumentPaymentsListItem()
.amount(BigDecimal.valueOf(122))
.dueDate(LocalDate.of(2022, 01, 23))
.paidDate(LocalDate.of(2022, 01, 22))
.status(IssuedDocumentStatus.PAID)
.paymentAccount(new PaymentAccount().id(110))
)
.paymentMethod(
new PaymentMethod().id(386683)
)
.attachmentToken("YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw")
.template(new DocumentTemplate().id(150));
// Here we put our invoice in the request object
CreateIssuedDocumentRequest createIssuedDocumentRequest = new CreateIssuedDocumentRequest()
.data(invoice);
// Now we are all set for the final call
// Create the invoice: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/IssuedDocumentsApi.md#createissueddocument
try {
CreateIssuedDocumentResponse result = apiInstance.createIssuedDocument(companyId, createIssuedDocumentRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IssuedDocumentsApi#createIssuedDocument");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
// NOTE: this is a complete request, but please customize it before trying to send it!
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
var fattureInCloudSdk = require("@fattureincloud/fattureincloud-js-sdk");
let defaultClient = fattureInCloudSdk.ApiClient.instance;
//set your access token
let OAuth2AuthenticationCodeFlow =
defaultClient.authentications["OAuth2AuthenticationCodeFlow"];
OAuth2AuthenticationCodeFlow.accessToken = "YOUR_ACCESS_TOKEN";
let apiInstance = new fattureInCloudSdk.IssuedDocumentsApi();
//set your company id
let companyId = 12345;
let entity = new fattureInCloudSdk.Entity();
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice = new fattureInCloudSdk.IssuedDocument();
invoice.type = new fattureInCloudSdk.IssuedDocumentType().invoice;
invoice.entity = entity;
invoice.date = "2022-01-20";
invoice.number = 1;
invoice.numeration = "/fatt";
invoice.subject = "internal subject";
invoice.visible_subject = "visible subject";
invoice.currency = {
id: "EUR",
};
invoice.language = {
code: "it",
name: "Italiano",
};
invoice.items_list = [
{
product_id: 4,
code: "tv3",
name: "tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
];
invoice.payments_list = [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
payment_account: {
id: 10,
},
},
];
invoice.payment_method = {
id: 386683,
};
invoice.attachment_token =
"YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw";
invoice.template = {
id: 150,
};
// Here we put our invoice in the request object
let createIssuedDocumentRequest =
new fattureInCloudSdk.CreateIssuedDocumentRequest();
createIssuedDocumentRequest.data = invoice;
let opts = {
createIssuedDocumentRequest: createIssuedDocumentRequest,
};
// Now we are all set for the final call
// Create the invoice: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/IssuedDocumentsApi.md#createIssuedDocument
apiInstance.createIssuedDocument(companyId, opts).then(
(result) => {
console.log(
"API called successfully. Returned result: " + JSON.stringify(result)
);
},
(error) => {
console.error(error);
}
);
// NOTE: this is a complete request, but please customize it before trying to send it!
// In this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
<?php
use FattureInCloud\Model\Currency;
use FattureInCloud\Model\DocumentTemplate;
use FattureInCloud\Model\Entity;
use FattureInCloud\Model\IssuedDocument;
use FattureInCloud\Model\IssuedDocumentItemsListItem;
use FattureInCloud\Model\IssuedDocumentPaymentsListItem;
use FattureInCloud\Model\IssuedDocumentStatus;
use FattureInCloud\Model\IssuedDocumentType;
use FattureInCloud\Model\CreateIssuedDocumentRequest;
use FattureInCloud\Model\Language;
use FattureInCloud\Model\PaymentAccount;
use FattureInCloud\Model\PaymentMethod;
use FattureInCloud\Model\VatType;
require_once(__DIR__ . '/vendor/autoload.php');
//set your access token
$config = FattureInCloud\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new FattureInCloud\Api\IssuedDocumentsApi(
new GuzzleHttp\Client(),
$config
);
//set your company id
$company_id = 12345;
$entity = new Entity;
$entity
->setId(1)
->setName("Mario Rossi")
->setVatNumber("47803200154")
->setTaxCode("RSSMRA91M20B967Q")
->setAddressStreet("Via Italia, 66")
->setAddressPostalCode("20900")
->setAddressCity("Milano")
->setAddressProvince("MI")
->setCountry("Italia");
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
$invoice->setEntity($entity);
$invoice->setDate(new DateTime("2022-01-20"));
$invoice->setNumber(1);
$invoice->setNumeration("/fatt");
$invoice->setSubject("internal subject");
$invoice->setVisibleSubject("visible subject");
$invoice->setCurrency(
new Currency(
array(
"id" => "EUR"
)
)
);
$invoice->setLanguage(
new Language(
array(
"code" => "it",
"name" => "italiano"
)
)
);
$invoice->setItemsList(
array(
new IssuedDocumentItemsListItem(
array(
"product_id" => 4,
"code" => "TV3",
"name" => "Tavolo in legno",
"net_price" => 100,
"category" => "cucina",
"discount" => 0,
"qty" => 1,
"vat" => new VatType(
array(
"id" => 0
)
)
)
)
)
);
$invoice->setPaymentMethod(
new PaymentMethod(
array(
"id" => 386683
)
)
);
$invoice->setPaymentsList(
array(
new IssuedDocumentPaymentsListItem(
array(
"amount" => 122,
"due_date" => new DateTime("2022-01-23"),
"paid_date" => new DateTime("2022-01-22"),
"status" => IssuedDocumentStatus::PAID,
"payment_account" => new PaymentAccount(
array(
"id" => 110
)
)
)
)
)
);
$invoice->setAttachmentToken("YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw");
$invoice->setTemplate(
new DocumentTemplate(
array(
"id" => 150
)
)
);
// Here we put our invoice in the request object
$create_issued_document_request = new CreateIssuedDocumentRequest;
$create_issued_document_request->setData($invoice);
// Now we are all set for the final call
// Create the invoice: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/IssuedDocumentsApi.md#createissueddocument
try {
$result = $apiInstance->createIssuedDocument($company_id, $create_issued_document_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling IssuedDocumentsApi->createIssuedDocument: ', $e->getMessage(), PHP_EOL;
}
import datetime
import fattureincloud_python_sdk
from fattureincloud_python_sdk.api import issued_documents_api
from fattureincloud_python_sdk.models.vat_type import VatType
from fattureincloud_python_sdk.models.currency import Currency
from fattureincloud_python_sdk.models.language import Language
from fattureincloud_python_sdk.models.entity import Entity
from fattureincloud_python_sdk.models.payment_method import PaymentMethod
from fattureincloud_python_sdk.models.payment_account import PaymentAccount
from fattureincloud_python_sdk.models.document_template import DocumentTemplate
from fattureincloud_python_sdk.models.issued_document import IssuedDocument
from fattureincloud_python_sdk.models.issued_document_type import IssuedDocumentType
from fattureincloud_python_sdk.models.issued_document_status import IssuedDocumentStatus
from fattureincloud_python_sdk.models.create_issued_document_request import CreateIssuedDocumentRequest
from fattureincloud_python_sdk.models.create_issued_document_response import CreateIssuedDocumentResponse
from fattureincloud_python_sdk.models.issued_document_items_list_item import IssuedDocumentItemsListItem
from fattureincloud_python_sdk.models.issued_document_payments_list_item import IssuedDocumentPaymentsListItem
from pprint import pprint
# set your access token
configuration = fattureincloud_python_sdk.Configuration()
configuration.access_token = "YOUR_ACCESS_TOKEN"
# set your company id
company_id = 12345
# NOTE: this is a complete request, but please customize it!!!
# In the next step we'll explain how to perform the request to the API.
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
entity = Entity(
id=1,
name="Mario Rossi",
vat_number="47803200154",
tax_code="RSSMRA91M20B967Q",
address_street="Via Italia, 66",
address_postal_code="20900",
address_city="Milano",
address_province="MI",
country="Italia"
)
invoice = IssuedDocument(
type = IssuedDocumentType("invoice"),
entity = entity,
date = datetime.date(2021, 1, 20),
number = 1,
numeration = "/fatt",
subject = "internal subject",
visible_subject = "visible subject",
currency = Currency(
id="EUR"
),
language = Language(
code="it",
name="italiano"
),
items_list = [
IssuedDocumentItemsListItem(
product_id=4,
code="TV3",
name="Tavolo in legno",
net_price=100.0,
category="cucina",
discount=0.0,
qty=1.0,
vat=VatType(
id=0
)
)
],
payments_list = [
IssuedDocumentPaymentsListItem(
amount=122.0,
due_date=datetime.date(2022, 1, 23),
paid_date=datetime.date(2022, 1, 22),
status=IssuedDocumentStatus("paid"),
payment_account=PaymentAccount(
id=110
)
)
],
payment_method = PaymentMethod(
id=386683
),
attachment_token = "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
template = DocumentTemplate(
id=150
)
)
# Here we put our invoice in the request object
create_issued_document_request = CreateIssuedDocumentRequest(
data = invoice
)
# Now we are all set for the final call
# Create the invoice: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/IssuedDocumentsApi.md#create_issued_document
with fattureincloud_python_sdk.ApiClient(configuration) as api_client:
api_instance = issued_documents_api.IssuedDocumentsApi(api_client)
try:
api_response = api_instance.create_issued_document(company_id, create_issued_document_request=create_issued_document_request)
pprint(api_response)
except fattureincloud_python_sdk.ApiException as e:
print("Exception when calling IssuedDocumentsApi->create_issued_document: %s\n" % e)
require 'time'
require 'fattureincloud_ruby_sdk'
FattureInCloud_Ruby_Sdk.configure do |config|
# set your access token
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = FattureInCloud_Ruby_Sdk::IssuedDocumentsApi.new
# set your company id
company_id = 12345
# NOTE: this is a complete request, but please customize it!!!
# In the next step we'll explain how to perform the request to the API.
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
entity = FattureInCloud_Ruby_Sdk::Entity.new(
id: 1,
name: "Mario Rossi",
vat_number: "47803200154",
tax_code: "RSSMRA91M20B967Q",
address_street: "Via Italia, 66",
address_postal_code: "20900",
address_city: "Milano",
address_province: "MI",
country: "Italia",
)
invoice = FattureInCloud_Ruby_Sdk::IssuedDocument.new(
type: FattureInCloud_Ruby_Sdk::IssuedDocumentType::INVOICE,
entity: entity,
date: Date.new(2022, 01, 20),
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: FattureInCloud_Ruby_Sdk::Currency.new(
id: "EUR"
),
language: FattureInCloud_Ruby_Sdk::Language.new(
code: "it",
name: "italiano"
),
items_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentItemsListItem.new(
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: FattureInCloud_Ruby_Sdk::VatType.new(
id: 0
)
)
),
payments_list: Array(
FattureInCloud_Ruby_Sdk::IssuedDocumentPaymentsListItem.new(
amount: 122,
due_date: Date.new(2022, 01, 23),
paid_date: Date.new(2022, 01, 22),
status: FattureInCloud_Ruby_Sdk::IssuedDocumentStatus::PAID,
payment_account: FattureInCloud_Ruby_Sdk::PaymentAccount.new(
id: 110
)
)
),
payment_method: FattureInCloud_Ruby_Sdk::PaymentMethod.new(
id: 386683
),
attachment_token: "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
template: FattureInCloud_Ruby_Sdk::DocumentTemplate.new(
id: 150
)
)
# Here we put our invoice in the request object
opts = {
create_issued_document_request: FattureInCloud_Ruby_Sdk::CreateIssuedDocumentRequest.new(data: invoice)
}
# Now we are all set for the final call
# Create the invoice: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/IssuedDocumentsApi.md#create_issued_document
begin
result = api_instance.create_issued_document(company_id, opts)
p result
rescue FattureInCloud_Ruby_Sdk::ApiError => e
puts "Error when calling IssuedDocumentsApi->create_issued_document: #{e}"
end
// NOTE: this is a complete request, but please customize it before trying to send it!
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
import {
Configuration,
IssuedDocumentsApi,
Entity,
IssuedDocument,
IssuedDocumentType,
CreateIssuedDocumentRequest,
} from "@fattureincloud/fattureincloud-ts-sdk";
//set your access token
const apiConfig = new Configuration({
accessToken: "YOUR ACCESS TOKEN",
});
let apiInstance = new IssuedDocumentsApi(apiConfig);
//set your company id
let companyId = 12345;
let entity: Entity = {};
entity.id = 1;
entity.name = "Mario Rossi";
entity.vat_number = "47803200154";
entity.tax_code = "RSSMRA91M20B967Q";
entity.address_street = "Via Italia, 66";
entity.address_postal_code = "20900";
entity.address_city = "Milano";
entity.address_province = "MI";
entity.country = "Italia";
let invoice: IssuedDocument = {
type: IssuedDocumentType.Invoice,
entity: entity,
date: "2022-01-20",
number: 1,
numeration: "/fatt",
subject: "internal subject",
visible_subject: "visible subject",
currency: {
id: "EUR",
},
language: {
code: "it",
name: "italiano",
},
items_list: [
{
product_id: 4,
code: "TV3",
name: "Tavolo in legno",
net_price: 100,
category: "cucina",
discount: 0,
qty: 1,
vat: {
id: 0,
},
},
],
payments_list: [
{
amount: 122,
due_date: "2022-01-23",
paid_date: "2022-01-22",
status: "paid",
payment_account: {
id: 10,
},
},
],
payment_method: {
id: 386683,
},
attachment_token: "YmMyNWYxYzIwMTU3N2Y4ZGE3ZjZiMzg5OWY0ODNkZDQveXl5LmRvYw",
template: {
id: 150,
},
};
// Here we put our invoice in the request object
let createIssuedDocumentRequest: CreateIssuedDocumentRequest = {
data: invoice,
};
// Now we are all set for the final call
// Create the invoice: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/IssuedDocumentsApi.md#createIssuedDocument
apiInstance.createIssuedDocument(companyId, createIssuedDocumentRequest).then(
(data) => {
console.log(data);
},
(error) => {
console.error(error);
}
);
Once you filled all the fields you need, you can click the "Continue" button and follow the wizard to create your Zap!
You just created your first invoice. Congratulations!
📬 Send the document
After you created your invoice it's time to send it to your customer, with the Schedule Email method. To do that you have 2 options:
- use your SMTP server configured in Settings -> SMTP configuration
- use our mail service setting the sender_id to 0 as shown in the examples below (the mail will result to be sent by no-reply@fattureincloud.it)
In the email body you can use 3 variables:
- {{allegati}}: adds button to download attachments
- {{logo-1}}: adds the Logo 1 image
- {{logo-2}}: adds the Logo 2 image
keep in mind that the max size of the body is 50KiB and must be HTML escaped.
POST /c/12345/issued_documents/54321/email HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: api-v2.fattureincloud.it
Content-Length: 900
{ "data": { "sender_id": 0, "recipient_email": "mariorossi@mail.com", "subject": "Nostra fattura nr. 54321", "body": "Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>", "include": { "document": true, "delivery_note": false, "attachment": false, "accompanying_invoice": false }, "attach_pdf": false, "send_copy": false } }
The corresponding code with our SDKs:
- C#
- Go
- Java
- JavaScript
- PHP
- Python
- Ruby
- TypeScript
- Zapier
using System;
using System.Collections.Generic;
using It.FattureInCloud.Sdk.Api;
using It.FattureInCloud.Sdk.Client;
using It.FattureInCloud.Sdk.Model;
namespace test {
class Program {
static void Main(string[] args) {
Configuration config = new Configuration();
//set your access token
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new IssuedDocumentsApi(config);
//set your company id
var companyId = 12345;
//set your previously created document id
var documentId = 54321;
// in this example we are using our C# SDK
// https://www.nuget.org/packages/It.FattureInCloud.Sdk/
EmailSchedule email = new EmailSchedule(
senderId: 0,
recipientEmail: "mariorossi@mail.com",
subject: "Nostra fattura nr. 54321",
body: "Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>",
include: new EmailScheduleInclude(
document: true,
deliveryNote: false,
attachment: false,
accompanyingInvoice: false
),
attachPdf: false,
sendCopy: false
);
ScheduleEmailRequest scheduleEmailRequest = new ScheduleEmailRequest(
data: email
);
// Now we are all set for the final call
// Schedule the email: https://github.com/fattureincloud/fattureincloud-csharp-sdk/blob/master/docs/IssuedDocumentsApi.md#scheduleemail
try
{
apiInstance.ScheduleEmail(companyId, documentId, scheduleEmailRequest);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling IssuedDocumentsApi.ScheduleEmail: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
}
}
}
// in this example we are using our Go SDK
// https://github.com/fattureincloud/fattureincloud-go-sdk
package main
import (
"context"
"fmt"
"os"
fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)
func main() {
//set your access token
auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "YOUR_ACCESS_TOKEN")
configuration := fattureincloudapi.NewConfiguration()
apiClient := fattureincloudapi.NewAPIClient(configuration)
//set your company id
companyId := int32(12345)
//set your company id
documentId := int32(54321)
email := *fattureincloud.NewEmailSchedule().
SetSenderId(0).
SetRecipientEmail("mariorossi@mail.com").
SetSubject("Nostra fattura nr. 54321").
SetBody("Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>").
SetInclude(*fattureincloud.NewEmailScheduleInclude().
SetDocument(true).
SetDeliveryNote(false).
SetAttachment(false).
SetAccompanyingInvoice(false),
).
SetAttachPdf(false).
SetSendCopy(false)
scheduleEmailRequest := *fattureincloud.NewScheduleEmailRequest().SetData(email)
// Now we are all set for the final call
// Schedule the email: https://github.com/fattureincloud/fattureincloud-go-sdk/blob/master/docs/IssuedDocumentsApi.md#scheduleEmail
resp, err := apiClient.IssuedDocumentsAPI.ScheduleEmail(auth, companyId, documentId).ScheduleEmailRequest(scheduleEmailRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IssuedDocumentsAPI.ScheduleEmail``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
}
}
import it.fattureincloud.sdk.ApiClient;
import it.fattureincloud.sdk.ApiException;
import it.fattureincloud.sdk.Configuration;
import it.fattureincloud.sdk.auth.*;
import it.fattureincloud.sdk.model.*;
import it.fattureincloud.sdk.api.IssuedDocumentsApi;
import java.math.BigDecimal;
import java.time.LocalDate;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// set your access token
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
OAuth OAuth2AuthenticationCodeFlow = (OAuth) defaultClient.getAuthentication("OAuth2AuthenticationCodeFlow");
OAuth2AuthenticationCodeFlow.setAccessToken("YOUR ACCESS TOKEN");
IssuedDocumentsApi apiInstance = new IssuedDocumentsApi(defaultClient);
// set your company id
Integer companyId = 12345;
// set your previously created document id
Integer documentId = 54321;
// in this example we are using our Java SDK
// https://search.maven.org/artifact/it.fattureincloud/fattureincloud-java-sdk
EmailSchedule email = new EmailSchedule()
.senderId(0)
.recipientEmail("mariorossi@mail.com")
.subject("Nostra fattura nr. 54321")
.body("Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>")
.include(
new EmailScheduleInclude()
.document(true)
.deliveryNote(false)
.attachment(false)
.accompanyingInvoice(false))
.attachPdf(false)
.sendCopy(false);
ScheduleEmailRequest scheduleEmailRequest = new ScheduleEmailRequest().data(email);
// Now we are all set for the final call
// Schedule the email: https://github.com/fattureincloud/fattureincloud-java-sdk/blob/master/docs/IssuedDocumentsApi.md#scheduleemail
try {
apiInstance.scheduleEmail(companyId, documentId, scheduleEmailRequest);
} catch (ApiException e) {
System.err.println("Exception when calling IssuedDocumentsApi#scheduleEmail");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
// in this example we are using our JS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-js-sdk
var fattureInCloudSdk = require("@fattureincloud/fattureincloud-js-sdk");
let defaultClient = fattureInCloudSdk.ApiClient.instance;
//set your access token
let OAuth2AuthenticationCodeFlow =
defaultClient.authentications["OAuth2AuthenticationCodeFlow"];
OAuth2AuthenticationCodeFlow.accessToken = "YOUR_ACCESS_TOKEN";
let apiInstance = new fattureInCloudSdk.IssuedDocumentsApi();
//set your company id
let companyId = 12345;
//set your previously created document id
let documentId = 54321;
let email = new fattureInCloudSdk.EmailSchedule();
email.sender_id = 0;
email.recipient_email = "mariorossi@mail.com";
email.subject = "Nostra fattura nr. 54321";
email.body =
"Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>";
email.include = {
document: true,
delivery_note: false,
attachment: false,
accompanying_invoice: false,
};
email.attach_pdf = false;
email.send_copy = false;
let scheduleEmailRequest = new fattureInCloudSdk.ScheduleEmailRequest();
scheduleEmailRequest.data = email;
let opts = {
scheduleEmailRequest: scheduleEmailRequest,
};
// Now we are all set for the final call
// Schedule the email: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/IssuedDocumentsApi.md#scheduleEmail
apiInstance.scheduleEmail(companyId, documentId, opts).then(
() => {
console.log("API called successfully");
},
(error) => {
console.error(error);
}
);
<?php
use FattureInCloud\Model\EmailSchedule;
use FattureInCloud\Model\ScheduleEmailRequest;
require_once(__DIR__ . '/vendor/autoload.php');
// set your access token
$config = FattureInCloud\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new FattureInCloud\Api\IssuedDocumentsApi(
new GuzzleHttp\Client(),
$config
);
// set your company id
$company_id = 12345;
// set your previously retrieved document id
$document_id = 54321;
// In this example we are using our PHP SDK
// https://packagist.org/packages/fattureincloud/fattureincloud-php-sdk
$email = new EmailSchedule(
[
"sender_id" => 0,
"recipient_email" => "mariorossi@mail.com",
"subject" => "Nostra fattura nr. 54321",
"body" => "Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>",
"include" =>
[
"document" => true,
"delivery_note" => false,
"attachment" => false,
"accompanying_invoice" => false
],
"attach_pdf" => false,
"send_copy" => false
]
);
$schedule_email_request = new ScheduleEmailRequest(["data" => $email]);
// Now we are all set for the final call
// Schedule the email: https://github.com/fattureincloud/fattureincloud-php-sdk/blob/master/docs/Api/IssuedDocumentsApi.md#scheduleemail
try {
$apiInstance->scheduleEmail($company_id, $document_id, $schedule_email_request);
} catch (Exception $e) {
echo 'Exception when calling IssuedDocumentsApi->scheduleEmail: ', $e->getMessage(), PHP_EOL;
}
import datetime
import fattureincloud_python_sdk
from fattureincloud_python_sdk.api import issued_documents_api
from fattureincloud_python_sdk.models.email_schedule import EmailSchedule
from fattureincloud_python_sdk.models.schedule_email_request import ScheduleEmailRequest
from pprint import pprint
# set your access token
configuration = fattureincloud_python_sdk.Configuration()
configuration.access_token = "YOUR_ACCESS_TOKEN"
# set your company id
company_id = 12345
# set your previously create document id
document_id = 54321
# in this example we are using our Python SDK
# https://pypi.org/project/fattureincloud-python-sdk/
email = EmailSchedule(
sender_id=0,
recipient_email="mariorossi@mail.com",
subject="Nostra fattura nr. 54321",
body="Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>",
include=EmailScheduleInclude(
document=True,
delivery_note=False,
attachment=False,
accompanying_invoice=False
),
attach_pdf=False,
send_copy=False
)
schedule_email_request = ScheduleEmailRequest(
data = email
)
# Now we are all set for the final call
# Create the invoice: https://github.com/fattureincloud/fattureincloud-python-sdk/blob/master/docs/IssuedDocumentsApi.md#schedule_email
with fattureincloud_python_sdk.ApiClient(configuration) as api_client:
api_instance = issued_documents_api.IssuedDocumentsApi(api_client)
try:
api_instance.schedule_email(company_id, document_id, schedule_email_request=schedule_email_request)
except fattureincloud_python_sdk.ApiException as e:
print("Exception when calling IssuedDocumentsApi->schedule_email: %s\n" % e)
require 'time'
require 'fattureincloud_ruby_sdk'
FattureInCloud_Ruby_Sdk.configure do |config|
# set your access token
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = FattureInCloud_Ruby_Sdk::IssuedDocumentsApi.new
# set your company id
company_id = 12345
# set your previously retrieved document id
document_id = 54321
# in this example we are using our Ruby SDK
# https://rubygems.org/gems/fattureincloud_ruby_sdk
email = FattureInCloud_Ruby_Sdk::EmailSchedule.new(
sender_id: 0,
recipient_email: "mariorossi@mail.com",
subject: "Nostra fattura nr. 54321",
body: "Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>",
include: FattureInCloud_Ruby_Sdk::EmailScheduleInclude.new(
document: true,
delivery_note: false,
attachment: false,
accompanying_invoice: false
),
attach_pdf: false,
send_copy: false
)
opts = {
schedule_email_request: FattureInCloud_Ruby_Sdk::ScheduleEmailRequest.new(data: email)
}
# Now we are all set for the final call
# Create the invoice: https://github.com/fattureincloud/fattureincloud-ruby-sdk/blob/master/docs/IssuedDocumentsApi.md#scheduleemail
begin
api_instance.schedule_email(company_id, document_id, opts)
rescue FattureInCloud_Ruby_Sdk::ApiError => e
puts "Error when calling IssuedDocumentsApi->schedule_email: #{e}"
end
// in this example we are using our TS SDK
// https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk
import {
Configuration,
IssuedDocumentsApi,
EmailSchedule,
ScheduleEmailRequest,
} from "@fattureincloud/fattureincloud-ts-sdk";
// set your access token
const apiConfig = new Configuration({
accessToken: "YOUR ACCESS TOKEN",
});
let apiInstance = new IssuedDocumentsApi(apiConfig);
// set your company id
let companyId = 12345;
// set your previously created document id
let documentId = 54321;
let email: EmailSchedule = {};
email.sender_id = 0;
email.recipient_email = "mariorossi@mail.com";
email.subject = "Nostra fattura nr. 54321";
email.body =
"Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>";
email.include = {
document: true,
delivery_note: false,
attachment: false,
accompanying_invoice: false,
};
email.attach_pdf = false;
email.send_copy = false;
let scheduleEmailRequest: ScheduleEmailRequest = {
data: email,
};
// Now we are all set for the final call
// Schedule the email: https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/master/docs/IssuedDocumentsApi.md#scheduleEmail
apiInstance.schedule(companyId, documentId, createIssuedDocumentRequest).then(
() => {
console.log("API called successfully");
},
(error) => {
console.error(error);
}
);
In this case, you'll need to use the Schedule Email Action, so it is a different action than the one used before. You can decide to add another step to your Zap or to create a new Zap with a trigger on the Invoice Creation event.
These are the fields required for this step:
Field Name | Field Code | Value | Notes |
---|---|---|---|
The ID of the company | - | 12345 | Select it from the dropdown menu |
The ID of the document | - | 54321 | The ID returned from the previous step (Trigger or Action) |
Email sender id | data.sender_id | 0 | The ID 0 indicates our mail service |
Email recipient emails | data.recipient_email | mariorossi@mail.com | |
Email subject | data.subject | Nostra fattura nr. 54321 | |
Email body | data.body | XXX | HTML escaped email body, check the request above to copy the content |
Include a button to view the document | data.include.document | true | |
Include a button to view the delivery note | data.include.delivery_note | false | |
Include a button to view the attachment | data.include.attachment | false | |
Include a button to view the accompanying invoice | data.include.accompanying_invoice | false | |
Attach the PDF of the document | data.attach_pdf | false | |
Send a copy of the email... | data.send_copy | false |
Please, remember that this request will most probably fail if executed as-is! For example, the IDs specified in the request must exist in order to avoid getting an error response! Remember to check the various methods explained in this guide to fill the request fields correctly!
🚀 Send the E-Invoice to the SDI
If the document you created is an e-invoice, you can also send it to the SDI. We created a dedicated guide to describe this operation in detail.