• Adding buy now buttons

  • 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.

  • 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.

  • 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.

  • 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">