Skip to content

Create Sales Invoice


Endpoints v1

https://app.passelimerit.fi/api/v1/sendinvoice

NOTE:

V2 should be used when willow dimensions ase used.

Query Payload

PHP example with sending

json
{
  "Customer": {
    "Name": "FirstCustomer Inc",
    "RegNo": "1122334755",
    "NotTDCustomer": false,
    "VatRegNo": "11222344",
    "CurrencyCode": "EUR",
    "PaymentDeadLine": 7,
    "OverDueCharge": 0,
    "RefNoBase": 1,
    "Address": "Merimiehenkatu 31",
    "CountryCode": "FI",
    "County": "Finland",
    "City": "Helsinki",
    "PostalCode": "",
    "PhoneNo": "6548765",
    "PhoneNo2": "",
    "HomePage": "",
    "Email": "customermail@gmail.com"
  },
  "DocDate": "20170113131239",
  "DueDate": "20170125131239",
  "InvoiceNo": "123",
  "RefNo": "1232",
  "DepartmentCode": "",
  "ProjectCode": "",
  "InvoiceRow": [
    {
      "Item": {
        "Code": "1234567",
        "Description": "Bag of goldflakes",
        "Type": 3,
        "UOMName": "kg"
      },
      "Quantity": 2.00,
      "Price": 1000.00,
      "DiscountPct": 0,
      "DiscountAmount": 0.00,
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "LocationCode": "1"
    }
  ],
  "TotalAmount": 2000.00,
  "RoundingAmount": 0.00,
  "TaxAmount": [
    {
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "Amount": 400.00
    }
  ],
  "Payment": {
    "PaymentMethod": "Nordea",
    "PaidAmount": "100",
    "PaymDate": "20190413202154"
  },
  "HComment": "",
  "FComment": ""
}
Click to see the Query Payload parameters
FieldTypeCommentRequired
CustomerCustomerObject
AccountingDocInt 11 - faktura,
2 - rachunek,
3 - paragon,
4 - nodoc,
5 - credit,
6 - prepinvoice,
7 - fincchrg,
8 - delivorder,
9 - grpinv
ProcCodesArray of StringsPoland only. SW, EE, TP, TT_WNT, TT_D, MR_T, MR_UZ, I_42, I_63, B_SPV, B_SPV_DOSTAWA, B_MRV_PROWIZJA, MPP
PolDocTypeIntPoland only.
1 - RO,
2 - WEW,
3 - FP,
4 - OJPK
DocDateDate
DueDateDate
TransactionDateDate
InvoiceNoStr 35Required
RefNoStr 36If not specified, generated automatically. Please validate this number yourself.
CurrencyCodeStr 4
DepartmentCodeStr 20If used then must be found in the company database.
ProjectCodeStr 20If used then must be found in the company database.
InvoiceRowArray of InvoiceRow objects
TaxAmountArray of VAT objectsRequired
RoundingAmountDecimal 18.2Use it for getting PDF invoice to round number. Does not affect TotalAmount.
TotalAmountDecimal 18.2Amount without VAT
PaymentPayment object
HcommentStr 4KIf not specified, API will get it from client record, if it is written there.
FcommentStr 4KIf not specified, API will get it from client record, if it is written there.
ContractNoStr 35Contract number with operator
PDFStr 4KPdf file in Base64 format

CustomerObject

3 use cases:

  1. new customer – you will create new client record when this name was not found
  2. existing customer by name – if this name exists in our system, Merit will take info from client record instead of reading it from the payload.
  3. customer by ID – every time you add new customer, the CustomerId is returned, you can use this ID instead of name, the object = { CustomerId: <guid-of-the-customer> }.
json
{
  "Customer": {
    "Name": "FirstCustomer Inc",
    "RegNo": "1122334755",
    "NotTDCustomer": false,
    "VatRegNo": "11222344",
    "CurrencyCode": "EUR",
    "PaymentDeadLine": 7,
    "OverDueCharge": 0,
    "RefNoBase": 1,
    "Address": "Merimiehenkatu 31",
    "CountryCode": "FI",
    "County": "Finland",
    "City": "Helsinki",
    "PostalCode": "",
    "PhoneNo": "6548765",
    "PhoneNo2": "",
    "HomePage": "",
    "Email": "customermail@gmail.com"
  },
}
Click to see the CustomerObject parameters
ParameterTypeCommentRequired
IdGuidIf filled and customer is found in the database then following fields are not important. If not found, the customer is added using the following fields.
NameStr 150Required when customer is added
RegNoStr 30
NotTDCustomerBool- EE True for physical persons and foreign companies.

