Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

This method is creating a new invoice either in Draft or Posted state

Resource URL

http://host_name/crmapi/rest/

...

v2/invoices/create


Parameters

Name

Type

Description

token

String

The token retrieved from the login method

accounts_receivable_identifier

(mandatory)

Accounts receivable identifier  

The identifier of the accounts receivable in which the invoice should be allocated to. The allowed accounts receivable identifier fields are the following:

Include Page
V4:accounts_receivable_identifier
V4:accounts_receivable_identifier

type_identifier

(mandatory)

Financial transaction type identifier

The financial transaction type of the invoice. The allowed financial transaction type identifier field are the following:

Include Page
V4:financial_transaction_type_identifier
V4:financial_transaction_type_identifier

life_cycle_state

(mandatory)

String

The state of the retrieved invoice which can be one of the following:

DRAFT, POSTED

category_identifier

(optional)

Financial transaction category identifier

The financial transaction category of the invoice that should be returned as a result. The allowed financial transaction category identifier fields are the following:

Include Page
V4:financial_transaction_category_identifier
V4:financial_transaction_category_identifier

member_accounts_receivable_identifier

(optional)

Accounts Receivable IdentifierThe member accounts receivable. Applicable only if the Invoice is issued against a parent accounts receivable within a group which funds its members. The allowed accounts receivable identifier fields are the following:

Include Page
V4:accounts_receivable_identifier
V4:accounts_receivable_identifier

intended_currency_identifier

(optional)

Currency Identifier

The currency that the user was intended to use for the invoice. If specified then it is validated against the currency of the specified accounts receivable and if they don't match then an error is thrown. Note that the intended currency is not saved within CRM.COM; it is just used for validation purposes. The allowed currency identifier fields are the following:

Include Page
V4:currency_identifier
V4:currency_identifier

Tip

Available from CRM.COM R11.0.0


due_on

(optional)

DateThe date that the credit period for that specific invoice is ending.

posted_on

(optional)

Date

The posting date of the financial transaction which is before or equal to the current date and not included in already closed accounting periods. If not specified then the current date is applied. 

Tip

Available from CRM.COM R14.10.0


notes

(optional)

StringShared notes for the invoice

back_office_code

(optional)

String

A back office code for the invoice. If specified then it should be unique

Tip

Available from CRM.COM R9.1.0


udf_string_1

(optional)

String

User Defined Field of type String

udf_string_2

(optional)

String

User Defined Field of type String

udf_string_3

(optional)

String

User Defined Field of type String

udf_string_4

(optional)

String

User Defined Field of type String

udf_string_5

(optional)

String

User Defined Field of type String

udf_string_6

(optional)

String

User Defined Field of type String

udf_string_7

(optional)

String

User Defined Field of type String

udf_string_8

(optional)

String

User Defined Field of type String

udf_float_1

(optional)

Float

User Defined Field of type Float

udf_float_2

(optional)

Float

User Defined Field of type Float

udf_float_3

(optional)

Float

User Defined Field of type Float

udf_float_4

(optional)

Float

User Defined Field of type Float

udf_date_1

(optional)

Date

User Defined Field of type Date

udf_date_2

(optional)

Date

User Defined Field of type Date

udf_date_3

(optional)

Date

User Defined Field of type Date

udf_date_4

(optional)

Date

User Defined Field of type Date

invoice_item_set

(mandatory)

Set of invoice item objectsThe items of the invoice

fields_set

(optional)

List of Strings, comma separated 

A list of fields that should be included in the results. If not specified then all the available fields will be returned

...

Expand
titleExample 1

HTTP Method: POST


Request:

http://host_name/crmapi/rest/v2/invoices/create

