InvoicePe SDK Documentation

The InvoicePe SDK APIs are organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

URL Details

1

Base URL Live: https://sdk.invoicepe.in/

This API reference will help you in integrating the Invoice pe SDK in your application.

SDK Integration

1. Contact Us
2. Get API Credentials
3. Make SDK API Calls
4. Get Reports on your Dashboard

1. Registration:

Go to https://invoicepe.in/contact and schedule a meeting with us. We will understand your business requirements and set up your account with credentials and API keys for you

2. Get API Credentials:

Once successfully registered, you will get a free trial of 14 days. After logging in using the credentials provided by our team, you will be able to find your API keys on the API-Dashboard page of your account

3. Integrate and Invoke SDK:

Go through the documentation in order to understand how to integrate the SDK with your application. Once integrated, your customers will then be able to invoke the SDK. Get in touch with us in case you need assistance with any of the steps.

4.. Reports:

Once your customers complete the SDK journey, our AI algorithms will analyze the company and generate the data insights to create a 50page + report. You will be able to see the report on your account dashboard.

Authorization Token API

This API is required in order to generate the Authentication Token for the SDK to work. The token is passed as an argument to the SDK when it is initialized. This token is used by the SDK to authenticate and authorize your organization

POST

https://sdk.invoicepe.in/api/getToken

Key
Type: Description
identifier
string:This is your account username
x-api-key
string:This is your public API key
x-api-secret
string:This is your private API key secret
content-type
string literal:application/json

Web SDK Process Flow

The SDK has been designed to easily integrate wih any javascript web application. Before calling the SDK, you need to ensure to call the previous API endpoint in order to get the SDK token without which the SDK invocation will result in error. Feel free to contact us in case any of the below mentioned steps are unclear.

1. SDK Initialization

To initialize the SDK, you need to add a SDK script inside of your web page document. On load, the script will inject all the required SDK methods into your document which you can then access using window.InvoicePeSDK()

1

const script = document.createElement("script");

2

script.src = https://sdk.invoicepe.in/api/get_script;

3

script.async = true;

4

document.body.appendChild(script);

5

6

window.addEventListener("message", (event) => {

7

// Handle the received message

8

const eventData = event.data;

9

10

if (eventData.action === "invoicepe_sdk_event") {

11

const eventInfo = eventData.data;

12

// Handle the custom event and the additional data

13

}

2. SDK Invocation

Once the SDK script has been initialized, you can initialize the SDK inside a function call. The exact method this function is called is upto how you integrate the SDK in your process flow

1

async function startInvoicepeSDK() {

2

const getTokenResponse = await fetch("https://sdk.invoicepe.in/api/getToken, {

3

method: "POST",

4

headers: {

5

"Content-Type": "application/json"

6

identifier: #YOUR_IDENTIFIER,

7

"x-api-key": #YOUR_PUBLIC_KEY,

8

"x-api-secret": #YOUR_PRIVATE_KEY,

9

},

10

body: JSON.stringify({

11

colorScheme: 'dark' | 'light',

12

targetGST: #TARGET_COMPANY_GST,

13

targetCompanyName: #TARGET_COMPANY_NAME,

14

logo: #BASE64_URL_DATA_STRING,

15

}),

16

});

17

18

const tokenData = await getTokenResponse.json()

19

20

const token = tokenData["token"]

21

22

let options = {token: response.token};

23

24

const InvoicePeSDK = new window.InvoicePeSDK(options);

25

26

InvoicePeSDK.init();

27

};

The example provided is a demo on how you can initiate the SDK. In a real example, you might want to wrap the function inside a try/ catch block. Also, you might also want to deal with the situation where getTokenResponse["success"] is false and no token is recieved. Watch API Authentication block for more details.

3. SDK Utilization

Once the SDK is initiated, your customer will complete the process flow on the SDK. The SDK will post messages to your application via the window.postMessage() api and you will have access to details on the progress of each step taken by your customer. Once the process is complete, your customer can close the SDK or you can programatically close it. Customer data will be analyzed and you will get a message on your email as well the link to the Report on your dashboard

Key
Type: Description
GST Number
"^[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[CZ]{1}[0-9a-zA-Z]{1}$|^[0-9]{4}[a-zA-Z]{3}[0-9]{5}[uUnN]{2}[0-9a-zA-Z]{1}$"
CIN
"^([LUu]{1})([0-9]{5})([A-Za-z]{2})([0-9]{4})([A-Za-z]{3})([0-9]{6})$"
LLPIN
"^[A-Z]{3}[-]{1}[0-9]{4}"