- PL True for physical persons. Allowed "true" or "false" (lowercase).
Required, when adding a new customer
VatRegNoStr 30
CurrencyCodeStr 30
PaymentDeadLineIntIf missing then taken from default settings.
OverDueChargeDecimal 5.2If missing then taken from default settings.
AddressStr 100
CityStr 30
CountyStr 100
PostalCodeStr 15
CountryCodeStr 2Required, when adding a new customer
PhoneNoStr 50
PhoneNo2Str 50
HomePageStr 80
EmailStr 80
SalesInvLangStr 8Invoice language for this specific customer. (ET, EN, RU,FI,PL,SV)
RefNoBaseStr 36
EInvPaymIdStr 20
EInvOperatorInt1 - Doesn't exist,
2 - E-invoices to the bank through Omniva,
3 - Bank ( full extent E-invoice),
4 - Bank (limited extent E-invoice)
BankAccountStr 50
ContactStr 35
ApixEinvStr 20
GroupInvBool

InvoiceRowObject

Every invoice has its rows. Row has its quantity and price, it also has its general ledger record and that's why it has its own tax calculation.

json
{
  "InvoiceRow": [
    {
      "Quantity": 2.00,
      "Price": 1000.00,
      "DiscountPct": 0,
      "DiscountAmount": 0.00,
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "LocationCode": "1"
    }
  ],
}
Click to see the InvoiceRowObject parameters
FieldTypeCommentRequired
ItemItemObjectSometimes the volume of transactions in the sales software is very high and there is no need to duplicate all the data in accounting. In those cases, you could consider using the same item code for the items with the same VAT rate. Items with different VAT rates must have a different item codes. Also, for the VAT declarations to work, goods and services may not be summed up and must have different item codes.
QuantityDecimal 18.3
PriceDecimal 18.7
DiscountPctDecimal 18.2
DiscountAmountDecimal 18.2Amount * Price * (DiscountPCt / 100). This is not rounded. Will be subtracted from row amount before row roundings.
TaxIdGuidUse gettaxes endpoint to detect the guid neededRequired
LocationCodeStr 20Used for stock items and multiple stocks. If used then must be found in the company database.
DepartmentCodeStr 20If used then must be found in the company database.
ItemCostAmountDecimal 18.2Required for credit invoices when crediting stock items.
GLAccountCodeStr 10If used, must be found in the company database.
ProjectCodeStr 20If used, must be found in the company database.
CostCenterCodeStr 20If used, must be found in the company database.
VatDateDate StrYYYYMMDD type date. In some countries where you have to specify VatDate.

ItemObject

json
{
  "InvoiceRow": [
    {
      "Item": {
        "Code": "1234567",
        "Description": "Bag of goldflakes",
        "Type": 3,
        "UOMName": "kg"
      },
      // ...
    }
  ],
}
Click to see the ItemObject parameters
FieldTypeCommentRequired
CodeStr 20Required
DescriptionStr 100Required
TypeInt1 - stock item,
2 - service,
3 - item.
Required
UOMNameStr 64Name for the unit
DefLocationCodeStr 20If company has more than one (default) stock, stock code in this field is required for all stock items.
GTUCodeIntPoland only, values: 1-13

PaymentObject

You can mark the invoice already paid. This is useful when you create invoice only when internet bank payment is successful, or you have received cash.

json
{
  "Payment": {
    "PaymentMethod": "Nordea",
    "PaidAmount": "100",
    "PaymDate": "20190413202154"
  },
}
Click to see the PaymentObject parameters
FieldTypeComment
PaymentMethodStr 150Name of the payment method. Must be found in the company database.
PaidAmountDecimal 18.2Amount with VAT (not more) or less if partial payment
PaymDateDateYYYYmmddHHii

TaxObject

Every invoice has section of taxes. Those taxes have to be calculated grouped and summed by TaxId. Every row has its own tax calculation, you have to group and sum them up.

This is because you can have different tax rates for different articles.

API always counts it as well to assure you have correct calculation.

json
{
  "TaxAmount": [
    {
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "Amount": 400.00
    }
  ],
}
Click to see the TaxObject parameters
FieldTypeCommentRequired
TaxIdGuidUse gettaxes endpoint to detect the guid neededRequired
AmountDecimal 18.2

