JSON API » taxes » taxes/create
Creates a new tax.
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 | |
name | String | Name. | Yes | |
accounts | Integer | 1 if this tax applies to customer's per billing cycle account fees, 0 if not. | No | 1 |
amount | Decimal | Amount added after rate is applied if value is non-zero. | No | 0.00 |
calls | Integer | 1 if this tax applies to calls, 0 if not. | No | 1 |
cardgroups | Integer | 1 if this tax applies to card groups, 0 if not. | No | 1 |
charges | Integer | 1 if this tax applies to charges by default, 0 if not. This can be overridden per charge. | No | 1 |
currency | String | The currency the amount is in. | No | System currency. |
customer | Integer | ID of customer to create in. | No | Customer of authentication user. |
description | String | Description. | No | Empty string. |
features | Integer | 1 if this tax applies to telephony features, 0 if not. | No | 1 |
liable | Integer | 0 if customers are not liable for this tax by default. 1 if new customers are. 2 if new and existing customers are. This can be overridden per customer. | No | 2 |
messages | Integer | 1 if this tax applies to text messages, 0 if not. | No | 1 |
numbers | Integer | 1 if this tax applies to numbers, 0 if not. | No | 1 |
products | Integer | 1 if this tax applies to products by default, 0 if not. This can be overridden per product. | No | 1 |
rate | Decimal | The tax rate in percent. | No | 0.0 |
shared | Integer | 1 to share with all customers on the system, 0 not to. Only has effect if system owner. | No | 0 |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
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. |
Data returned
The ID of the created tax.
Example: With required parameters
http://enswitch.example.com/api/json/taxes/create/?auth_username=user;auth_password=password;name=example{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
Version | Changes |
---|---|
4.0 | Value of 2 added for liable input parameter, and default changed to 2. |
3.13 | Function added. |