Central Billing Monitoring System API Documentation For Nepal

Nepal Tax Authority (Inland Revenue Department) has issued directive regarding the POS Module.

Invoice issued and Credit notes or Sales return should be synced in real time to “Central Billing Management System” Mainlined by Tax Authority

API to post Invoice to CBMS
API URL: http://202.166.207.75:9050/api/bill

> API POST Object (JSON Object): BillViewModel obj
> public class BillViewModel
> {
> public string username { get; set; }
> public string password { get; set; }
> public string seller_pan { get; set; }
> public string buyer_pan { get; set; }
> public string fiscal_year { get; set; }
> public string buyer_name { get; set; }
> public string invoice_number { get; set; }
> public string invoice_date { get; set; }
> public string total_sales { get; set; }
> public Nullable<double> taxable_sales_vat { get; set; }
> public Nullable<double> vat { get; set; }
> public Nullable<double> excisable_amount { get; set; }
> public Nullable<double> excise { get; set; }
> public Nullable<double> taxable_sales_hst { get; set; }
> public Nullable<double> hst { get; set; }
> public Nullable<double> amount_for_esf { get; set; }
> public Nullable<double> esf { get; set; }
> public Nullable<double> export_sales { get; set; }
> public Nullable<double> tax_exempted_sales { get; set; }
> public bool isrealtime { get; set; }
> public DateTime datetimeClient { get; set; }
> }

API POST Reply:Error/Success Code

104: model invalid
200: success
102: exception while saving bill details
101: bill already exists
100: API credentials do not match
103: Unknown exceptions

2. API to post credit note(sales return) to CBMS
API URL: http://202.166.207.75:9050/api/billreturn
> API POST Object (JSON Object): BillViewModel obj
> public class BillReturnViewModel
> {
> public string username { get; set; }
> public string password { get; set; }
> public string seller_pan { get; set; }
> public string buyer_pan { get; set; }
> public string fiscal_year { get; set; }
> public string buyer_name { get; set; }
> public string ref_invoice_number { get; set; }
> public string credit_note_number { get; set; }
> public string credit_note_date { get; set; }
> public string reason_for_return { get; set; }
> public string total_sales { get; set; }
> public Nullable taxable_sales_vat { get; set; }
> public Nullable vat { get; set; }
> public Nullable excisable_amount { get; set; }
> public Nullable excise { get; set; }
> public Nullable taxable_sales_hst { get; set; }
> public Nullable hst { get; set; }
> public Nullable amount_for_esf { get; set; }
> public Nullable esf { get; set; }
> public Nullable export_sales { get; set; }
> public Nullable tax_exempted_sales { get; set; }
> public bool isrealtime { get; set; }
> public DateTime datetimeClient { get; set; }
> }

API POST:Error/Success Code

104: model invalid
200: success
102: exception while saving credit note details
101: bill does not exists
100: API credentials do not match
103: Unknown exceptions
105: Bill does not exists (for Sales Return)

Sample Code for C# for Posting Bill

> using (var client = new HttpClient())
> {
> 	client.DefaultRequestHeaders.Accept.Clear();
> 	cllient.defaultRequestHeaders.Accept.Add(new MediaTypeWIthQualityHeaderValue("application/jason"));
> 	BillviewModel P = new BillReturnViewModel
> 	{
> 	username = "Test_CBMS", password = "test@321", seller_pan = "999999999",
> 	buyer_pan = "123456789",
> 	buyer_name = "", fiscal_year = "2073.074", invoice_number="102",
> 	invoice_date="2074.07.06", total_sales=1000.01,
> 	taxable_sales_vat=1000.01, vat-130, excisable_amount=0, excise=0,
> 	taxable_sales_hst=0,
> 	hst=0, amount_for_esf=0, esf=0, export_sales=0,
> 	tax_exempted_sales=0, isrealtime=true, datetimeclient = Datetime.now 
> 	};
> 
> 	client.BaseAddress = new Uri("http://202.166.207.75.9050");
> 	var response = client.PostAsJsonAsync("api/bill", p).Result;
> 	if(response.IsSuccessStatusCode)
> 	{
> 	var result = response.Content.ReadAsStringAsync();
> 	console.write(result.Result);
> 	Console.ReadLine();
> 	}else
> 	{
> 	Console.Write("Error");
> 	Console.ReadLine();
> 	}
> }

Sample Code for C# for Posting Credit Note(Sales return)

> using (var client = new HttpClient())
> {
> 	client.DefaultRequestHeaders.Accept.Clear();
> 	cllient.defaultRequestHeaders.Accept.Add(new MediaTypeWIthQualityHeaderValue("application/jason"));
> 	BillviewModel P = new BillReturnViewModel
> 	{
> 	username = "Test_CBMS", password = "test@321", seller_pan = "999999999",
> 	buyer_pan = "123456789",
> 	buyer_name = "", fiscal_year = "2073.074", ref_invoice_number,="102", credit_note_date="2074.07.06", credit_note_number="1", reason_for_return="defect in piece", total_sales=1000.01,
> 	taxable_sales_vat=1000.01, vat-130, excisable_amount=0, excise=0,
> 	taxable_sales_hst=0,
> 	hst=0, amount_for_esf=0, esf=0, export_sales=0,
> 	tax_exempted_sales=0, isrealtime=true, datetimeclient = Datetime.now 
> 	};
> 
> 	client.BaseAddress = new Uri("http://202.166.207.75.9050");
> 	var response = client.PostAsJsonAsync("api/billreturn", p).Result;
> 	if(response.IsSuccessStatusCode)
> 	{
> 	var result = response.Content.ReadAsStringAsync();
> 	console.write(result.Result);
> 	Console.ReadLine();
> 	}else
> 	{
> 	Console.Write("Error");
> 	Console.ReadLine();
> 	}	
> }

How to use this in API In PHP