Endpoints v2

https://app.passelimerit.fi/api/v2/sendinvoice

Query Payload

json
{
  "Customer": {
    "Name": "FirstCustomer Inc",
    "RegNo": "1122334755",
    "NotTDCustomer": false,
    "VatRegNo": "11222344",
    "CurrencyCode": "EUR",
    "PaymentDeadLine": 7,
    "OverDueCharge": 0,
    "RefNoBase": 1,
    "Address": "Merimiehenkatu 31",
    "CountryCode": "FI",
    "County": "Finland",
    "City": "Helsinki",
    "PostalCode": "",
    "PhoneNo": "6548765",
    "PhoneNo2": "",
    "HomePage": "",
    "Email": "customermail@gmail.com"
  },
  "DocDate": "20170113131239",
  "DueDate": "20170125131239",
  "InvoiceNo": "123",
  "RefNo": "1232",
  "DepartmentCode": "",
  "ProjectCode": "",
  "OurReference": "ABC",
  "YourReference": "CDE",
  "InvoiceRow": [
    {
      "Item": {
        "Code": "1234567",
        "Description": "Bag of goldflakes",
        "Type": 3,
        "UOMName": "kg"
      },
      "Quantity": 2.00,
      "Price": 1000.00,
      "DiscountPct": 0,
      "DiscountAmount": 0.00,
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "LocationCode": "1"
    }
  ],
  "TotalAmount": 2000.00,
  "RoundingAmount": 0.00,
  "TaxAmount": [
    {
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "Amount": 400.00
    }
  ],
  "Payment": {
    "PaymentMethod": "testaus",
    "PaidAmount": "100",
    "PaymDate": "20190413202154"
  },
    "Dimensions": [
    {
      "DimId": 2,
      "DimValueId": "7fc5f7f0-0537-4d64-b4cc-a8647bd217ac",
      "DimCode": "hfif"
    }
  ],
  "HComment": "",
  "FComment": "",
  "Payer": {
    "Name": "FirstCustomer Inc",
    "RegNo": "1122334755",
    "NotTDCustomer": false,
    "VatRegNo": "11222344",
    "CurrencyCode": "EUR",
    "PaymentDeadLine": 7,
    "OverDueCharge": 0,
    "RefNoBase": 1,
    "Address": "Merimiehenkatu 31",
    "CountryCode": "FI",
    "County": "Finland",
    "City": "Helsinki",
    "PostalCode": "",
    "PhoneNo": "6548765",
    "PhoneNo2": "",
    "HomePage": "",
    "Email": "",
    "SalesInvLang": "EN",
    "Contact": "",
    "GLNCode": "",
    "PartyCode": "",
    "EInvOperator": 1,
    "EInvPaymId": "",
    "BankAccount": "",
    "Dimensions": [],
    "CustGrCode": "",
    "ShowBalance": false
  }
}
Click to see the Query Payload parameters
FieldTypeCommentRequired
CustomerCustomerObject
AccountingDocInt 11 - faktura,
2 - rachunek,
3 - paragon,
4 - nodoc,
5 - credit,
6 - prepinvoice,
7 - fincchrg,
8 - delivorder,
9 - grpinv
DocDateDate
DueDateDate
TransactionDateDate
InvoiceNoStr 35Required
CurrencyCodeStr 4
CurrencyRateDecimal 18.7If the exchange rate is not included, we will take it from the EU central bank's request for the respective date
DepartmentCodeStr 20If used then must be found in the company database.
DimensionsArray of Dimensions objects
InvoiceRowArray of InvoiceRow objects
TaxAmountArray of VAT objectsRequired
RoundingAmountDecimal 18.2Use it for getting PDF invoice to round number. Does not affect TotalAmount.
TotalAmountDecimal 18.2Amount without VAT
PaymentPayment object
RefNoStr 36If not specified, generated automatically. Please validate this number yourself.
HcommentStr 4KIf not specified, API will get it from client record, if it is written there.
FcommentStr 4KIf not specified, API will get it from client record, if it is written there.
ReserveItemsBool
ContractNoStr 35Contract number with operator
PDFStr 4KPdf file in Base64 format
FileNameStr 100Name of PDF file
PayerPayerObject
DeliveryTypeBool
OurReferenceStr 70
YourReferenceStr 70

