• Buy now buttons to sell software license keys

  • PHP-KeyCodes

    PHP-KeyCodes PayPal buttons

    To create a PayPal buy now button, go to the 'Product List' page in the admin area. Against each product is a 'Show button' link which takes you to a button generator page where you can copy the text and paste it on to your web page.

    Clicking on a 'Buy now' button immediately takes you to the checkout where the customer can buy the defined license key code.

    The button or buttons may be placed anywhere on an existing web page which makes it easy to integrate into an existing design. The web page can be of php extension or an ordinary htm page.

    <form action="http://www.yourservername/phpkeycodes/ipn/process.php" method="post">
    <input type="hidden" name="recid" value="1">
    <input type="hidden" name="quantity" value="1">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>

    The fields that you enter to create the button are :
    • The action url is http://www.yourservername/phpkeycodes/ipn/process.php assuming that you have installed PHP-KeyCodes at the root of your web site in a folder called 'phpkeycodes'.
    • The recid value is the recid for the product you wish to create the button for. This is the value from the Products display of the admin pages.
    • The quantity value is the quantity which is can be left out and has a default value of 1.
    • The image can be any of the PayPal images or one of your own.

    Click on the following button which shows what happens when someone wants to buy from PHP-KeyCodes.

    When the purchaser clicks on the buy now button, the php script will extract all the relevant data from the database and post it to the PayPal server.

  • PHP-KeyCodes

    Changing the quantity

    You can change the quantity of the key codes that you are sending by simply changing the quantity field in the button.

    When the purchaser clicks on the buy now button, the php script will extract the required quantity of key codes from the database. The purchaser will then recieve an email with more than one key code.

    If you wish to allow the customer to define the quantity themselves, you can easily do that by having a drop down list or a text inbox for the quantity field.

  • PHP-KeyCodes

    Adding a text box for customer input

    PayPal has a field called 'custom' which is a pass through field where any data entered into the field will be passed unchanged to PayPal and returned within the IPN.

    In PHP-KeyCodes, entering text into the custom field is returned with the IPN payment details and the data is stored in the tblsaleshistory table along with all the other PayPal details and the purchased license codes.

    This allows you to request details from the customer such as a customer reference number or Phone model.

    To do this, add a text input box to the form field which will look like the following :


    Customer input :

    The code for the button is as follows:

    <form action="http://www.yourservername/phpkeycodes/ipn/process.php" method="post">
    <input type="hidden" name="recid" value="1">
    <input type="hidden" name="quantity" value="1">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!">
    Customer input : <input type="text" name="custom" class="inputbox" />
    </form>

    The only addition is a text input box with a name of "custom".

    The custom variable has a maximum size of 255 characters.

  • PHP-KeyCodes

    How to send a free license key code or pin number

    There is the facility to allow you to send a key code to a customer without them paying for it and for them to enter their email address for registration purposes.

    The free button functions are located in the folder /free/

    The file free_button.html gives an example of the button that is placed on a web page. The action entry of the form has to be changed to point to the full url of the free page default.php

    So the action url would look something like:

    http://www.yourserver.com/phpkeycodes/free/default.php

    depending on the installation folder of PHP-KeyCodes.

    Example code for a free button : (Note that this is not the same code as the buttons that are displayed against the products in the admin area of PHP-Keycodes).

    <form name="free" method="post" action="http://www.yourserver.com/phpkeycodes/free/default.php">
    Your email address :
    <input type="text" name="txtEmail" />
    <input type="hidden" name="send" value="send" />
    <input type="submit" name="Submit" value="Make Sell" class="inputsubmit" />
    </form>

    The file /free/default.php is the file that does the processing and in the top of the file there is the record id of the product item that you are giving away. This is the record id in the database table, tblitems. So you need to open the file /free/default.php in a text editor and then change the record id.

    At the bottom of the file, there is an html results page that can be modified to say whatever is required.

    Place the button on your web page. The customer enters their email address and the license code is sent to that email address.

    Note: You must also set the value of the product to 0.00 in the admin area of PHP-KeyCodes otherwise it will not work.

  • PHP-KeyCodes

    Adding Tax (VAT) to your purchases

    To add Tax to a purchase, the button code becomes:

    <form action="http://www.yourservername/phpkeycodes/ipn/process.php" method="post">
    <input type="hidden" name="recid" value="1">
    <input type="hidden" name="tax" value="20">
    <input type="hidden" name="quantity" value="1">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!">
    Customer input : <input type="text" name="custom" class="inputbox" />
    </form>

    In the example above, tax of 20 percent will be added on to the cost by using the extra field:

    <input type="hidden" name="tax" value="20">

  • PHP-eSeller

    Conventional PayPal Buttons

    If you wish, you may want to use standard PayPal buttons. You may do this using the PayPal cart factory, but you have to becareful to enter in the correct item name, item number, cost and currency or otherwise PHP-KeyCodes will not match the values to the database and hence the purchase will fail.

    This method allows you to add onto an existing set of PayPal buttons so that you can continue using your existing payment set up.

    The advantage with creating buttons through PayPal is that you can add on other selling details which are not available in PHP-eKeyCodes.

    The PayPal cart factory at :
    https://www.paypal.com/cgi-bin/webscr?cmd=_cart-factory
    is used to create various buy now buttons.


  • PHP-eSeller

    Creating conventional PayPal Buy Now button

    Go to :

    https://www.paypal.com/cgi-bin/webscr?cmd=_cart-factory

    PayPal create button
    • Select the radio 'Buy Now' button option.
    • In 'Item Name', enter in a description of the product.
    • In 'ItemID', enter in the item number of the product which must match the item number that you entered when you created the product in PHP-KeyCodes.
    • In 'Price', enter in the price of the product which must match the price entered in PHP-KeyCodes.
    • In 'Currency', enter in the currency which must be the same as you entered in the PHP-KeyCodes.
    • You may want to set the postage to 0.00 to prevent any postage calculations being added to the digital product. To do this make sure you select the "use specific amount" radio button.
    • Select 'Use my primary email address' radio button.
    • In the 'Customise advanced features' section, (Section 3), there is a section called "Add advanced variables". Tick the tick box and enter in :
      notify_url=http://www.yourserver.com/keycodes/ipn/confirm.php

      You need to enter in the notify_url which can be found in the admin section of PHP-KeyCodes global set up page. In the above example, it is assumed that PHP-KeyCodes is installed in the folder /keycodes/.

      You can also optionally add in a "return url" and a "cancel url" in Section 3.

    • Click on Create Button or Save Changes and copy the button code on to your web site.

     

    Example Buy Now Button

     

    The values entered in this button much match all the product item details becuase the values will be checked by the confirm.php file. The advantage is that you can enter specialised PayPal variables. The button is also encrypted, but that should not be an issue as the confirm.php script checks the values anyway. The disadvantage is that if you change price or other value, you have to recreate the button.