Skip to content

Instantly share code, notes, and snippets.

@iesta
Last active August 29, 2015 14:01
Show Gist options
  • Save iesta/9ac5701062f018bb93a5 to your computer and use it in GitHub Desktop.
Save iesta/9ac5701062f018bb93a5 to your computer and use it in GitHub Desktop.
Example of use of luckycycle php lib to access api
require_once dirname(__FILE__).'/luckysdk/lucky.php';
// get API keys on https://www.luckycycle.com
$url = 'https://www.luckycycle.com';
$api_key = 'XXXXXXXXXXXXXXXX';
$op = 'XXXXXXXXXXXXXXX';
$req = new LuckyCycleApi($url);
$req->setApiKey($api_key);
$req->setOperationId($op);
$pokedata = array(
'user_uid' => (string)$order->id_customer,
'item_uid' => (string)$order->id,
'item_value' => (string)$order->total_paid,
'item_currency' => $currency->iso_code,
'language' => $lang->iso_code,
'firstname' => $customer->firstname,
'lastname' => $customer->lastname,
'email' => $customer->email,
);
try
{
$poke = $req->poke($pokedata);
} catch (Exception $e) {
// TODO : handle this case...
error_log( print_R($e->getMessage(),TRUE) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment