• Sending license key codes

  • After a successful purchase the key code, license code or mobile phone pin number is extracted from the database.

    First, the number of license codes is calculated and checked against the lower limit. If the number of codes has reached the lower limit, then an email is sent to the site administrator. The top license code is extracted and the remainder saved to the database.

    The functionality is provided by three functions which could be modified if there is a requirement to extract the key codes from a different location or to provide a key code calculated from other details.

    It could be possible to create a pin or license key based on the purchaser's name for example.

    The three functions are :

    • getnoofkeycodes returns the number of key codes that are in the database for this item
    • getlowerlimit returns the number defined in the database for the lower limit of key codes
    • getnextkeycodes returns the next key code, (or key codes), and removes it, (or them), from the database

    The files /keycodes/keycodes_paypal.php provide the above functionality.

    The number of key codes that are sent out with each purchase is set to 1. This can be changed in /ipncommon/com_ipnfunctions.php at around line 422. Change the number of key codes to retrieved to what you require.

  • Selling your codes with PayPal

    PHP-KeyCodes takes the IPN data from PayPal, carries out security checks to make sure the details are correct, then emails the purchaser with the next key code or license key, all without any intervention by yourself.

    Instant Payment Notification (IPN) is the method that PayPal uses to automatically notify a defined web page when a PayPal payment has been made. The method is a well established and secure system to deliver your license key codes. For a complete description refer to the PayPal IPN Manual which you can find on the http://www.paypal.com/ipn site.

    The principle that PayPal uses is as follows : You first create a PayPal 'buy now' button and place it on your web page or create the buttons dynamically from a database. When someone clicks on your 'buy now' button, PayPal posts data to the web page you defined during IPN set up. Your web page must then respond back to the paypal site.

    After PayPal has confirmed the payment, it posts data back to your web page. If payment is correctly completed, PayPal sends 'completed' to your web page along with other data which your site can monitor. Once completed has been received by your web page, you process the data in whatever way you want.

    The way in which IPN works using the 'handshake' method means that there is no requirement for an https SSL site. This simplifies the installation requirements for the site.