CustomerObject

3 use cases:

  1. new customer – you will create new client record when this name was not found
  2. existing customer by name – if this name exists in our system, Merit will take info from client record instead of reading it from the payload
  3. customer by ID – every time you add new customer, the CustomerId is returned, you can use this ID instead of name, the object = { CustomerId: <guid-of-the-customer> }.
json
{
  "Customer": {
    "Name": "FirstCustomer Inc",
    "RegNo": "1122334755",
    "NotTDCustomer": false,
    "VatRegNo": "11222344",
    "CurrencyCode": "EUR",
    "PaymentDeadLine": 7,
    "OverDueCharge": 0,
    "RefNoBase": 1,
    "Address": "Merimiehenkatu 31",
    "CountryCode": "FI",
    "County": "Finland",
    "City": "Helsinki",
    "PostalCode": "",
    "PhoneNo": "6548765",
    "PhoneNo2": "",
    "HomePage": "",
    "Email": "customermail@gmail.com"
  },
}
Click to see the CustomerObject parameters
FieldTypeCommentRequired
IdGuidIf filled and customer is found in the database then following fields are not important. If not found, the customer is added using the following fields.
NameStr 150Required, when a new customer is added.
RegNoStr 30
NotTDCustomerBool- EE True for physical persons and foreign companies.

- PL True for physical persons. Allowed "true" or "false" (lowercase).
Required, when a new customer is added.
VatRegNoStr 30
CurrencyCodeStr 30
PaymentDeadLineIntIf missing then taken from default settings.
OverDueChargeDecimal 5.2If missing then taken from default settings.
RefNoBaseStr 36
AddressStr 100
CountryCodeStr 2Required, when a new customer is added.
CountyStr 100
CityStr 30
PostalCodeStr 15
PhoneNoStr 50
PhoneNo2Str 50
HomePageStr 80
EmailStr 80
SalesInvLangStr 8Invoice language for this specific customer.(ET,EN,RU,FI,PL,SV)
ContactStr 35
GLNCodeStr 10
PartyCodeStr 20
EInvOperatorInt1 - Not exist,
2 - E-invoices to the bank through Omniva,
3 - Bank (full extent E-invoice),
4 - Bank (limited extent E-invoice)
EInvPaymIdStr 20
BankAccountStr 50
DimensionsArray of DimensionsObjects
CustGrCodeStr 20
ShowBalanceBool
ApixEinvStr 20
GroupInvBool

InvoiceRowObject

Every invoice has its rows. Row has its quantity and price, it also has its general ledger record and that's why it has its own tax calculation.

json
{
  "InvoiceRow": [
    {
      "Quantity": 2.00,
      "Price": 1000.00,
      "DiscountPct": 0,
      "DiscountAmount": 0.00,
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "LocationCode": "1"
    }
  ],
}
Click to see the InvoiceRowObject parameters
FieldTypeCommentRequired
ItemItemObjectSometimes the volume of transactions in the sales software is very high and there is no need to duplicate all the data in accounting. In those cases, you could consider using the same item code for the items with the same VAT rate. Items with different VAT rates must have different item codes. Also, for the VAT declarations to work, goods and services may not be summed up and must have different item codes.
QuantityDecimal 18.3
PriceDecimal 18.7
DiscountPctDecimal 18.2
DiscountAmountDecimal 18.2Amount * Price * (DiscountPCt / 100). This is not rounded. Will be substracted from row amount before row roundings.
TaxIdGuidUse gettaxes endpoint to detect the guid neededRequired
LocationCodeStr 20Used for stock items and multiple stocks. If used then must be found in the company database.
DepartmentCodeStr 20If used then must be found in the company database.
GLAccountCodeStr 10If used, must be found in the company database.
DimensionsArray of DimensionsObjects
ItemCostAmountDecimal 18.2Required for credit invoices when crediting stock items.
VatDateDate StrYYYYMMDD type date. In some countries where you have to specify VatDate.
SalesAccCodeStr 10If included GLAccountCode then the SalesAccCode not used
PurchaseAccCodeStr 10
InventoryAccCodeStr 10
CostAccCodeStr 10

ItemObject

