api:invoice:current:create
Table of Contents
API : Current Invoice Create
Introduction
This request will create a new current invoice line.
Current invoice lines can contain one-time fees, recurring special services/products and auto-generated things to invoice such as porting fees, number purchase fees, initial or final invoicing of services.
Request
| URL | https://api.telecomx.dk/invoice/current | ||
|---|---|---|---|
| Method | POST | ||
| Access level | RESELLER if customer belongs to the reseller. ADMIN. |
||
| Body | customer | Id | Id of the customer the current invoice line should be added to. |
| product | Id | Id of the product to use. | |
| name | String | [optional] Overrides product name if set. |
|
| description | String | [optional] Overrides product default description if set. |
|
| units | Number | Number of units to invoice, can be negative for crediting (price is multiplied by this). | |
| unitWholesale | Number | [optional] Overrides products wholesale price if set (RESELLER/ADMIN only). |
|
| unitPrice | Number | [optional] Overrides products price if set. |
|
| start | Date | [optional] The date this should be invoiced from. Cannot be in the past, and will be auto-set to today if not provided. This is only valid for recurring products of type 'AD_HOC'. |
|
| terminate | Date | [optional] The date the product should be invoiced until in the monthly invoicing and then deleted. This is only valid for recurring products of type 'AD_HOC'. |
|
| recurrence | String | [optional] Overrides the type of recurrence: NONE, MONTHLY, QUARTERLY, YEARLY. This is only valid for recurring invoice lines of product type 'AD_HOC'. |
|
| billingCustomer | ObjectID | Other customer this line can be invoiced to. Can only be used when creating AD_HOC lines | |
Request body examples
{ customer: '1234567890ABCDEF12345678', product: '1234567890ABCDEF12345679', description: 'Servicekontrakt på PBX, inkl. backup', units: 1, unitWholesale: 475.50, unitPrice: 795.00, start: '2015-01-01T00:00:00+0100', }
{ customer: '1234567890ABCDEF12345678', product: '1234567890ABCDEF12345679', units: 5 }
Response
The response will be the newly created current invoice line, if no errors occurred.
| JSON object | ||
|---|---|---|
| _id | Id | Unique id of the invoice line. |
| customer | Id | Id of customer. |
| product._id | Id | Id of the product used. |
| product.type | String | Type of product - see more here. |
| product.productCode | String | Id to use when adding a product and for syncing with accounting system when doing invoicing. |
| product.name | String | Name of the product. |
| product.unitType | String | Type of units: MIN, MB, UNITS, HOURS, KM, MONTHS. |
| product.recurrence | String | Type of recurrence: NONE, MONTHLY, QUARTERLY, YEARLY. |
| product.recurrenceFullMonth | Boolean | If true, and the product is added mid month, customer will be invoiced for the full month otherwise the customer will be invoiced for a fraction of the month according to the start date. |
| product.cost | Number | Cost of the product for one month (if recurring) or one unit (ADMIN only). |
| product.wholesale | Number | Resellers cost for one month (if recurring) or one unit (RESELLER/ADMIN only). |
| product.price | Number | Customer price for one month (if recurring) or one unit. |
| name | String | Overrides product name if set. |
| description | String | Overrides product default description if set. |
| units | Number | Number of units to invoice, can be negative for crediting (price is multiplied by this). |
| unitCost | Number | Overrides products cost price if set (ADMIN only). |
| unitWholesale | Number | Overrides products wholesale price if set (RESELLER/ADMIN only). |
| unitPrice | Number | Overrides products price if set. |
| start | Date | The date the invoice line was added (only used by recurring products of type 'OTHER'). |
| invoicedUntil | Date | The date this invoice line has been invoiced until (only used by recurring products of type 'OTHER'). |
| terminate | Date | The date the product should be invoiced until in the monthly invoicing and then deleted. (only used by recurring products of type 'OTHER'. |
| locked | Boolean | If true this current invoice line cannot be deleted because it contains usage that cannot be returned/credited (unless you have ADMIN rights). |
| vatExempt | Boolean | True if this is exempt from VAT. |
| earliestStart | Date | If the product is reoccurring, this is the minimum date that start can be set to. It is set to the first of the current month, when the currentInvoice is created through the API. |
| recurrence | String | Overrides the type of recurrence: NONE, MONTHLY, QUARTERLY, YEARLY. This is only valid for recurring invoice lines of product type'AD_HOC'. Null if not overriden. |
| billingCustomer | ObjectID | Other customer this line can be invoiced to. Can only be used when creating AD_HOC lines |
Note that properties holding no value may be omitted from the object.
Example
{ _id: '1234567890ABCDEF12345678', customer: '123457890ABCDEF12345678', product: { _id: '123457890ABCDEF1234578', type: 'OTHER', productCode: 'SERV247', name: 'Service 24/7', unitType: 'MONTHS', recurrence: 'QUARTERLY', recurrenceFullMonth: false, cost: 100, wholesale: 125, price: 150 }, name: null, description: null, units: 6, unitCost: null, unitWholesale: 115, unitPrice: 130, start: '2015-01-12T00:00:00+0100', invoicedUntil: '2015-07-01T00:00:00+0100', terminate: null, locked: false, vatExempt: false, recurrence: null }
Errors
| Error code | Message | Description |
|---|---|---|
| 422 | units | Units must be a number and not 0 |
| 422 | unitCost | Cost unit price is invalid |
| 422 | unitWholesale | Wholesale unit price is invalid |
| 422 | unitPrice | Price pr. unit is invalid |
| 422 | customer | Customer missing or invalid |
| 422 | product | Product missing or invalid |
| 404 | customer | Customer not found |
| 404 | product | Product not found |
| 422 | terminate | Termination date must be a future date |
| 403 | access_denied | Access denied |
| 404 | billingCustomer | Billing customer not found |
| 500 | internal_error | <Unspecified> |
api/invoice/current/create.txt · Last modified: 2023/02/23 10:29 by Joakim Andersen