Automatic License Generation and PayPal sandbox

When I have the paypal sandbox turned on, the automatic product licensing does not occur and I do not get an email with my product key(s).My LimeLM dashboard does not show any newly generated product keys.Is this supposed to work in sandbox mode? If not, debugging is going to be expensive!

Set the "PayPalEmail" variable with the sandbox email you created earlier and set the "PayPalSandbox" variable to "true". PayPal sandbox transactions:To Subject Datesnow@redwillow.com Item #1 - Notification of Payment Received from Patty Snow (pattysnow@cox.net) 24 Jan 2019 13:17:34 pattysnow@cox.net Receipt for Your Payment to Patricia Snow's Test Store 24 Jan 2019 13:17:34

Use the debug logs. We can't debug these things for you. It depends on your server configuration. Either hire a server admin or use a payment provider like FastSpring: https://wyday.com/limelm/help/automate-license-generation-with-fastspring/

yes, I know. I just wanted to know if when the PayPal sandbox is turned on, does your system (your example code and server side software) recognize it as a real payment and proceed with the product key generation?

LimeLM web API doesn't distinguish between "fake" or "sandbox" and "real" requests. A request is a request.

The request is made in PaymentSettings .cs / .vb / .php. Open the file in your favorite editor. Search for "LimeLM" or "GeneratePKey(" and you'll find where the code is called.

Can I write to the log files in the \logs\LimeLM API folder?

You can write them wherever you want. Configure it in the PaymentSettings file and make sure your server has the correct permission set for that file and/or folder.

code snippet please for paymentsettings.cs to write to the log file.

Search PaymentSettings for log and youll see the the setting for the log file location and whether to enable the log. Basically just go to that file and start at the top and read your way down. Its not long and its well commented.

that option is available in the PaymentSettings.php but NOT in the PaymentSettings.cs or .vb files.

Because in ASP.NET you can attach a debugger. Google "how to attach a debugger to ASP.NET"

this does not solve my problem. Because my code (which is just like your sample code) is not generating product keys, I want to log the SendPKeys response when running on the ACTUAL WEB SERVER, not localhost. This line is in the logfile on the server:2019-01-27 19:39:32 100.42.52.207 GET /Payment.aspx - 443 - 184.183.114.173 ....I am stuck trying to figure out why the SendPKeys is not working. 2 days wasted.

Can you please just itemize what I need to double check so SendPKeys will start working!

>> "Can you please just itemize what I need to double check so SendPKeys will start working!"

Covered here: https://wyday.com/limelm/help/how-to-generate-product-keys-after-order/

>> "I am stuck trying to figure out why the SendPKeys is not working. 2 days wasted."

The problem is entirely in your configuration. We don't control your configuration. You have a few options:

1. Attach a debugger to your remote host (yes, this is possible -- google it).

2. Add logging to the code to see where things are going off the rails (google how to write to text files in C# or VB.NET, there are thousands of examples).

3. Use a 3rd party that just handles the payments (like FastSpring).

log - gets to "here 1" but never to "here2" after creating new myWriter; any ideas?

bool ValidatePP() { using (StreamWriter logFile = new StreamWriter(Server.MapPath("~/logs/log.txt"),append: true)) { logFile.WriteLine("Payment status: " + Request.Form["payment_status"]); // Write the file. logFile.WriteLine("email: " + Request.Form["receiver_email"]); logFile.WriteLine("ppemail: " + PaymentSettings.PayPalEmail); logFile.WriteLine("quantity: " + Request.Form["quantity"]); logFile.WriteLine("mc_currency: " + Request.Form["mc_currency"]); // Only send a product key if the payment has completed successfully if (Request.Form["payment_status"] != "Completed") { logFile.WriteLine("error: status"); return false; }

// make sure we're getting the money // if (Request.Form["hpulijala@gmail.com "] != PaymentSettings.PayPalEmail) if (Request.Form["receiver_email"] != PaymentSettings.PayPalEmail) // sandbox { logFile.WriteLine("error: email"); return false; }

int quantity = Convert.ToInt32(Request.Form["quantity"]);

// form the POST string to validate with PayPal's servers StringBuilder postString = new StringBuilder();

for (int i = 0; i < Request.Form.AllKeys.Length; i++) { String key = Request.Form.AllKeys; logFile.WriteLine("key: " + key); // exclude hidden ASP.NET hidden fields beginning in "__" if (key.Substring(0, 2) != "__") { postString.Append(HttpUtility.UrlEncode(key)); postString.Append("="); postString.Append(HttpUtility.UrlEncode(Request.Form)); postString.Append("&"); } } postString.Append("cmd=_notify-validate"); string post_string = postString.ToString(); logFile.WriteLine("post_string: " + post_string); // Write the file. // create an HttpWebRequest object to communicate with PayPal HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(PaymentSettings.PayPalSandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr"); objRequest.Method = "POST"; objRequest.ContentLength = post_string.Length; objRequest.ContentType = "application/x-www-form-urlencoded"; objRequest.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate"); logFile.WriteLine("here 1"); // post data is sent as a stream StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()); logFile.WriteLine("here 2"); myWriter.Write(post_string); myWriter.Close(); string post_response; HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); Stream responseStream = objResponse.GetResponseStream(); if (objResponse.ContentEncoding.ToLower().Contains("gzip")) responseStream = new GZipStream(responseStream, CompressionMode.Decompress); else if (objResponse.ContentEncoding.ToLower().Contains("deflate")) responseStream = new DeflateStream(responseStream, CompressionMode.Decompress); using (StreamReader streamReader = new StreamReader(responseStream)) { post_response = streamReader.ReadToEnd(); } logFile.WriteLine("post_response: " + post_response); // PayPal returns "VERIFIED" if it's a valid order return post_response.Contains("VERIFIED"); } }

narrowed it down. PaypPal sandbox is turned on...is "https://www.sandbox.paypal.com/cgi-bin/webscr" correct?

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(PaymentSettings.PayPalSandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr");

objRequest.Method = "POST";objRequest.ContentLength = post_string.Length;objRequest.ContentType = "application/x-www-form-urlencoded"; objRequest.Headers.Add(HttpRequestHeader.AcceptEncoding,"gzip,deflate");

logFile.WriteLine("here 1");try { StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream());-- catch: "The request was aborted: Could not create SSL/TLS secure channel."

As I've said: a configuration problem on your end. Ensure you're using a .NET Framework version that supports TLS 1.2 to connect to PayPal.

E.g.: https://stackoverflow.com/a/2904963/124805