Using Zygodact key generator with FASTSPRING
This document describes the steps how to build a remote license generator with LiveCode server and Zygodact to use with FASTSPRING.
This document does not describe the basic setup steps for the FASTSPRING seller account nor the steps how to add a product to your FASTSPRING seller account.
1. Requirements
You need
- A cgi key generator stack gen.rev, created with Zygodact Key Generator http://hyperactivesw.com/solutions_zygodact.html
- A hosting account with LiveCodeServer commercial. The community edition of LiveCodeServer does not work with Zygodact.
- A FASTSPRING seller account
- At least one product in the FASTSPRING seller account.
2. Adding the fullfilment action
In your FASTSPRING account under Products and Pages open your product and click on Add under Fulfillment Actions
4. Configure Remote License - General
- Enter the URL to your license script.
- Select HTTP POST (recommended)
- Select UTF-8
- Select Single License Only
- press Create
5. Configure Remote License - Security
- Copy your Private Key. You will need it for your LivecodeServerScript.
Note: Please do not use the private key from the image below. This is just a sample. Your private key looks different.
Please don´t publish your private key!
6. Configure Remote License - Parameters
- Select the value Email Address for the parameter name, because i am using the customers email address for creating the license key in my sample script.
- Click Save
7. The script as an image
Copy the cgi stack "gen.rev" and your LiveCodeServer script onto your webserver.
Please take care that the storage path matches the URL you´ve entered in the FASTSPRING for the Remote License.
8. The Script as text (you can copy it)
<?lc
global gname, gserial
-- Check if your script is called from FASTPRING, you will need your private key, which you copied from your FASTSPRING account.
put "" into tConcatenate
put "YourFastspringPrivateKeyGoesHere" into tPrivateKey
put the keys of $_post into tList
sort tList ascending
filter tlist without "security_request_hash*"
repeat for each line tLine in tList
put $_post[tLine] after tConcatenate
end repeat
put tPrivateKey after tConcatenate
put md5Digest(tConcatenate) into tDigest
get binarydecode("H*",tDigest,myHash)
if myHash is not $_post["security_request_hash"]
then
put "unauthorized call"
exit to top
end if
-- check end-- I use the customers email as registration name,
-- because the email address does not contain any foreign characters like characters with accents
put $_post["email"] into gName
-- now start the keygen stack. The stacks uses the global gName and creates the appropriate license key for it
start using stack "gen.rev"
if gSerial = "" then put "There was an error creating the license key" into gSerial
put gSerial
?>
9. A simple Test in your browser
1. Open the URL to your script in your web browser
2. You should just see a "unauthorized call"
11. Test result
- If the test is successful then you can see a license key under Licenses Captured.
If you see unauthorized call instead of a license key, then that would mean, that your script is using the wrong private key or there is an error in the script part which is responsible for the security check.
If you see a LiveCodeServer error, then there is some error in the script.
12. The script is working. That´s it, isn´t it?
Yes and No.
Yes, the remote license web service is working now.
And No.
To get an email with the license key sent to the customer you need to add a 2nd Fullfilment action.
- This time select Send Email / Show Web Notification.
- Click Next
13. Configure Email and Web Notification
On this Webpage you can now edit the email and web page delivery notification. You can even create multilingual notifications.
- Edit the template for plain text emails. See Sample License Delivery Email Template for more information
- Edit the template for html emails (optional). See HTML Email Content for more information
- Edit the template for the template for the web delivery (optional)
- Edit the phrases for multilanguage emails (optional). In my example i am using Template Code Logic for translations. See Translating Notification Emails for more information
- Edit some advanced options (optional)
- Click Save
14. That´s it!
You´re done.
Happy selling!
0 Comments
Add your comment