In order to be able to automatically create licenses when your users make a purchase three things must be in place:
- Your payment provider must be able to issue instant notifications over http
- You must have a ASP.Net web server running 24/7
- You need a customized license generation script/web page
Most payment providers support instant payment notification (sometime known as IPN), but check before you sign up. A few well known providers that do support notifications over http are Pay Pal, Fastspring, Clickbank, Kagi.
The script that will be issueing licenses must be running 24/7, even if you are only selling to users in your local timezone people can still make purchases at 03:30 in the morning. Another issue is that even though the payment providers attempt to send notifications directly there is no guarantee that they will. Technical and network issues can delay the notifications which is also a reason to makes sure that your server is up 24/7.
The server requirements for the license issueing scripts are only that they can run .Net scripts or web pages. The samples provided are based on ASP.Net web forms but you can also implement the service using MVC, HTTPHandlers, WCF services or any other means that can receive a network request over http. Most payment providers don't require that you have SSL for the instant notification (although they support it) since the message itself doesn't contain sensitive payment data.
Much of the license generation logic is the same independant of your payment provider but you need to adapt the scripts to your own needs and the setup your payment provider has. Some payment providers also send a checksum with the notification which is a message signature generated using a secret which is only available on your management pages with that provider, the secret is never sent to you with the notifications so you must copy it into your script and add the relevant checks based on what the payment provider recommends. Usually your notification handler will receive notifications for several events not just sales, so you must check what data your provider will send and modify the code to verify that it is a sale before generating a license.
This is how license generation using the Simple Software Licensing components works:
- A buyer visits your website and clicks on a link to pay for the product.
- The buyer is transferred to the payment providers website to complete the transaction.
- Your payment provider verifies the transaction details.
- Your payment provider sends a notification to your notification endpoint
- Your script verifies the data send from the provider and returns a response to the provider.
- There are two ways that the notification response can be handled by your payment provider. Either they just expect a simple OK (http status code 200) or they also expect a structured message containing the license details in the body of your response to them. If your payment provider doesn't send the license details to the buyer then there is an additional step required.
- Your script sends an email containing the license information to the buyer.
- You should always send an email to yourself with a copy of the license or store issued licenses on the server. Currently there is no way to import automatically issued licenses into you local License Manager but this is a feature that will be coming in a future release.