JSON API » invoices » invoices/create
Creates a new invoice.
Input parameters
Requires authentication and the commerce role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
customer | Integer | ID of customer to generate invoice for. | Yes | |
start | Integer | Start Unix timestamp. | Recommended | 0 |
end | Integer | End Unix timestamp. | Recommended | Now |
charges | Integer | 1 to generate and add charges, 0 not. Only has effect if save=1 is specified. | No | 0 |
encoding | String | "base64" to return file base64 encoded, "raw" to return raw data. | No | "raw" |
reset_balance | Integer | 1 to reset balance and update invoiced time, 0 not to. | No | 0 |
save | Integer | 1 to save the invoice in the database, 0 not to. | No | 0 |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Failure to specify the start and end may put a heavy load on the database.
Responses
Code | Description |
---|---|
200 | Success. |
201 | Input passed validation. Only returned if validation=1. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
500 | An internal error occurred. Check the key and message fields for more details. |
Data returned
The fields of the created invoice.
Example: With required and recommended parameters
http://enswitch.example.com/api/json/invoices/create/?auth_username=user;auth_password=password;customer=123;start=1230000000;end=1240000000{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "data":"..." } }
Change history
Version | Changes |
---|---|
3.13 | Function added. |