Welcome, Guest Login

Support Center

Advanced Integration (JavaScript-Only + Post-Purchase Popup)

Last Updated: May 19, 2016 02:35PM UTC
Just to be clear: This article is for the Advanced Integration (JavaScript-Only + Post-Purchase Popup). If you are looking for the Post-Purchase Popup Widget onlyplease click here. 

The main difference is that the Advanced Integration (JavaScript-Only + Post-Purchase Popup) works in place of the Standard Integration. The Post-Purchase Popup Widget works alongside the Standard Integration.

Now that that's clear and before diving in, 2 important things to note as we know your time is precious:
  1. Implementing this integration option will require technical experience in programming so please have a read through and if it seems complicated, please either consult your developer or use our Standard Integration option
  2. Not all ecommerce platforms provide the dynamic checkout variables needed for this integration option. It's best that you check with your ecommerce platform provider on their availability.

Customizing and inserting this Advanced JavaScript snippet on your purchase completed page just before the HTML </body> tag is the only step required for this integration option. You should not carry out any of the other Standard Integration steps in conjunction with this.

This integration is functionally similar to the Advanced Integration (JavaScript-Only) but with the addition of a Post-Purchase Popup (shown below) on your purchase confirmation page.

Post-purchase sharing panel popup example

The Advanced Javascript snippet can be found on the Integration page of your ReferralCandy dashboard:


This Advanced JavaScript snippet contains two parts: an HTML div element which contains invoice information and a script element. The code snippet will also require you to specify your App ID and Secret Key.



The App ID and Secret Key can both be found in the "Plugin tokens" section of your admin settings page.



You must replace the following dummy fields with dynamic checkout data from your ecommerce platform:
  1. data-fname: Customer First Name
  2. data-lname: Customer Last Name
  3. data-email: Customer Email Address
  4. data-amount: Invoice Amount
  5. data-currency: Invoice Currency (3 letter code)
  6. data-timestamp: Purchase Timestamp (UNIX time)
  7. data-external-reference-id: Invoice Number
  8. data-signature: Calculated from the MD5 digest of a string containing the email address, first name, invoice amount, order timestamp and secret key separated by commas. Please double check that this is done properly otherwise it will result in a checksum error.

Here's a worked example for your reference:

App ID: THISISMYID 
Secret Key: THISISMYKEY

If you have the following invoice, 
Name: John Smith
Email: john@example.com
Invoice Amount: USD$10.20
Order Timestamp (in UNIX time): 1396927808

In this example, MD5("john@example.com,John,10.20,1396927808,THISISMYKEY") = eacb54f62a2d989bed54d02f4a171e94​

The corresponding div element should therefore be: 
<div id="refcandy-mint" data-app-id="THISISMYID" data-fname="John" data-lname="Smith" data-email="john@example.com" data-amount="10.20" data-currency="USD" data-timestamp="1396927808" data-locale="en" data-signature="eacb54f62a2d989bed54d02f4a171e94​"></div>
support@referralcandy.com
http://assets1.desk.com/
false
referralcandy
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete