Associare una fattura di vendita con il corrispondente pagamento

Fabio
Scritto da FabioUltimo aggiornamento 10 mesi fa

Creare la fattura

Per creare una fattura tramite API eseguire una POST su "Invoice" utilizzando l'API indicata di seguito.

API Endpoint

https://rest.reviso.com/v2/invoices/drafts

e con il seguente payload

{
"lines": [
{
"description": "Prodotto 04",
"discountPercentage": 0.00,
"lineNumber": 1,
"marginInBaseCurrency": 1000.00,
"marginPercentage": 100.00,
"product": {
"recommendedCostPrice": 0.0,
"productNumber": "04"
},
"quantity": 1.0000000000,
"sortKey": 1,
"totalNetAmount": 100.00,
"totalGrossAmount": 122.00,
"totalVatAmount": 22.00,
"unitCostPrice": 0.0000000000,
"unitNetPrice": 100.0000000000,
"manuallyEditedSalesPrice": true,
"vatInfo": {
"vatAccount": {
"vatCode": "V022"
},
"vatRate": 22.00000000
},
"movementChainId": "c7912096-81f3-42ec-8979-69bc7fad5e81"
}

],
"vatCodeGroups": [
{
"vatAccount": {
"vatCode": "V022"
},
"vatRate": 22.00000000,
"totalNetAmount": 100.00,
"totalVatAmount": 22.00,
"totalGrossAmount": 122.00
}
],
"costPriceInBaseCurrency": 0.00,
"currency": "EUR",
"deductionInfo": {
"deductionAmount": 0.00
},
"customer": {
"splitPayment": false,
"customerNumber": 1
},
"date": "2025-02-27",
"dueDate": "2025-02-27",
"exchangeRate": 100.000000,
"grossAmount": 1220.00,
//"id": 196,
"layout": {
"isDefault": false,
"layoutNumber": 9
},
"marginInBaseCurrency": 1000.00,
"marginPercentage": 100.00,
"netAmount": 1000.00,
"netAmountInBaseCurrency": 1000.00,
"numberSeries": {
"prefix": "FVL",
"allowGaps": false,
"entrySubtype": {
"entrySubtypeNumber": 10,
"entryType": "customerInvoice",
"hideInUi": false,
"isNumberSeriesCreationAllowed": true,
"isVoucherCreationAllowed": true,
"isAcrossAccountingYears": false,
"name": "Electronic Invoice"
},
"entryType": "customerInvoice",
"name": "Fattura vendita elettronica",
"peeks": [
{
"accountingYear": {
"year": "2020"
},
"nextVoucherNumber": 1
},
{
"accountingYear": {
"year": "2019"
},
"nextVoucherNumber": 1
},
{
"accountingYear": {
"year": "2018"
},
"nextVoucherNumber": 1
},
{
"accountingYear": {
"year": "2017"
},
"nextVoucherNumber": 1
}
],
"systemGenerated": false,
"isOrdered": false,
"sequenceType": "continious",
"numberSeriesNumber": 26
},
"paymentTerms": {
"daysOfCredit": 30,
"name": "30gg data fattura",
"paymentTermsType": "net",
"paymentTermsNumber": 11
},
"pdf": {
"download": "https://rest.reviso.com/v2/invoices/drafts/196/pdf"
},
"project": {
"projectNumber": 1
},
"recipient": {
"address": "Via Cliente, 10",
"attention": {
"customerContactNumber": 2
},
"city": "MILANO",
"country": "Italia",
"name": "Cliente 1",
"vatZone": {
"enabledForCustomer": true,
"enabledForSupplier": true,
"isDomestic": true,
"isExemptVatZone": false,
"isProjectAccount": false,
"name": "Domestic",
"textId": "SHARED_RECEIVABLESVATZONE_DENMARK",
"vatZoneNumber": 1
},
"zip": "20100"
},
"roundingAmount": 0.00,
"vatAmount": 220.00,
"vatIncluded": true,
"deliveryDetails": {
"deliveryStartDateTime": "2025-02-27T09:53:39Z",
"carrierInfo": {}
},
"number": 151,
"paymentType": {
"fields": [],
"paymentTypeNumber": 21
},
"priceList": {
"number": 0
},
"paymentManagementDocument": {
"paymentManagementDocumentId": 33156700
},
"salesDocumentType": "invoice",
"deliveryStatus": "notDelivered"
}

Individuare le rate collegate

Dopo aver creato la fattura, eseguire una GET su Invoice filtrando per l'"id"

dell'invoice e recuperare il "paymentManagementDocumentId".

https://rest.reviso.com/v2/invoices/drafts/<id>

Eseguire, quindi, una GET su Payment Management filtrando per il paymentManagementDocumentId trovato per recuperare le rate (idrate)collegate alla fattura.

API Endpoint

https://rest.reviso.com/payment-management/documents/<paymentManagementDocumentId>.

Questa API restituisce l'elenco delle rate legate alla fattura.


Individuare il voucherId del pagamento

Eseguire una GET su voucher filtrando per CustomerPayment per recuperare il voucherID del pagamento.

API Endpoint:

https://rest.reviso.com/vouchers/?filter=voucherType$eq:customerpayment


Individuare l'Idrate del pagamento

Eseguire una GET su Payment Management filtrando per voucherId del pagameto per individuare l'idrate corrispondente.

API Endpoint

https://rest.reviso.com/payment-management/documents?filter=voucher.id$eq:<id>


Creare l'associazione tra fattura e pagamento

Eseguire una PUT su Payment Management indicando il PaymentManagementDocumentId della fattura e l'idrate delle rate relative alla fattura.

API Endpoint

https://rest.reviso.com/payment-management/documents/paymentManagementDocumentId/rates/idrate(invoice)/matches

dove idrate è quello recuperato dalla GET su Payment Management.

Ad esempio

https://rest.reviso.com/payment-management/documents/16711300/rates/53405163/matches

Il Payload da usare è il seguente:

[ 
{
"matchedAmount":120.00,
"matchedAmountInBaseCurrency":120.00,
"targetPaymentRate":
{
"id": 53247068,
"currency": "EUR"
}
}
]

dove l'id corrisponde all'idrate del voucher


Articoli correlati

Utilizzare le APIs

Creare una fattura di vendita e modificare il metodo di pagamento sulle rate.

Creare la registrazione di una fattura e modificare il metodo di pagamento sulle rate

Questo articolo ti ha aiutato a risolvere il tuo problema?

La guida di Contabilità in Cloud

© 2026 La guida di Contabilità in Cloud. Tutti i diritti riservati.

Software della Knowledge Base di Customerly