eCommerce
<?php
// After order confirmation
function sendPostPurchaseReward($customerEmail, $orderAmount, $orderNumber) {
$curl = curl_init();
$payload = [
"contacts" => [$customerEmail],
"title" => "Thank You for Your Purchase!",
"description" => "Enjoy this special gift as a token of our appreciation.",
"metadata" => [
"orderNumber" => $orderNumber,
"orderAmount" => $orderAmount
]
];
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.giftoin.org/api/v1/gcm/reseller/campaign/YOUR_CAMPAIGN_ID/order',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'x-gft_api_key: YOUR_API_KEY',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
return json_decode($response, true);
}
?>Last updated