If you wish to write your own eCommerce Ignico integration you should consider steps described below.

1. Configuration panel of your integration

If you are developing a reusable plugin or module you wish to use with more than one platform it might be necessary to allow user to configure some parameters. The most important (and rather mandatory) ones are:

  • Ignico workspace name (used in url like https://{{workspace}}.igni.co)

  • API Client ID and Secret - this can be generated by user in his administration panel in Administration > Integrations > API clients page.

Other params worth considering as configurable are:

  • Referral code overwriting strategy

  • Referral code expiring strategy

  • Referral code refreshing strategy

  • Action type slug - this can be custom created by user in his administration panel in Administration > Actions > Action types

For a reference on how to create such configuration panel you may check out our existing plugins like our official WordPress plugin.

Referral link code comes into your eCommerce site via URL parameter when user visits referral link. It is passed in __igrc param attached to destination URL (your site).

When customer visits your store with this parameter, you should keep it for later use in a browser cookie, server side session etc. (let's call it referral code storage).

You can give your user the power to control overwriting strategy of this referral code:

  • first visited referral link code is the most important and cannot be overwritten,

  • last visited referral link code is the most important and it overwrites previous ones.

Expiring of keeping referral code as valid for current customer may also be important for your integration user, so saved referral code may:

  • never expire and be used to all actions done on your site (this makes sense when last referral code is the most important),

  • expire after certain amount of time

  • expire after placing an order in your store (so referral code works only for the first order).

Extending/resetting the amount of time after which referral code expires may be done in multiple ways too:

  • after each refresh of any page on your site,

  • after each "rewardable" action done on your site.

3. Attaching Ignico referral code to an order

When a referral code is present in your referral code storage at the moment of placing an order, you should "attach" this referral code to this order.

This way in any time later you can tie an order to a referral code, display it somehow in the UI and so on. 

After you attach and save referral code (based on your referral code expiring strategy) this may be the time to expire it.

4. Creating an Action in Ignico when an order is paid/realised

Depending on your eCommerce platform internal architecture you can probably "listen for" or "hook into" the process of changing state of an order.

When your customer pays for an order online, or when an order is marked as paid by administrator of your store it is probably the best moment to create an Action in Ignico instance.

You should use our API endpoint called "Create an action" to do so:

  • Put the referral code which is tied with this order (be careful, you should not use the one which is currently in referral code storage as it may be already different or expired!) to referrer.code property in your request. 

  • Choose proper action type so a value can be passed.

  • Put some descriptive title and date when order has been placed or paid.

After the action is created, in an immediate response you will get ID of an action which you should also save tied to an order for further reference (ex. cancelling the action when the order gets returned or cancelled).

5. Cancelling the Action in Ignico when an order is returned/cancelled

In order to keep actions in sync with referred orders, you should cancel already created action for orders that have been returned by customer or cancelled.

For a reference on how to implement an integration, you can checkout our Open Source GitHub projects.

Did this answer your question?