Quick Integration

Guide for quick nector integration.

Client-side integration

Contact us on [email protected] for any help needed to get started with nector.

Step 1

Use the sample link and replace the values inside <> (including <>) with your own values https://websdk.nector.io/nector/<page_name>?murl=<murl>&mkey=<api_key>&[customer_id=<customer_id> or email=<email> or mobile=<mobile> or lead_id=<lead_id>] Where

page_name - it can be one of

profile, wallettransaction-list, deal-list, notification-list, taskactivity-list, deal, coupon

murl - it can be one of https://platform.nector.io/api/v2/merchant (when the API key and user id is of PROD mode) https://devplatform.nector.io/api/v2/merchant (when the API key and user id is of DEV mode)

you can pass one of these customer_id - it needs to be your customer identified id email - it needs to customer email mobile - it needs to be mobile (without the code) lead_id - it needs to be our lead id for the customer

mkey - this needs to your API key.

Other query params

We do not support hex colour scheme through the query params (#000000 to #FFFFFF)

  • mn (merchant name) This will put your branding on the pages (Default is null)

  • mv (merchant view) This can be one of mobile or desktop (Default is desktop)

  • mtbc (merchant toolbar background colour) This is the toolbar background colour. Allowed values are all colors, rgba and linear-gradients [white, green, rgba(255, 255, 225, 07), linear-gradient(direction, color1, color2)] (Default is white)

  • mtbi (merchant_toolbar_background_image) This is the toolbar background image. Allowed values are background image or linear-gradients image [url(image) or url(image), linear-gradient(direction, color1, color2)] (Default is null)

  • mtc (merchant_toolbar_color) This is the toolbar foreground colour. Allowed values are all colors and rgba [white, green, rgba(255, 255, 225, 07), linear-gradient(direction, color1, color2)] (Default is white)

  • mpbbc (merchant_primary_button_background_color) This is the primary button background colour if not provided will fallback to the merchant_toolbar_background_color (Default is white)

  • msbbc (merchant_secondary_button_background_color) This is the secondary button background colour (Default is #00000090)

  • mpbc (merchant_primary_button_color) This is the primary button foreground colour if not provided will fallback to the merchant_toolbar_color (Default is black)

  • msbc (merchant_secondary_button_color) This is the secondary button foreground colour (Default is #F2F2F2)

  • mic (merchant_icon_color) This is icons foreground colour (Default is white)

  • mpi (merchant_placeholder_image) This is the default image that will be loaded until the actual image loads (Default is nector logo)

We are committed to introducing new themes in future with various configuration options.

If you wish to implement your own UI we recommend contributing to our web SDK repository which has all the API integrations in place. The repository is hosted at

Step 2

Create a new page in your mobile app or website and point to this URL which includes your API key and customer identifiers.

Server-side integration

THIS IS OPTIONAL BUT HIGHLY RECOMMENDED TO DO THIS

Step 3

Each merchant is assigned a plan which has a certain quota limit attached to it. Whenever your customer performs operations using your API key it will be executed directly, unless you put restrictions to it.

While creating the API key add a Callback URL (We will make a post request to this callback URL asking for permission to execute the action along with relevent information). THIS IS WHAT WE HAVE IMPLEMENTED ON OUR SIDE

api_key = "api key string"
api_secret = "api secret string"
sha265_hash = "function to convert value to sha256 hash"
x_timestamp = current_time.add(1, "minutes").unix()
headers = {
"accept": "application/json",
"content-type": "application/json",
"x-source": "unix",
"x-apikey": api_key,
"x-nector-secret": sha256_hash(api_secret),
"x-timestamp": x_timestamp
};
// ALL THESE ACTIONS RESULTS IN QUOTA BURNS, HENCE PERMISSION CHECK IS RECOMMENDED
actions = [
"lead_create", // whenever a new user is being created
"lead_update", // whenever existing user is being updated
"deal_reward_create", // whenever a new deal is being rewareded
"wallet_transaction_create", // whenever a new wallet transaction is being created (reward or adjust) can be anything CR or DR
"wallet_transaction_update", // whenever existing wallet transaction is being updated
"swap_create", // whenever a new swap is being created
"task_activity_create", // whenever a new task activity against a campaign is being created
]
payload = {
"action": one of the values on action array,
"payload": {json_object_which_contains_data_related_to_action}
}
// we will send the headers and payload informations, you should validate the payload information based on your business logic
----- POST (headers, payload) -----

Your server will receive a POST request with header and body parameters as above. You need to respond to this request within 1 minute, any response after 1 minute will be rejected. Use x-nector-headerto validate, that the request is coming from us. In order to validate, hash your API secret usingsha256 algorithmas we have done in the above code snippet and match it with thex-nector-secretheader value. If it doesn't match you must reject the request.

The next step is to respond with the proper response. Your server should reject the request if it does not want to proceed. In case you want to proceed with the request, return the response in the below format.

hmac_signature = "function to convert value to hmac"
api_secret = "api secret string"
sha265_hash = "function to convert value to sha256 hash"
x_timestamp = header["x-timestamp"]
if sha265_hash(api_secret) != header["x-nector-secret"] return error
return {
"data": {
"signature": hmac_signature(String(x_timestamp), api_secret)
}
}

Once we receive your response in the above format we will validate the signature and on success, we will proceed with the request.