Ok, so I set up my 2checkout script, but I still have problems.
My customers are not returning to the site the way they should.
I’m using the MD5 encryption method with the secret word to verify my orders.
When I test this in DEMO mode, using “1″ (without the quotes) as the “order_number”, it works perfectly fine.
But, with real orders (not in DEMO mode), the script doesn’t work. When not using demo mode, I use $_POST['order_number'] as the order number coming from 2checkout.
For some reason, there is still something missing.
Any ideas?
I mean…if demo mode works, why can’t real orders work as well? The only difference is the “order_number”, right?
2 Comments »
+0
-0
FWIW, this functionality works fine for me on both demo and real orders.
Here are some snippets from the custom Perl script that I use:
$demo = 0;
$secret = “wonttellwhatitis”;
$key =~ tr/A-Z/a-z/;
$check = md5_hex($secret . $sid . $order_number . $total);
# Demo mode requires this
$check = md5_hex($secret . $sid . “1″ . $total) if ($demo && $key ne $check);
fail undef, “bad key” unless ($key eq $check);
(where “fail” is a custom function).
+0
-0
I forgot to post back here.
The problem was that I kept checking for a “demo” parameter POSTED with the value “N”. With live orders, the “demo” parameter is never passed back.
So…instead…I check that there is NOT a “demo” parameter with the value “Y”. I realize that this is not necessary, since the MD5 encryption method caters for that. I just included it anyways.
Thanks for the help