Body:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
   "token":"4BCD003AC90E8DECBA474A03AB185CBB",
   "accounts_receivable_identifier":{"number":"401"},
   "type_identifier":{"name":"Invoice 1"},
   "life_cycle_state":"POSTED",
   "category_identifier":{"name":"Invoice Category 1"},
   "due_on":"2014-11-05T15:49:59",
   "notes":"to be issued later",
   "udf_string_1":"udf string 1",
   "udf_string_2":"udf string 2",
   "udf_string_3":"udf string 3",
   "udf_string_4":"udf string 4",
   "udf_string_5":"udf string 5",
   "udf_string_6":"udf string 6",
   "udf_string_7":"udf string 7",
   "udf_string_8":"udf string 8",
   "udf_float_1":10,
   "udf_float_2":20,
   "udf_float_3":30,
   "udf_float_4":40,
   "udf_float_5":50,
   "udf_float_6":60,
   "udf_float_7":70,
   "udf_float_8":80,
   "udf_date_1":"2014-05-05T15:49:59",
   "udf_date_2":"2014-06-05T15:49:59",
   "udf_date_3":"2014-07-05T15:49:59",
   "udf_date_4":"2014-08-05T15:49:59",
   "invoice_item_set":
   [
      {
         "product_identifier": {"code": "Smart Card"},
         "quantity":3,
         "cost":20,
         "discount_percentage":5,
         "vat_rate_identifier":{"name":"Zero"},
         "udf_string_1":"udf string 1",
         "udf_string_2":"udf string 2",
         "udf_string_3":"udf string 3",
         "udf_string_4":"udf string 4",
         "udf_string_5":"udf string 5",
         "udf_string_6":"udf string 6",
         "udf_string_7":"udf string 7",
         "udf_string_8":"udf string 8",
         "udf_float_1":10,
         "udf_float_2":20,
         "udf_float_3":30,
         "udf_float_4":40,
         "udf_float_5":50,
         "udf_float_6":60,
         "udf_float_7":70,
         "udf_float_8":80,
         "udf_date_1":"2014-05-05T15:49:59",
         "udf_date_2":"2014-06-05T15:49:59",
         "udf_date_3":"2014-07-05T15:49:59",
         "udf_date_4":"2014-08-05T15:49:59"
       }
    ]
}

Response:

Code Block
languagejavascript
themeConfluence
linenumberstrue
      {
    "status":
    {
        "message": null,
        "description": null,
        "code": "OK"
    },
    "data":
    {
        "total_amount": 57,
        "issued_on": "2014-10-29T18:20:40",
        "life_cycle_state": "POSTED",
		"unsettled_amount": null,
        "number": "I00000498",
        "due_on": "2014-11-05T15:49:59",
        "id": "399ABC9CAAFF820100582EDEB842F026",
        "outstanding_amount": null,
        "reference_number": "542",
        "posted_on": "2014-10-29T18:20:40"
    }
}


...

Expand
titleExample 2

HTTP Method: POST


Request:

{{server}}/crmapi/rest/v2/invoices/create

Body:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
    "token":"{{token}}",
    "accounts_receivable_identifier":{"number":"ACR0000000214"},
    "type_identifier":{"name":"Invoice"},
   "life_cycle_state":"POSTED",
   "notes":"to be issued later",
   "udf_string_1":"udf string 1",
   "udf_string_2":"udf string 2",
   "udf_string_3":"udf string 3",
   "udf_string_4":"udf string 4",
   "udf_string_5":"udf string 5",
   "udf_string_6":"udf string 6",
   "udf_string_7":"udf string 7",
   "udf_string_8":"udf string 8",
   "udf_float_1":10,
   "udf_float_2":20,
   "udf_float_3":30,
   "udf_float_4":40,
   "udf_float_5":50,
   "udf_float_6":60,
   "udf_float_7":70,
   "udf_float_8":80,
   "udf_date_1":"2014-05-05T15:49:59",
   "udf_date_2":"2014-06-05T15:49:59",
   "udf_date_3":"2014-07-05T15:49:59",
   "udf_date_4":"2014-08-05T15:49:59",
   "invoice_item_set":
   [
      {
         "product_identifier": {"code": "Smartcard"},
         "quantity":3,
         "cost":20,
         "discount_percentage":5,
         "vat_rate_identifier":{"name":"Zero"},
         "udf_string_1":"udf string 1",
         "udf_string_2":"udf string 2",
         "udf_string_3":"udf string 3",
         "udf_string_4":"udf string 4",
         "udf_string_5":"udf string 5",
         "udf_string_6":"udf string 6",
         "udf_string_7":"udf string 7",
         "udf_string_8":"udf string 8",
         "udf_float_1":10,
         "udf_float_2":20,
         "udf_float_3":30,
         "udf_float_4":40,
         "udf_float_5":50,
         "udf_float_6":60,
         "udf_float_7":70,
         "udf_float_8":80,
         "udf_date_1":"2014-05-05T15:49:59",
         "udf_date_2":"2014-06-05T15:49:59",
         "udf_date_3":"2014-07-05T15:49:59",
         "udf_date_4":"2014-08-05T15:49:59"
       }
    ]
}

