TABLE OF CONTENTS
- Introduction
- Sending Separate Order Requests
- Adding URL parameters
- Keeping Your Customer Data Secure
- How to Use OAuth 2.0 Authentication to Send Your Sales Data
- How to Use API Key Authentication to Send Your Sales Data
- Conclusion
Introduction
If you wish to supply your sales data to Feefo in real time, automatically after a sale or interaction, you can achieve this using Feefo's API. By sending your data via the Feefo API, your customers can start receiving feedback requests almost immediately after the transaction, thereby increasing your response rates.
This is very common method for integrating data for enterprise clients as they are likely to work with API’s on a day to day basis with their other third parties when sharing data.
Sending Separate Order Requests
For each order line of every transaction, you need to send a separate request to the Feefo API. These separate requests are linked together using the orderref parameter.
Adding URL parameters
To use the Feefo API, make a call to the secure URL: https://api.feefo.com/api/entersaleremotely. Depending on your requirements, this URL has several required and optional parameters.
For detailed information on each API parameter, refer to our API Parameter Summary
One popular optional parameter is "tags." Tags define sales/product attributes for uploaded sales data, allowing you to create subsets of data for generating reports filtered by tags. Tags are added as comma-separated 'key-value pairs' and can be used to analyse data in complex ways through the Feefo Hub.
For GET: tags=[keyA%3DvalueA,keyB%3DvalueB…]
e.g. tags=[saleschannel%3Dweb,productline%3DCar%20Insurance]
For POST: tags=keyA=valueA,keyB=valueB
e.g. tags=[saleschannel=web,productline=Car Insurance
Tags are combined as a logical AND. This means that in the examples above, the sale must have both tags present to be included in the filter.
Keeping Your Customer Data Secure
To ensure the security of your customer data, we strongly recommend using HTTP POST to encode and keep your data secure and separate from the URL. Alternatively, you can use HTTP GET, but note that parameters may be exposed in the request URL as plain text.
How to Use OAuth 2.0 Authentication to Send Your Sales Data
To use OAuth 2.0 authentication, first, use your App Key credentials to create an access token. This access token can then be used for subsequent requests to access Feefo API resources. Follow our guide on how to generate a token for more details. Once the token is generated, you can send a new sale using the URL: https://api.feefo.com/api/20/entersaleremotely with the required parameters.
How to Use API Key Authentication to Send Your Sales Data
For API Key authentication, you can use the provided PHP example. Ensure that the PHP cURL module is installed for it to work properly. The example demonstrates how to send sales data with required parameters using an API Key.
<?php
//**************************************************************
//Feefo php example.
//You will need the PHP cURL module installed for this to run.
//The Feefo URL
$url = 'https://api.feefo.com/api/entersaleremotely';
//The parameters
$params = array(
'apikey' => '2de0a1ad-331b-49b1-a3d2-39a908c05209',
'merchantidentifier' => 'example-retail-merchant',
'email' => 'someone@merchantsemailaddress.com',
'name' => 'John',
'date' => '2012-11-06',
'description' => 'Falcon Mach V',
'productsearchcode' => '132',
'orderref' => 'order_query_test1',
'currency' => 'EUR',
'amount' => '2599.90',
'productlink' => 'http://www.exampleretailmerchant.com/product_info.php?products_id=132',
'customerref' => 'GTD',
'locale' => 'fr'
);
//Build up the query and use curl to execute it.
$data = http_build_query($params, '', '&');
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$reply=curl_exec($ch);
curl_close($ch);
echo "The response received was: $reply";
?>
Conclusion
By integrating your sales data with Feefo's API, you can seamlessly request feedback from your customers in real time, enhancing response rates and improving your overall customer feedback experience. If you have any questions or need assistance with Feefo's API integration, feel free to reach out to our technical support team. They are ready to guide you through the process and ensure a smooth integration with your business processes.