json
{
  "InvoiceRow": [
    {
      "Item": {                             
        "Code": "1234567",                  
        "Description": "Bag of goldflakes", 
        "Type": 3,                          
        "UOMName": "kg"                     
      },                                    
      // ...
    }
  ],
}
Click to see the ItemObject parameters
FieldTypeCommentRequired
CodeStr 20Required
DescriptionStr 100Required
TypeInt1 - stock item,
2 - service,
3 - item.
Required
UOMNameStr 64Name for the unit
DefLocationCodeStr 20If company has more than one (default) stock, stock code in this field is required for all stock items.

PaymentObject

You can mark the invoice already paid. This is useful when you create invoice only when internet bank payment is successful, or you have received cash

json
{
  "Payment": {
    "PaymentMethod": "Swedbank",
    "PaidAmount": "100",
    "PaymDate": "20190413202154"
  },
}
Click to see the PaymentObject parameters
FieldTypeCommentRequired
PaymentMethodStr 150Name of the payment method. Must be found in the company database.
PaidAmountDecimal 18.2Amount with VAT (not more) or less if partial payment
PaymDateDateYYYYmmddHHii

TaxObject

Every invoice has section of taxes. Those taxes have to be calculated grouped and summed by TaxId. Every row has its own tax calculation, you have to group and sum them up.

This is because you can have different tax rates for different articles.

API always counts it as well to assure you have correct calculation.

json
{
  "TaxAmount": [
    {
      "TaxId": "b9b25735-6a15-4d4e-8720-25b254ae3d21",
      "Amount": 400.00
    }
  ],
}
Click to see the TaxObject parameters
FieldTypeCommentRequired
TaxIdGuidUse gettaxes endpoint to detect the guid neededRequired
AmountDecimal 18.2

DimensionsObject

json
{
  // ...
  "Dimensions": [
    {
      "DimId": 1,
      "DimValueId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
      "DimCode": "123"
    }
  ],
  // ...
}
Click to see the DimensionsObject parameters
FieldTypeCommentRequired
DimIdInt
DimValueIdGuid
DimCodeStr

PayerObject

json
{
  // ...
  "Payer": {
    "Name": "FirstCustomer Inc",
    "RegNo": "1122334755",
    "NotTDCustomer": false,
    "VatRegNo": "11222344",
    "CurrencyCode": "EUR",
    "PaymentDeadLine": 7,
    "OverDueCharge": 0,
    "RefNoBase": 1,
    "Address": "Merimiehenkatu 31",
    "CountryCode": "FI",
    "County": "Finland",
    "City": "Helsinki",
    "PostalCode": "",
    "PhoneNo": "6548765",
    "PhoneNo2": "",
    "HomePage": "",
    "Email": "",
    "SalesInvLang": "EN",
    "Contact": "",
    "GLNCode": "",
    "PartyCode": "",
    "EInvOperator": 1,
    "EInvPaymId": "",
    "BankAccount": "",
    "Dimensions": [],
    "CustGrCode": "",
    "ShowBalance": false
  }
}
Click to see the PayerObject parameters
FieldTypeCommentRequired
IdGuidIf filled and payer (customer) is found in the database then following fields are not important. If not found, the payer is added using the following fields.
NameStr 150Required, when adding a new payer
RegNoStr 30
NotTDCustomerBoolTrue for physical persons and foreign companies. Allowed "true" or "false" (lowercase).Required, when adding a new payer
VatRegNoStr 30
CurrencyCodeStr 30
PaymentDeadLineIntIf missing then taken from default settings.
OverDueChargeDecimal 5.2If missing then taken from default settings.
RefNoBaseStr 36
AddressStr 100
CountryCodeStr 2Required, when adding a new payer
CountyStr 100
CityStr 30
PostalCodeStr 15
PhoneNoStr 50
PhoneNo2Str 50
HomePageStr 80
EmailStr 80
SalesInvLangStr 8Invoice language for this specific payer.(ET,EN,RU,FI,PL,SV)
ContactStr 35
GLNCodeStr 10
PartyCodeStr 20
EInvOperatorInt1 - Not exist,
2 - E-invoices to the bank through Omniva,
3 - Bank (full extent E-invoice),
4 - Bank (limited extent E-invoice)
EInvPaymIdStr 20
BankAccountStr 50
DimensionsArray of DimensionsObject
CustGrCodeStr 20
ShowBalanceBool

Successful Result

json
{
  "CustomerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
  "InvoiceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "InvoiceNo": "BL942019-PGG",
  "RefNo": "xxxxxxx",
  "NewCustomer": null
}