Response:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
  "data": {
    "posted_on": "2016-07-05T15:33:48",
    "number": "I00000678",
    "total_amount": 57,
    "unsettled_amount": null,
    "issued_on": "2016-07-05T15:33:48",
    "currency_rate_period": null,
    "id": "C83F011A58E0450EB9ADAF3416692284",
    "life_cycle_state": "POSTED",
    "outstanding_amount": null,
    "reference_number": "97",
    "due_on": "2016-07-07T15:33:48"
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}


...

Expand
titleExample 3

HTTP Method: POST


Request:

http://host_name/crmapi/rest/v2/invoices/create

Body:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
    "token": "{{token}}",
    "accounts_receivable_identifier":{"number":"ACR0000008050"},
    "type_identifier":{"name":"Invoice"},
    "life_cycle_state":"POSTED",
    "member_accounts_receivable_identifier":{"number":"ACR0000008052"},
    "invoice_item_set":
    [
        {
            "product_identifier":{"code":"Gold"},
            "quantity":1,
            "cost":30,
            "discount_percentage":10,
            "vat_rate_identifier":{"name":"Standard"}
        },
         {
            "product_identifier":{"code":"Sports 1"},
            "quantity":2,
            "cost":10,
            "discount_percentage":5,
            "vat_rate_identifier":{"name":"Standard"}
        }
    ]
}
       

Response:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
  "data": {
    "posted_on": "2017-04-05T17:28:29",
    "number": "I00002949",
    "total_amount": 57.5,
    "unsettled_amount": null,
    "issued_on": "2017-04-05T17:28:29",
    "currency_rate_period": null,
    "id": "2415A59E46F347CAB2392B4A000EB0A1",
    "life_cycle_state": "POSTED",
    "outstanding_amount": null,
    "reference_number": "2762",
    "due_on": "2017-04-07T17:28:29"
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}   


...

Expand
titleExample 4

HTTP Method: POST


Request:

http://host_name/crmapi/rest/v2/invoices/create

Body:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
    "token": "{{token}}",
    "accounts_receivable_identifier":{"number":"ACR0000014008"},
    "type_identifier":{"name":"Invoice"},
    "life_cycle_state":"POSTED",
     "due_on": "2019-06-14T15:49:59",
    "invoice_item_set":
    [
         {
            "product_identifier":{"code":"Bronze"},
            "cost":2,
            "quantity":1
        },
        {
            "product_identifier":{"code":"Smartcard"},
            "cost":2,
            "installed_items_set":
		    [
		        {
		            "installed_item_identifier":{"serial_number":"1000140089"}
		        },
		        {
		            "installed_item_identifier":{"serial_number":"1000140090"}
		        }
        	] 
        }
    ]
}       

Response:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
  "data": {
    "posted_on": "2019-05-17T10:28:29",
    "number": "I02000136",
    "total_amount": 6,
    "unsettled_amount": null,
    "issued_on": "2019-05-17T10:28:29",
    "currency_rate_period": null,
    "id": "ADAA885F03AF4DC39A49365DDFA37F03",
    "life_cycle_state": "POSTED",
    "outstanding_amount": null,
    "reference_number": "18736",
    "due_on": "2019-06-14T15:49:59"
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}   


...