eInvoice Api Integration of .Net library
You may directly open .Net Integration Demo Project using Visual Studio. Demo project has UI and backend code to show integration of each available eInvoice library method corresponding to respective API in your application.
Before you start using eInvoice Lib. First thing to watch for is eInvoiceSession class.
This class includes eInvoiceAPISetting class & eInvoiceAPILoginDetails class
eInvoiceAPISetting – The common settings for all TaxPayers. In case ASP application has multiple TaxPayer support, values in in Settings would remain same.
eInvoiceAPILoginDetails – TaxPayer specific settings. In case ASP application has multiple TaxPayer support, values of login details changes taxpayer to taxpayer .
public class eInvoiceAPISetting
{
public string GSPName { get; set; }
public string AspUserId { get; set; }
public string AspPassword { get; set; }
public string client_id { get; set; }
public string client_secret { get; set; }
public string AuthUrl { get; set; }
public string BaseUrl { get; set; }
public string EwbByIRN { get; set; }
}
public class eInvoiceAPILoginDetails
{
public string UserName { get; set; }
public string Password { get; set; }
public string GSTIN { get; set; }
public string AppKey { get; set; }
public string AuthToken { get; set; }
public string Sek { get; set; }
public Nullable<DateTime> E_InvoiceTokenExp { get; set; }
}
To avoid TLS 1.2 Connection error, write provided below code in application start up
· for .Net framework 4.6 and above TLS1.2 is already supported
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
· for .Net framework 4.5
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
· for .Net framework 4.0
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;