Manual code integration

Displaying the King-Avis widget

To display the widget on your site, all you have to do is incorporate the following JavaScript code just before the closing </head> tag in your store's code, specifying your own account-related settings. Take a look at the example below:

<script type="text/javascript" src="https://king-avis.com/widgets/31-991bf70b65ba2b823dd8b50fd3621a2b8933b47d5.js"></script>

31 = Merchant ID
991bf70b65ba2b823dd8b50fd3621a2b8933b47d5 = Marchand Token
These two values are separated by a dash. You can retrieve these two data points from your customer account.

Adding a review request

In order for the process of adding a review request to work properly, your platform must be able to send all orders placed via your store to the King-Avis site. For that we recommend the integration technique with PHP (with file_get_contents or CURL) by executing a url towards our API. You must respect the integration example below by automatically assigning the correct values to each parameter. When you run this code, it will automatically send order information to the King-Avis platform.

<?php
file_get_contents('https://king-avis.com/en/merchantorder/add?id_merchant=31&token=991bf70b65ba2b823dd8b50fd3621a2b8933b47d5&private_key=62af78aebuiod02e4e773b21e9bd4a7c54a2ab68&ref_order=17&email[email protected]&amount=57.230000&iso_currency=CHF&firstname=Germain&lastname=Tenthorey&iso_lang=en');
?>

An alternative method is to use the pixel method in HTML with an embedded url on an IMG tag:

<img src="https://king-avis.com/en/merchantorder/add?id_merchant=31&token=991bf70b65ba2b823dd8b50fd3621a2b8933b47d5&private_key=62af78aebuiod02e4e773b21e9bd4a7c54a2ab68&ref_order=17&email[email protected]&amount=57.230000&iso_currency=CHF&company=Webbax&firstname=Germain&lastname=Tenthorey&address=CP%20157&postcode=1926&city=Fully&iso_country=CH&phone=0277461981&date_order=2021-01-01%2010:01:32&iso_lang=en" height="0" width="0">


The URL can be broken down into the following settings:

https://king-avis.com/en/merchantorder/add? : The base link must be pre-specified as per this example. The value "/en/" may be replaced by "/de/", "/fr/", "/it/".
id_merchant This is the Merchant ID taken from your King-Avis back-office settings.
Type : int
Field : required
token This is the Merchant Token specified in your King-Avis back-office settings.
Type : string
Field : required
private_key This is the Private Merchant Key specified in your King-Avis back-office settings.
Type : string
Field : required
ref_order your order reference or number
Type : string
Field : required
email the buyer's email address
Type : email
Field : required
amount total order value
Type : float
Field : required
iso_currency the ISO code of the currency (CHF, EUR, USD...)
Type : string(3)
Field : required
company company name
Type : string
Field : optional
firstname the buyer's given name
Type : string
Field : required
lastname the buyer's surname
Type : string
Field : required
address buyer's address
Type : string
Field : optional
postcode buyer's postal code
Type : string
Field : optional
city buyer's city
Type : string
Field : optional
iso_country ISO code for the buyer's country (FR, CH, DE, IT...)
Type : string(2)
Field : optional
phone buyer's phone number
Type : string
Field : optional
iso_lang ISO code of the buyer's language (fr, de, en, it...)
Type : string(2)
Field : required
date_order order date
Type : DateTime (Y-m-d H:i:s)
Field : optional