Create record in Zoho Billing
Table of Contents
Overview
This task is used to create a record in Zoho Billing. This task is based on Zoho Billing API <ModuleName> -> Create a <ModuleName>.
Syntax
<variable> = zoho.billing.create(<module_name>, <org_id>, <data_map>, <connection>);
where:
Parameter | Data type | Description |
<variable> | KEY-VALUE | is the variable response returned by Zoho Billing. |
<module_name> | TEXT | is the name of the module in where the record will be added. |
<org_id> | TEXT | Org ID of the organization in which the record will be created.c Note: Learn how to fetch organization ID from the UI and from the response of zoho.billing.getOrganization task. |
<data_map> | KEY-VALUE | Input map with key as Zoho Billing field's name and the required value. For ex: {"display_name":input.Last_Name} To learn about the mandatory fields, click here and go to <Module> --> Create a <Module> |
<connection> | TEXT | specifies the link name of the Zoho Billing connection. Note:
|
Examples
1) Let's say we have a Zoho Creator form containing fields Customer_ID, and Plan code. On submission of this form, a subscription must be created in Zoho Billing with the details specified in the form. We can achieve this using the following snippet:
values = map(); values.put("customer_id", input.Customer_ID); values.put("auto_collect", false); values.put("plan", {"plan_code" : input.Plan_Code}); response = zoho.billing.create("Subscriptions", "66XXXXX66", values, "billing_connection");
where,
values
"auto_collect" "plan" "plan_code" "customer_id"
"Subscriptions"
"66XXXXX66"
"billing_connection"
2) Let’s take an example of creating a record in the "Customers" module in Zoho Billing using the following snippet.
values=map(); values.put("display_name","john"); values.put("email","john@zylker.com"); response = zoho.billing.create("Customers", "66XXXXX66", values, "billing_connection");
where:
values
"display_name" "email"
"Customers"
"billing_connection"
Sample Response
The following is a sample success response:
{
"message":"The customer has been added.",
"code":0,
"customer":{
"default_templates":{
"creditnote_template_id":"",
"invoice_template_id":""
},
"phone":"",
"payment_terms":0,
"payment_terms_label":"Due On Receipt",
"price_precision":2,
"updated_time":"2015-03-10",
"outstanding_receivable_amount":0,
"shipping_address":{
"zip":"",
"fax":"",
"street":"",
"state":"",
"country":"",
"city":""
},
"first_name":"",
"company_name":"",
"zcrm_contact_id":"",
"currency_symbol":"Rs.",
"outstanding":0,
"currency_code":"INR",
"custom_fields":"[]",
"currency_id":"115888000000000099",
"status":"active",
"pricebook_id":"115888000000011001",
"zcrm_account_id":"",
"unused_credits":0,
"display_name":"zoho",
"email":"zohocorp@gmail.com",
"last_name":"",
"created_time":"2015-03-10",
"notes":"",
"customer_id":"115888000000046001",
"mobile":"",
"billing_address":{
"zip":"",
"fax":"",
"street":"",
"state":"",
"country":"",
"city":""
}
}
}
To fetch the ID of the record from the returned response, use the following snippet:
// example for <module_name> is customer and example for <module_name>
The following is a sample failure response:
"message":"Enter valid Customer Name",
"code":3013
}