Create
In addition to creating a draft, 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.
The only thing that is mandatory when saving a draft is to send in items
where the total is different from 0.
1 | POST /invoices/drafts/
|
Request
HTTP/1.1 200 OK
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 | { "orderNumber": "order no", "invoiceDate": "2015-02-01", "dueDate": "2015-02-15", "orderDate": "2015-01-01", "ourReference": "ourRef", "yourReference": "yourRef", "accountNumber": "12345678901", "invoiceText": "invoice text", "deliveryDate": "2015-03-01", "deliveryAddress": { "address": "delAdd1", "zip": "delZip", "city": "delCity", "country": "delCountry" }, "recipient": { "number": 7, "customerNumber": "333", "name": "recipient", "email": "recipient@sendregning.no", "address": { "address1": "recAdd1", "address2": "recAdd2", "zip": "recZip", "city": "recCity", "country": "recCountry" }, "organisationNumber": "985420289", "icd": "9908" }, "items": [ { "number": 1, "quantity": 10, "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 } ], "originDocument" : { "type" : "OFFER", "number" : 7 }, "international": { "vatNumber": "VAT777", "exchangeRate": 9.22 } } |
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/drafts/26 |
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 | ||||
accountNumber | Originator's accountNumber. If not provided, the main account number of recipient will be used. |
String | 13 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. |
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 | |||
name | If number is null, this property will be used to create a new recipient. |
conditioned | String | 42 characters | |||
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 either on this property or on `shipment.ehf.organisationNumber` to be eligible for sending the invoice by EHF. |
conditioned | String | 9 characters | |||
ICD code for ehf sending | If number is null, this property will be used to create a new recipient.Defaults to 9908 |
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 | |||
originDocument | Document invoice originates from Either offer or order confirmation |
no | Object | ||||
number | Origin document number | yes | Integer | ||||
type | OFFER or ORDER_CONFIRMATION | yes | String |