SendRegning

Issue and send

Verison: 1.0 (read more)

When issuing the invoice, the invoice will be persisted, receive an invoice number and entries will be created in the sales ledger.

After issuing, the invoice might be sent in the different ways requested in the json under the shipment property.

If shipment is not provided invoice will be issued only. It is allowed to select copy methods only. Note that the price for issuing an invoice is the same as the price for the cheapest shipment option available for invoices, as SendRegning’s business model is based on sending documents.

In addition to issuing and sending an invoice, there are a few other side effects that could occur:

  • A new recipient could be created. However, using an existing recipient is also possible. More details on how this works are found in the descriptions below.
  • A new product could be created. Again, you can find more details on how to achieve this effect in the details below.

You can find minimal JSON examples of how to send on email and paper here.

1
POST /invoices/

Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
    "invoiceDate": "2015-02-01",
    "dueDate": "2015-02-15",
    "orderDate": "2015-01-01",
    "deliveryDate": "2015-01-20",
    "ourReference": "our ref",
    "yourReference": "your ref",
    "orderNumber": "order no",
    "invoiceText": "invoice text",
    "recipient": {
        "number": 2,
        "customerNumber": "777",
        "name": "recipient",
        "email": "recipient@sendregning.no",
        "address": {
            "address1": "recAdd1",
            "address2": "recAdd2",
            "zip": "recZip",
            "city": "recCity",
            "country": "NORGE"
        },
        "organisationNumber": "985420289"
    },
    "items": [
        {
            "number": 1,
            "quantity": 10.11,
            "productCode": "pn",
            "description": "desc",
            "unitPrice": 12.12,
            "discount": 10,
            "taxRate": 25
        },
        {
            "number": 2,
            "quantity": 12.12,
            "productCode": "pn2",
            "description": "desc2",
            "unitPrice": 22.22,
            "discount": 20,
            "taxRate": 15
        }
    ],
    "shipment": {
      "paper": {},
      "avtaleGiro": {},
      "eFaktura": {
          "avtaleGiro": true
      },
      "email": [
          {
              "address": "testuser1@sendregning.no",
              "htmlContent": "custommessage"
          },
          {
              "address": "testuser2@sendregning.no",
              "htmlContent": "custommessage"
          }
      ],
      "ehf": {},
      "sms": [
          {
              "mobileNumber": "47111111",
              "message": "smstext1"
          },
          {
              "mobileNumber": "90091705",
              "message": "smstext1"
          }
      ],
      "copy": {
          "email": [
              {
                  "address": "copy@sendregning.no",
                  "htmlContent": "copycustommessage"
              },
              {
                  "address": "copy2@sendregning.no",
                  "htmlContent": "copy2custommessage"
              }
          ]
      }
  }
}

Response

HTTP/1.1 201 CREATED

The response contains a Location header referring to the created invoice.

e.g.

1
Location: https://www.sendregning.no/invoices/26

It’s also allowed to post an array of invoices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[
  {
      "invoiceDate": "2015-02-01",
      "dueDate": "2015-02-15",
      ...
      "items": [
          {
              "number": 1,
              "quantity": 10.11,
              "productCode": "pn",
              "description": "desc",
              "unitPrice": 12.12,
              "discount": 10,
              "taxRate": 25
          }
      ],
      "shipment": {
        "paper": {},
        ...
      }
  },
  {
    "invoiceDate": "2015-02-01",
    "dueDate": "2015-02-15",
    ...
    "items": [
        {
            "number": 2,
            "quantity": 10.11,
            "productCode": "pc2",
            "description": "desc",
            "unitPrice": 15.12,
            "discount": 10,
            "taxRate": 25
        }
    ],
    "shipment": {
      "paper": {},
      ...
    }
  }
]

In this case response code will also be 201 HTTP/1.1 201 Created but links to all created entities will be listed in response body instead of Location header.

1
2
3
4
5
[
  "https://www.sendregning.no/invoices/1",
  "https://www.sendregning.no/invoices/2"
]

Additional information

Detailed property description

