PayPal is in some aspects really cool and simple to use, but then there are a few areas one can butt ones head endlessly against a wall with it. What I needed was 2 BUY NOW buttons – one with a custom image, sending an email to the buyer with a download URL after successful PayPal completion; the other button being a standard PayPal button and directing the person to a simple THANK YOU page as the item was to be shipped after purchase – and both buttons had to take into account the location of the buyer and apply sales taxes if applicable. Hopefully the following can help in similar situations.

  1. If you need anything more complex than a simple BUY NOW button, ensure to sign up for a SANDBOX account [Sandbox User Guide]. And then do some testing, testing and some more testing is what you want to do before going live.
  2. Paypal talks about a listener file and IPN [Instant Payment Notification] – in the end I created a specific PHP file for this purpose alone [IPN User Guide]. I like the fact that different other PHP files can access the same data (this on a server where register_globals is set to true.
  3. Activate IPN. You find the link to it under the ACCOUNT PROFILE. You need the URL to the listener file. If you want to, you can test the IPN link within the Sandbox, but you will need to remember to change the receiver_email to something you can use (e.g. to receive truly an email) as these Sandbox accounts are setup with fictitious data only.
  4. Setup TAX information. You do this also under the ACCOUNT PROFILE. Here you can setup what the sales taxes are for your own state. Very handy.
  5. Create the first button: I started with the one which used a custom button image and would trigger an email with a download link.
    • Give the item a name.
    • Add an Item ID [this is useful for later manipulation].
    • Here you select to use a custom button image and set the URL to the image.
    • If you have setup specific tax values in the profile, these will be selected by default.
    • Select either Merchant ID or plain text email for the purchase transaction.
    • You can select various inventory tracking options, but the default will work for many situations.
    • Decide if the user can increase the item amount.
    • As it’s a downloaded item, you usually do not need the buyers address in this case.
    • Assign a specific URL if the user aborts the purchase.
    • Assign a specific success URL for the user to be directed to after successful completion of the transaction.
    • ENABLE the advanced variables. Enter the listener file URL here to be notified. Even though activated in the ACCOUNT PROFILE, if I did not additionally set it here, it would not work. Go figure. So, it will look like notify_url=
    • Your done entering data. Click onto Create Button. Copy the code and paste it into your HTML file where the button needs to be.
    • If you’re using XHTML you will need to self-close the input tags with the tag closing slash. It’s also a good idea to give the form an ID for styling.
  6. For the second button most of the work is already done. You can either select directly to CREATE SIMILAR BUTTON from the same page as where the code for the last button was displayed or, if you only come back to creating another button at a later stage, you can access the saved button from your ACCOUNT OVERVIEW page via EDIT PROFILE and from there you can duplicate the existing one
  7. To modify this duplicated button into a different one you change as follows:
    • Give the item its unique name.
    • Add a different Item ID [very important].
    • Change the button image to use the default PayPal BUY NOW now, optionally with displaying the credit cards (which in my opinion is a good choice for selling reasons)
    • Ensure that the Address information will be registered (as this item needs to be shipped)
    • No need to change any other points, we’re going to be using the same SUCCESS URL as above and also the same listener URL.

Basically you’re now ready to sell the item and go through with the transactions at PayPal. Of course you’re not yet done though as the actions AFTER SUCCESSFUL TRANSACTION still have to be put in place. Stay tuned for Part II of this Article!