bright, fresh software
Downloads  |  Buy

Product key Activation

Product key Activation

Postby vertex » February 3rd, 2012, 2:20 am

Hai,

we already use LimeLM Product key option for last 2 years.Now we integrate payment option(money bookers) also. how to generate product key in our application itself.
please help for below the option,
In our application after payment is finished .
How to generate the product key and also how to send the product key to client E-Mail in our application
please help with sample codes.
vertex
 

Re: Product key Activation

Postby Sam » February 3rd, 2012, 10:20 am

We show how to generate product keys after an order in the How to generate product keys after an order article.

What server language are you using (PHP, C#, etc.)?
User avatar
Sam
 
Posts: 2033
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Product key Activation

Postby vertex » February 3rd, 2012, 11:50 pm

Hai,

Am using server language is PHP. Already follow this How to generate product keys after an order article only.
but payment only complete not generate the product key. what problem have please help me with sample code.

thanks.
vertex
 

Re: Product key Activation

Postby Sam » February 4th, 2012, 12:33 am

In the PaymentSettings.php file you should set the "$debug" variable to true and set the "$debug_log" variable to a path that is writeable by PHP scripts. Then, run the order process again. After it fails, open the "payment_debug.log" file and read what the error was. Or paste it here and I'll help you from there.
User avatar
Sam
 
Posts: 2033
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Product key Activation

Postby vertex » February 4th, 2012, 2:15 am

Hai,

In the PaymentSettings.php file,

$debug=true;
$debug_log = dirname(__FILE__).'/payment_debug.log';

payment_debug .log this files is not having the web api (php folder). run the payment.php file at time show the error is Debugging turned on--All actions will be logged to log file.
how to solve this error and how to use payment_debug.log.
please help me.


thanks,
vertex
 

Product key Activation

Postby vertex » February 4th, 2012, 2:21 am

hai

i will use that coding only for paymentsetting.php any change is need please update there...

paymentsetting.php

<?php
//TODO: Set the following constants. All URLs must be publicly accessible.
// See http://wyday.com/limelm/help/how-to-generate-product-keys-after-order/
// to learn how to configure the payment form and set everything up.

//==== General Config ====

//TODO: disable debug & sandbox when you're using this on your live site.

// Enable debug logging
$debug = true;
$debug_log = dirname(__FILE__).'/payment_debug.log';


// Set any of the following 4 boolean values to either
// true or false based on whether you're using that
// particular payment method. "payment.php" automatically
// shows or hides the payment method based on these boolean
// values.

// If you set a payment setting to true then you'll also
// have to configure the payment settings for that
// particular payment method below.
$UseAuthorizeNetCC = true;
$UseAuthorizeNetBank = true;
$UseMoneybookers = true;
$UsePayPal = true;


// dollars, cents
$AppPrice = array(1, 00);
$Currency = 'USD';

// The currency symbol that the end-user will see.
// If you're not using "$" then you should use
// the HTML-entity equivalent of the symbol.
// Your customers will see the symbol.

// € = &euro;
// £ = &pound;
// ¥ = &yen;
// etc.
$CurrencySign = '$';

$CompanyName = 'VERTEX';
$AppName = 'SPINSOFT';

// api key found in http://wyday.com/limelm/settings/
$LimeLM_ApiKey = '<snip>';

// the version id is found in the url.
// For example http://wyday.com/limelm/version/100/ the version id is '100'.
$LimeLM_VersionID = '160';

// URL of the "paychecker.php" script.
// This is where Moneybookers and PayPal orders are confirmed and processed.
// If you're not using Moneybookers or PayPal then you don't have to set this.
$CheckScript = 'http://example.com/buy/paychecker.php';

// Where the user can buy your products
$BuyPage = 'http://example.com/buy/payment.php';

// Thank you page (once payment is made, user is sent to this page)
$ThankYouPage = 'http://example.com/buy/pay-thankyou.php';

// The logo to display on the PayPal / Moneybookers checkout
// this site must be HTTPS or it won't display.
// Maximum size (PayPal): 150px (width) by 50px (height)
// Maximum size (Moneybookers): 200px (width) by 50px (height)
$YourLogo; // = 'https://example.com/buy/toplogo.png';




//==== Authorize.Net Config ====

// the API Login ID and Transaction Key must be replaced with valid values
$AuthNetLogin = 'PASTE LOGIN HERE';
$AuthNetTansKey = 'PASTE Transaction Key HERE';
$AuthNetTest = false;




//==== PayPal Config ====

// Use PayPal Sandbox (set to false on your live server)
$PayPalSandbox = false;

// Paypal Email
$PayPalEmail = 'your@email.com';




//==== Moneybookers Config ====

// Your Moneybookers email
$MBEmail = 'sudhavs86@gmail.com';

// Set the "Secret Word" in your Moneybookers account
// on the "Merchant tools" page. Then set it here.
$SecretWord = '<snip>';




function debug_log($message, $success, $end = false)
{
global $debug, $debug_log;

if (!$debug || !$debug_log)
return;

// Timestamp
$text = '['.date('m/d/Y g:i A').'] - '.(($success)?'SUCCESS :':'FAILURE :').$message. "\n";

if ($end)
$text .= "\n------------------------------------------------------------------\n\n";

// Write to log
$fp=fopen($debug_log, 'a');
fwrite($fp, $text);
fclose($fp);
}

function SendPKeys($quantity, $email, $first, $last)
{
//Note: we put LimeLM in this directory. Change it as needed.
require('LimeLM.php');

global $LimeLM_VersionID, $LimeLM_ApiKey;

$errors = false;

// set your API key
LimeLM::SetAPIKey($LimeLM_ApiKey);

try
{
// Generate the product key - set the number of activations using the quantity
$xml = new SimpleXMLElement(LimeLM::GeneratePKeys($LimeLM_VersionID, 1, $quantity, $email));

if ($xml['stat'] == 'ok')
{
foreach ($xml->pkeys->pkey as $pkey)
{
// add a newline if you're generating more than one key
if ($product_keys)
$product_keys .= "\r\n";

// set the product key
$product_keys .= $pkey['key']."\r\n";
}
}
else //failure
{
// use the error code & message
debug_log('Failed to generate product keys: ('.$xml->err['code'].') '.$xml->err['msg'],false);
}
}
catch (Exception $e)
{
debug_log('Failed to generate product keys, caught exception: '.$e->getMessage(),false);
}

if (empty($product_keys))
{
// the product key didn't generate, don't send e-mail to the customer yet.
$errors = true;
}

// form the customer name
$customerName = $first;

if (!empty($last))
// append the last name
$customerName .= ' '.$last;

$emailBody = $customerName.',

Thank you for your order. Your product key is:

'.$product_keys.'


This product key is licensed for '.$quantity.( $quantity > 1 ? ' users' : ' user' ).' of '.$AppName.'.

Thank you,

'.$CompanyName;

if (!empty($product_keys))
{
// Send Email to the buyer
$emailSent = mail($email, 'Your '.$AppName.' product key', $emailBody,$headers);
}

// generate an array you can insert into your database
$new_order_info = array(
'quantity_licenses' => $quantity,
'pkey' => $product_keys,
'pkey_emailed' => $emailSent ? '1' : '0', // 0 = no, 1 = yes
'first_name' => $first,
'last_name' => $last,
'email' => $email
);

//TODO: delete logging, or log to a safe location (not accessible to outside world)
debug_log('TODO: Insert array into db: '."\r\n\r\n".print_r($new_order_info, true), true);

if (!$emailSent)
{
$errors = true;
debug_log('Error sending product Email to '.$email.'.',false);
}

LimeLM::CleanUp();
}
?>



thank you please help me...
vertex
 

Re: Product key Activation

Postby Sam » February 4th, 2012, 12:06 pm

You didn't set the $CheckScript, $BuyPage, or $ThankYouPage variables. These all must be set to your URLs. Also, if you're not using paypal or Authorize.NET then you should set $UsePayPal, $UseAuthorizeNetBank , and $UseAuthorizeNetCC all to false.
User avatar
Sam
 
Posts: 2033
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Product key Activation

Postby vertex » February 6th, 2012, 12:50 am

Hai

Now use for Paymentsetting.php coding is
<?php
//TODO: Set the following constants. All URLs must be publicly accessible.
// See http://wyday.com/limelm/help/how-to-generate-product-keys-after-order/
// to learn how to configure the payment form and set everything up.

//==== General Config ====

//TODO: disable debug & sandbox when you're using this on your live site.

// Enable debug logging
$debug = true;
$debug_log = dirname(__FILE__).'/payment_debug.log';


// Set any of the following 4 boolean values to either
// true or false based on whether you're using that
// particular payment method. "payment.php" automatically
// shows or hides the payment method based on these boolean
// values.

// If you set a payment setting to true then you'll also
// have to configure the payment settings for that
// particular payment method below.
$UseAuthorizeNetCC = false;
$UseAuthorizeNetBank = false;
$UseMoneybookers = true;
$UsePayPal = false;


// dollars, cents
$AppPrice = array(1, 00);
$Currency = 'USD';



$CurrencySign = '$';

$CompanyName = 'VERTEX';
$AppName = 'SPINSOFT';

// api key found in http://wyday.com/limelm/settings/
$LimeLM_ApiKey = 'ee9335e4ce0c33522d773.93125420';

.
$LimeLM_VersionID = '160';


$CheckScript = 'http://aaraa.co.in/testing/payment/paychecker.php';

// Where the user can buy your products
$BuyPage = 'http://aaraa.co.in/testing/payment/payment.php';

// Thank you page (once payment is made, user is sent to this page)
$ThankYouPage = 'http://aaraa.co.in/testing/payment/pay-thankyou.php';


$YourLogo; // = 'https://example.com/buy/toplogo.png';




//==== Authorize.Net Config ====

// the API Login ID and Transaction Key must be replaced with valid values
$AuthNetLogin = 'PASTE LOGIN HERE';
$AuthNetTansKey = 'PASTE Transaction Key HERE';
$AuthNetTest = false;




//==== PayPal Config ====

// Use PayPal Sandbox (set to false on your live server)
$PayPalSandbox = false;

// Paypal Email
$PayPalEmail = 'your@email.com';




//==== Moneybookers Config ====

// Your Moneybookers email
$MBEmail = 'sudhavs86@gmail.com';

// Set the "Secret Word" in your Moneybookers account
// on the "Merchant tools" page. Then set it here.
$SecretWord = '3067108';




function debug_log($message, $success, $end = false)
{
global $debug, $debug_log;

if (!$debug || !$debug_log)
return;

// Timestamp
$text = '['.date('m/d/Y g:i A').'] - '.(($success)?'SUCCESS :':'FAILURE :').$message. "\n";

if ($end)
$text .= "\n------------------------------------------------------------------\n\n";

// Write to log
$fp=fopen($debug_log, 'a');
fwrite($fp, $text);
fclose($fp);
}

function SendPKeys($quantity, $email, $first, $last)
{
//Note: we put LimeLM in this directory. Change it as needed.
require('LimeLM.php');

global $LimeLM_VersionID, $LimeLM_ApiKey;

$errors = false;

// set your API key
LimeLM::SetAPIKey($LimeLM_ApiKey);

try
{
// Generate the product key - set the number of activations using the quantity
$xml = new SimpleXMLElement(LimeLM::GeneratePKeys($LimeLM_VersionID, 1, $quantity, $email));

if ($xml['stat'] == 'ok')
{
foreach ($xml->pkeys->pkey as $pkey)
{
// add a newline if you're generating more than one key
if ($product_keys)
$product_keys .= "\r\n";

// set the product key
$product_keys .= $pkey['key']."\r\n";
}
}
else //failure
{
// use the error code & message
debug_log('Failed to generate product keys: ('.$xml->err['code'].') '.$xml->err['msg'],false);
}
}
catch (Exception $e)
{
debug_log('Failed to generate product keys, caught exception: '.$e->getMessage(),false);
}

if (empty($product_keys))
{
// the product key didn't generate, don't send e-mail to the customer yet.
$errors = true;
}

// form the customer name
$customerName = $first;

if (!empty($last))
// append the last name
$customerName .= ' '.$last;

$emailBody = $customerName.',

Thank you for your order. Your product key is:

'.$product_keys.'


This product key is licensed for '.$quantity.( $quantity > 1 ? ' users' : ' user' ).' of '.$AppName.'.

Thank you,

'.$CompanyName;

if (!empty($product_keys))
{
// Send Email to the buyer
$emailSent = mail($email, 'Your '.$AppName.' product key', $emailBody,$headers);
}

// generate an array you can insert into your database
$new_order_info = array(
'quantity_licenses' => $quantity,
'pkey' => $product_keys,
'pkey_emailed' => $emailSent ? '1' : '0', // 0 = no, 1 = yes
'first_name' => $first,
'last_name' => $last,
'email' => $email
);


debug_log('TODO: Insert array into db: '."\r\n\r\n".print_r($new_order_info, true), true);

if (!$emailSent)
{
$errors = true;
debug_log('Error sending product Email to '.$email.'.',false);
}

LimeLM::CleanUp();
}
?>



This coding only use...
Paymentsetting.php code only change other coding is no change...
payment for money transaction is correctly working but not send product key for email...

please help me.....
vertex
 

Re: Product key Activation

Postby Sam » February 6th, 2012, 5:26 am

Did you upload all the necessary files (LimeLM.php, PaymentSettings.php, paychecker.php, payment.php)?

If there's an error happening then you should read the debug log, like I said earlier.

Did you read the debug log? Is the debug log being written? Does PHP (or Apache) have permission to write to the debug log? If not, change the "$debug_log" variable to point to a file that PHP can actually write to.
User avatar
Sam
 
Posts: 2033
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Product key Activation

Postby vertex » February 6th, 2012, 11:09 pm

Hai,

I upload all the necessary files (LimeLM.php, PaymentSettings.php, paychecker.php, payment.php)
error:
Debugging turned on — All actions will be logged to log file. this error only come.

$debug = true;
$debug_log = dirname(__FILE__).'/payment_debug.log';

dubug log related this two variables only used..

not have in the payment_debug.log file.

how to write the payment_debug_log file... please help me....
vertex
 

Next

Return to LimeLM & TurboActivate Support