Name Description Required Type Limitation
invoiceDate Invoice date.
If not provided, current date will be used.
String Valid ISO date
dueDate When the invoice is due.
If not provided,originator preference found in your account settings will be used.
String Valid ISO date
deliveryDate String Valid ISO date
orderDate String Valid ISO date
ourReference Originator's reference. String 30 characters
yourReference Recipient's reference.
If not provided, the default of the recipient will be used if exist.
If not provided and no default exist, the field on the invoice will be empty and the invoice will be ineligible for sending by EHF.
String 30 characters
orderNumber Text field on the invoice that specifies the originator's order number. String 30 characters
invoiceText This is a line that will be printed out on the invoice right above the invoice lines.
If omitted, a default text found on your account settings will be used if set.
String 105 characters
recipient Details about recipient of the invoice
This object can be used in two ways
1. Use the `number` property to reference an existing recipient.
2. Use the other property to create a new recipient when issuing the invoice.
yes Object
number The number that reference an existing recipient.
If provided, the recipient with this number will be the recipient of this invoice.
Other properties in this recipient object will be ignored
conditioned Integer
customerNumber If number is null, this property will be used to create a new recipient.
conditioned String 32 characters
email If number is null, this property will be used to create a new recipient. conditioned String 64 characters
organisationNumber If number is null, this property will be used to create a new recipient.
Organisation number must be present on this property to be eligible for sending the invoice by EHF.
conditioned String 9 characters
address If number is null, this property will be used to create a new recipient. conditioned Object
address1 If number is null, this property will be used to create a new recipient. conditioned String 42 characters
address2 If number is null, this property will be used to create a new recipient. conditioned String 42 characters
zip If number is null, this property will be used to create a new recipient. conditioned String 8 characters
city If number is null, this property will be used to create a new recipient. conditioned String 36 characters
country If number is null, this property will be used to create a new recipient. conditioned String 42 characters
items Details of the invoice.
Maximum 18 items allowed for Norwegian invoices and 34 for international invoices
yes Array
number A unique number defining where in the order the item belong.
If omitted, a number will given based on where the item is in the array.
If the number is omitted from one item, then the number must be omitted from all items and vice versa.
Integer Between 1-18 for Norwegian invoices and 34 for international invoices
quantity Quantity is used together with the unit price to find the line total, which means that (quantity * unit price) - discount + VAT is equal to the line total, which in this case is 2109.38.
Quantity can only be omitted if unit price is omitted.
Number 6 characters, including punctuation marks and signs. Can't be negative.
productCode Used to distinguish between the various products that are invoiced, this means that you can run reports in the meantime that tell how much you have invoiced of a given product. A product will be created in the product list when specifying a product code. If it already exists a product with this product code, the product will NOT be updated. String 9 characters
description Describes the service/goods you are invoicing. This property can also be used for extra information that there isn't space for elsewhere. If this is the only element in a line that contains data, only this text will be printed out on the line. String 75 characters
unitPrice Unit price is used together with the quantity to find the line total, which means that (quantity * unit price) - discount + VAT is equal to the line total, which in this case is 2109.38.
Unit price can only be omitted if quantity is omitted.
Number 9 characters, including punctuation marks and signs
discount A valid value for this element is a decimal number from 0 to 100. Note that the % sign must NOT be included and will generate an error message.
If no items contain a discount, the discount column will be hidden on the invoice.
Number 5 characters, including punctuation marks. Must be >= 0 and <= 100
taxRate This rate can be changed by the authorities and will be automatically updated by SendRegning.no.
The tax rate must be a valid tax rate.
yes Integer 2 characters
shipment Contains the shipment options wanted.
One or more of the different options can be chosen.
You add the options you want by adding the associated property.
no Object
paper Shipment on paper
If object is empty, address specified on recipient will be used.
To use another address, specify it by using the address properties.
Object
address1 conditioned String 42 characters
address2 conditioned String 42 characters
zip If paper object is not empty, then this field is mandatory. conditioned String 8 characters
city If paper object is not empty, then this field is mandatory. conditioned String 36 characters
country If paper object is not empty, then this field is mandatory. conditioned String 42 characters
ehf Shipment as EHF. Empty object Object
avtaleGiro Shipment as avtaleGiro. Object
eFaktura Shipment as efaktura. Object
avtaleGiro Defines whether avtaleGiro is to be used as well. boolean
mobileNumber Recipient mobile number. string
email List of emails objects Array
address Email address of the receiver of this invoice. yes String 64 characters
htmlContent Message that will be used in the email sent. String 120 characters
sms List of sms objects Array
mobileNumber A valid mobileNumber to send the invoice to. yes String 8 characters
message A message that will be added along the link. yes String 140 characters
copy Copy shipment options Object
email List of emails objects Array
address Email address of the receiver of this invoice. yes String 64 characters
htmlContent Message that will be used in the email sent. String 120 characters

Minimal JSON for sending on email

An example of the minimal JSON you can use for sending an invoice on email.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
	"recipient": {
		"name": "Ola Nordmann",
		"address": {
			"zip": "2050",
			"city": "Jessheim"
		}
	},
	"items": [{
		"quantity": 10,
		"description": "Consultant hours",
		"unitPrice": 1200
	}],
	"shipment": {
		"email": [{
			"address": "ola@nordmann.no"
		}]
	}
}

Minimal JSON for sending on paper

An example of the minimal JSON you can use for sending an invoice on paper.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
	"recipient": {
		"name": "Ola Nordmann",
		"address": {
			"zip": "2050",
			"city": "Jessheim"
		}
	},
	"items": [{
		"quantity": 10,
		"description": "Consultant hours",
		"unitPrice": 1200
	}],
	"shipment": {
	    "paper": {}
	}
}