Developer's API
Products we already integrate with:
We have already written
standard integrations for ePOS and web-store solutions, and are writing more all the time. Check
this page for the current list.
Do your own Integration
All programs include access to our full API for developers - even on the free plan! You can use these functions to link your current web-software or backoffice systems with your loyalty program.
This interface offers a secure (HTTPS + API Key) 'RESTful' method of sending and receiving data from your current website, ePOS or backoffice systems:
Webhooks: for realtime data transfer use our
Webhooks to push data to your 3rd party systems.
Single Sign On: to seamlessly log your members into your micro-site:
Generate a dynamic SSO token by MD5 hashing ( GMT-date(YYYYMMDDHH) + the member code or email + your api_key).
Then pass the token along with the code or email to your micro-site as follows:
https://{your_micro_site}.loyal2.com/?&sso=member_code OR member_email&token= your_token
Note: tokens have a 2 hour life-span and so they need to be generated uniquely each time they are required.
Basic SQL Integration: If you only require basic SQL database integration be sure to look at our
SQL Server Integration Tool - which is a simplified and automated way to read SQL data into this program.
Important: make sure all API call are made to our secure (SSL) server via https:// calls.
Do not use http:// calls, as your requests will be insecure and will be rejected.
API calls can be sent to the server via GET/POST method and must contain the following variables:
-
global[api_key]
Your unique API_KEY as specified above.
-
global[api_time]
The current GMT time at time of sending the call. Format 'YYY-MM-DD HH:MM:SS'.
-
global[api_method]
The specific method being called within the API - the full list can be found below.
A test method, used to verify your API settings is 'verify_api'.
If you are going to be sending any data to the API it is sent in a similar format, using the global[fields] sub-array as follows:
We have some special fields which can be used for data filtering namely:
An example API call written in PHP without sending any data would look like this:
$curl=curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://secure.loyal2.com',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
'global[api_key]' => '-your-key-would-go-here-',
'global[api_time]' => gmdate("Y-m-d H:i:s"),
'global[api_method]' => 'verify_api',
),
));
$response=curl_exec($curl);
curl_close($curl);
An example API call written in PHP including sent data would look like this:
$curl=curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://secure.loyal2.com',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
'global[api_key]' => '-your-key-would-go-here-',
'global[api_time]' => gmdate("Y-m-d H:i:s"),
'global[api_method]' => 'get_members',
'global[fields][code]' => 'M000001',
),
));
$response=curl_exec($curl);
curl_close($curl);
All responses are in XML or JSON and adhere to the following structure:
An example of a successful call response to the verify_api method
<?xml version="1.0" encoding="UTF-8"?>
<status>API call succeeded</status>
An example of a failed call response with error message
<?xml version="1.0" encoding="UTF-8"?>
<error>001: Not sent via SSL/https connection</error>
An example of a successful call response with returned data (trimmed for ease of reading)
<?xml version="1.0" encoding="UTF-8"?>
<status>2 results found</status>
<data>
<row>
<first_name>Bob</first_name>
<last_name>Smith</last_name>
<etc>etc...</etc>
</row>
<row>
<first_name>Mary</first_name>
<last_name>Jones</last_name>
<etc>etc...</etc>
</row>
</data>
List of available API Calls and their related fields
API Call : get_member/s
Search filter fields:
- first_name
- last_name
- company_name
- email
- cell
- telephone
- date_of_birth
- street_address
- street_address2
- street_suburb
- street_city
- street_zipcode
- street_state
- optout_email
- optout_text
- optout_post
- code
- secondary_code
- group
- subscription_date_from
- subscription_date_to
- branch
- suspended
- _metadata01
- _metadata02
- _metadata03
- _metadata04
- _metadata05
- _metadata06
- _metadata07
- _metadata08
- _metadata09
- from_date
- to_date
- global[member_search] - optional, use to do a text/wildcard search of first_name, last_name, company_name, email, telephone, cell and street_zipcode
API Call : get_transaction/s
Search filter fields:
- member
- total_value
- transaction_date
- transaction_ref
- code
- sku_code
- notes
- qty
- ex_tax_amount
- tax_amount
- tax_type
- grand_total
- unit_price
- branch
- from_date
- to_date
API Call : get_sku_code/s
Search filter fields:
- name
- code
- barcode
- options
- notes
- category
- sales_price
- purchase_price
- archived
- from_date
- to_date
API Call : get_sku_category/ies
Search filter fields:
- name
- code
- refers_to
- from_date
- to_date
API Call : get_points
Search filter fields:
- member
- points
- code
- transaction_date
- internal_notes
- branch
- from_date
- to_date
API Call : get_voucher/s
Search filter fields:
- name
- points_required
- code
- trigger_on_total_points_earned
- points_earned_in_months
- voucher_details
- email_instructions
- available_for_self_selection
- auto_allocate_on_event
- limited_to_per_member
- optional_email_template
- expires_after_days
- can_be_redeemed_for_points
- value
- value_type
- min_value
- sku_code
- date_from
- date_to
- group
- branch
- from_date
- to_date
API Call : get_vouchers_issued
Search filter fields:
- voucher
- qty
- member
- transaction_date
- code
- points_used
- branch
- from_date
- to_date
- voucher_code - use to retrieve data for a specific voucher_code, else all associated voucher_codes will be returned
API Call : get_vouchers_precode/s
Search filter fields:
- code
- voucher
- from_date
- to_date
API Call : get_user/s
Search filter fields:
- name
- email
- code
- disable_backoffice_access
- branch
- from_date
- to_date
API Call : get_branch/es
Search filter fields:
API Call : get_promotion/s
Search filter fields:
- name
- percent_of_spend
- fixed_points_value
- group
- date_from
- date_to
- sku_code
- category
- code
- branch
- from_date
- to_date
API Call : get_transactional_promotion/s
Search filter fields:
- name
- percent_of_spend
- fixed_points_value
- group
- date_from
- date_to
- sku_code
- category
- code
- branch
- from_date
- to_date
API Call : get_non_transactional_promotion/s
Search filter fields:
- name
- points_to_award
- code
- group
- date_from
- date_to
- auto_allocate_on_event
- quickscan_function
- branch
- from_date
- to_date
API Call : add_member
Data fields:
- first_name - required
- last_name - required
- company_name
- email
- cell
- telephone
- date_of_birth
- street_address
- street_address2
- street_suburb
- street_city
- street_zipcode
- street_state
- optout_email
- optout_text
- optout_post
- code
- secondary_code
- group
- subscription_date_from
- subscription_date_to
- branch
- suspended
- _metadata01
- _metadata02
- _metadata03
- _metadata04
- _metadata05
- _metadata06
- _metadata07
- _metadata08
- _metadata09
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
- global[code_editable] - optional, set flag to allow member-code to be edited.
API Call : add_transaction
Data fields:
- member - required
- total_value - required
- transaction_date
- transaction_ref
- code
- sku_code
- notes
- qty
- ex_tax_amount
- tax_amount
- tax_type
- grand_total
- unit_price
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_sku_code
Data fields:
- name - required
- code - required
- barcode
- options
- notes
- category
- sales_price
- purchase_price
- archived
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_sku_category
Data fields:
- name - required
- code
- refers_to
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_points
Data fields:
- member - required
- points - required
- code
- transaction_date
- internal_notes
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_voucher
Data fields:
- name - required
- points_required
- code
- trigger_on_total_points_earned
- points_earned_in_months
- voucher_details
- email_instructions
- available_for_self_selection
- auto_allocate_on_event
- limited_to_per_member
- optional_email_template
- expires_after_days
- can_be_redeemed_for_points
- value
- value_type
- min_value
- sku_code
- date_from
- date_to
- group
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_voucher_issued
Data fields:
- voucher - required
- qty - required
- member
- transaction_date
- code
- points_used
- branch
- force_value - use to override the value of the voucher being issued/updated
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_voucher_precode
Data fields:
- code - required
- voucher - required
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_user
Data fields:
- name - required
- email - required
- code
- disable_backoffice_access
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_branch
Data fields:
- name
- code
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_promotion
Data fields:
- name
- percent_of_spend - required
- fixed_points_value
- group
- date_from
- date_to
- sku_code
- category
- code
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_transactional_promotion
Data fields:
- name
- percent_of_spend - required
- fixed_points_value
- group
- date_from
- date_to
- sku_code
- category
- code
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : add_non_transactional_promotion
Data fields:
- name
- points_to_award - required
- code
- group
- date_from
- date_to
- auto_allocate_on_event
- quickscan_function
- branch
- global[edit_duplicates] - optional, set flag to edit data if a duplicate is found. Note: use with caution - empty fields will erase existing data if this is done, so only pass through the data you want to edit.
API Call : edit_member
Data fields:
- first_name
- last_name
- company_name
- email
- cell
- telephone
- date_of_birth
- street_address
- street_address2
- street_suburb
- street_city
- street_zipcode
- street_state
- optout_email
- optout_text
- optout_post
- code - required
- secondary_code
- group
- subscription_date_from
- subscription_date_to
- branch
- suspended
- _metadata01
- _metadata02
- _metadata03
- _metadata04
- _metadata05
- _metadata06
- _metadata07
- _metadata08
- _metadata09
- global[code_editable] - optional, set flag to allow member-code to be edited.
API Call : edit_transaction
Data fields:
- member
- total_value
- transaction_date
- transaction_ref
- code - required
- sku_code
- notes
- qty
- ex_tax_amount
- tax_amount
- tax_type
- grand_total
- unit_price
- branch
API Call : edit_sku_code
Data fields:
- name
- code - required
- barcode
- options
- notes
- category
- sales_price
- purchase_price
- archived
API Call : edit_sku_category
Data fields:
- name
- code - required
- refers_to
API Call : edit_points
Data fields:
- member
- points
- code - required
- transaction_date
- internal_notes
- branch
API Call : edit_voucher
Data fields:
- name
- points_required
- code - required
- trigger_on_total_points_earned
- points_earned_in_months
- voucher_details
- email_instructions
- available_for_self_selection
- auto_allocate_on_event
- limited_to_per_member
- optional_email_template
- expires_after_days
- can_be_redeemed_for_points
- value
- value_type
- min_value
- sku_code
- date_from
- date_to
- group
- branch
API Call : edit_voucher_issued
Data fields:
- voucher
- qty
- member
- transaction_date
- code - required
- points_used
- branch
- force_value - use to override the value of the voucher being issued/updated
- voucher_code - use to modify data for a specific voucher_code, replaces need to use 'code' (above) to locate the voucher_issued data record
API Call : edit_voucher_precode
Data fields:
API Call : edit_user
Data fields:
- name
- email
- code - required
- disable_backoffice_access
- branch
API Call : edit_branch
Data fields:
API Call : edit_promotion
Data fields:
- name
- percent_of_spend
- fixed_points_value
- group
- date_from
- date_to
- sku_code
- category
- code - required
- branch
API Call : edit_transactional_promotion
Data fields:
- name
- percent_of_spend
- fixed_points_value
- group
- date_from
- date_to
- sku_code
- category
- code - required
- branch
API Call : edit_non_transactional_promotion
Data fields:
- name
- points_to_award
- code - required
- group
- date_from
- date_to
- auto_allocate_on_event
- quickscan_function
- branch
API Call : delete_member
Data fields:
API Call : delete_transaction
Data fields:
API Call : delete_sku_code
Data fields:
API Call : delete_sku_category
Data fields:
API Call : delete_points
Data fields:
API Call : delete_voucher
Data fields:
API Call : delete_voucher_issued
Data fields:
API Call : delete_voucher_precode
Data fields:
API Call : delete_user
Data fields:
API Call : delete_branch
Data fields:
API Call : delete_promotion
Data fields:
API Call : delete_transactional_promotion
Data fields:
API Call : delete_non_transactional_promotion
Data fields:
API Call : redeem_voucher_code
Data fields:
API Call : verify_api
- No input required. Used to verify API access.