My Products
Help
Margarita G
CONTRIBUTOR **

API - Purchase Credit Note Issue

by Margarita G

Hi, 

 

We have tried to create a Supplier Invoice type DebitAdj (Purchase Credit Note) through POST service API (/controller/api/v1/supplierInvoicebut we can’t , we have sending request  according with api documentation. 

 

This is our test scenery: 

 

  • This is the Json request we sent: 

 

 

{"documentTypeId": 

    {"value":"DebitAdj"}, 

"supplierNumber": 

    {"value":"49998"}, 

"supplierReference": 

    {"value":"Tollvesenetinnførselsmva (Alti"}, 

"referenceNumber": 

    {"value":""}, 

"paymentRefNo": 

    {"value":""}, 

"currencyId": 

    {"value":"NOK"}, 

"postPeriod": 

     {"value":"082020"}, 

"description": 

    {"value":""}, 

"date": 

    {"value":"2020-08-20"}, 

"invoiceLines":[ 

        {"subaccount":[ 

            {"segmentId":1,"segmentValue":"100"}, 

            {"segmentId":2,"segmentValue":"3000"}], 

        "transactionDescription":{"value":""}, 

        "operation":"Insert", 

        "vatCodeId":{"value":"88"}, 

        "accountNumber":{"value":"4300"}, 

        "costInCurrency":{"value":1000}} 

    ] 

} 

 

  • This is the Json Response where you can see that the created invoice has an invalid document type “” 
 
 
 

img1.jpg

 

Json Response 

 

{ 

    "taxDetailLines": [ 

        { 

            "taxId": "17L", 

            "vatRate": 20.000000, 

            "taxableAmount": 1000.0000, 

            "vatAmount": 200.0000 

        } 

    ], 

    "invoiceLines": [ 

        { 

            "lineNumber": 1, 

            "transactionDescription": "", 

            "quantity": 0.000000, 

            "unitCost": 0.000000, 

            "unitCostInCurrency": 0.000000, 

            "cost": 1000.0000, 

            "costInCurrency": 1000.0000, 

            "discountPercent": 0.000000, 

            "discountAmount": 0.0000, 

            "discountAmountInCurrency": 0.0000, 

            "manualDiscount": false, 

            "account": { 

                "type": "Expense", 

                "number": "4300", 

                "description": "Innkj. varer for videresalg" 

            }, 

            "subaccount": { 

                "subaccountNumber": "1003000", 

                "subaccountId": 128, 

                "description": "None", 

                "lastModifiedDateTime": "2020-08-05T15:13:15.643", 

                "active": true, 

                "segments": [ 

                    { 

                        "segmentId": 1, 

                        "segmentDescription": "Avdeling", 

                        "segmentValue": "100", 

                        "segmentValueDescription": "Norway" 

                    }, 

                    { 

                        "segmentId": 2, 

                        "segmentDescription": "Prosjekt", 

                        "segmentValue": "3000", 

                        "segmentValueDescription": "Send" 

                    } 

                ] 

            }, 

            "vatCode": { 

                "id": "88", 

                "description": "Tjenester kjøpt fra utlandet med fradrag for mva. lav sats" 

            }, 

            "branchNumber": { 

                "number": "1", 

                "name": "Compello AS #ISV" 

            }, 

            "note": "", 

            "project": { 

                "id": "X", 

                "description": "Non-Project Code." 

            }, 

            "attachments": [], 

            "retainagePct": 0.000000, 

            "curyRetainageAmt": 0.0000 

        } 

    ], 

    "hold": false, 

    "exchangeRate": 1.00000000, 

    "paymentRefNo": "", 

    "creditTerms": { 

        "id": "18D", 

        "description": "18. dennemåned" 

    }, 

    "retainageApply": false, 

    "cashDiscountDate": "2020-09-18T00:00:00", 

    "detailTotal": 1000.0000, 

    "detailTotalInCurrency": 1000.0000, 

    "discountTotal": 0.0000, 

    "discountTotalInCurrency": 0.0000, 

    "vatTaxableTotal": 0.0000, 

    "vatTaxableTotalInCurrency": 0.0000, 

    "vatExemptTotal": 0.0000, 

    "vatExemptTotalInCurrency": 0.0000, 

    "withholdingTax": 0.0000, 

    "withholdingTaxInCurrency": 0.0000, 

    "roundingDiff": 0.0000, 

    "roundingDiffInCurrency": 0.0000, 

    "taxCalculationMode": "TaxSetting", 

    "supplierTaxZone": { 

        "id": "14", 

        "description": "Innførsel avgiftspliktig (Tollverket - Altinn)", 

        "defaultVatCategory": "81" 

    }, 

    "paySelected": false, 

    "curyRetainageTotal": 0.0000, 

    "curyRetainageUnreleasedAmt": 0.0000, 

    "supplier": { 

        "number": "49998", 

        "name": "Tollvesenetinnførselsmva (Altinn)" 

    }, 

    "documentType": "Invoice", 

    "referenceNumber": "200129", 

    "postPeriod": "082020", 

    "financialPeriod": "202008", 

    "date": "2020-08-20T00:00:00", 

    "origInvoiceDate": "2020-08-20T00:00:00", 

    "dueDate": "2020-09-18T00:00:00", 

    "status": "Balanced", 

    "currencyId": "NOK", 

    "balance": 800.0000, 

    "balanceInCurrency": 800.0000, 

    "cashDiscount": 0.0000, 

    "cashDiscountInCurrency": 0.0000, 

    "paymentMethod": { 

        "id": "1", 

        "description": "Innlandsbetalinger" 

    }, 

    "supplierReference": "Tollvesenetinnførselsmva (Alti", 

    "description": "", 

    "createdDateTime": "2020-08-20T18:20:19.263", 

    "lastModifiedDateTime": "2020-08-20T18:20:19.263", 

    "note": "", 

    "location": { 

        "countryId": "NO", 

        "id": "MAIN", 

        "name": "Primary Location" 

    }, 

    "vatTotal": -200.0000, 

    "vatTotalInCurrency": -200.0000, 

    "branchNumber": { 

        "number": "1", 

        "name": "Compello AS #ISV" 

    }, 

    "payDate": "2020-09-15T00:00:00", 

    "cashAccount": "1920", 

    "metadata": { 

        "totalCount": 1, 

        "maxPageSize": 500 

    } 

} 

 

This is the increate invoice on visma system with invalid  document type.  

 img2.jpg

 

 

 

 

 

Could you help us? 

 

Best Regards. 

Margarita G

1 REPLY 1
Accepted solution
Yıldırım
VISMA

by Yıldırım (Updated ‎21-08-2020 13:15 by Yıldırım VISMA )

Hello, 


in your JSON, supplierInvoice"documentType" Key had been sent with wrong syntax. 

 

{
  "documentTypeId": {
	"value": "DebitAdj"
	},
....
...
..
}

 

 

Key should be sent as, 

 

{
  "documentType": {
    "value": "DebitAdj"
  },

 


Please correct this and retry the operation.
(Visma.net API Documentation : https://integration.visma.net/API-index/ )