4.4 PayPal Settings in PHP
Let's start investigating the '05Demo' (download demo 05). The '05Demo' has three new folders from it's predecessor.We will talk here about the folders 'SecretDownloads' and 'PayPal'.
Example :
www.mysite.com/SecretDownloads/123456789/123456789/123456789/
has a length of 61 characters. The SecretDownloads must be Chmod 755 at least. This means : read and execute access for everyone and also write access for the owner of the file. These details will be explained at the chapter 'Going DEMO'. Once you have personalized your secret path it is time to set up your PayPal settings. Open the PayPal folder, there you will find the 'settings.php' file and the 'Code' folder. The code folder you can leave it contains the PHP code which does the steps 3 and 5 described before. The 'settings.php' file once configured you can leave it as is. Let's take a closer look of that file by opening it with notepad++
<?php //General settings. You have to set them only once. ////////////////////////////////////// ////MODIFY the Download Settings//// ////////////////////////////////////// //1. The page title of the download page $SettingsDownload['TitlePage'] = 'Download your digital product.'; //2. The secret download directory. This directory must be writeable ! The SettingsDownload value can be found with two methods: ////a) Relative path : With '../../' you are at the ROOT of the '05Demo' directory. Now add the relative path from ROOT to SECRETPATH ////b) Absolute path : Put the 'GetAbsoluteDirectory.php' to the SECRETPATH and access it with a browser. Get the value and DELETE GetAbsoluteDirectory.php $SettingsDownload['file_path'] = '../../SecretDownloads/556622/abggretttt77/jjMMn5 4VrtP/xyz321/'; //3. The referer site link. $SettingsDownload['referer_url'] = 'www.mysite.com/05Demo/PayPal/Code/pdthtml.php'; //4. Enable download counter (recommended value: True) $SettingsDownload['enable_download_counter'] = True; //5. How many download attempts has one buyer. $SettingsDownload['Max_downloads'] = 2; //6. Enable Logs (reccommended value: True) $SettingsDownload['enable_log'] = True; //7. Specify the filename of the logs $SettingsDownload['log_file_name'] = 'downloads.log'; //////////////////////////////////// ////MODIFY the PayPal Settings//// /////////////////////////////////// //1. The auth_token of the real account seller. $SettingsPayPal['auth_token_real'] = 'XXXXXXXXXXXXXXXXXXXXX'; //2. True means TEST MODE SANDBOX - False means REAL MODE $SettingsPayPal['sandbox_mode'] = True; //3. The auth_token of the sandbox account seller. $SettingsPayPal['auth_token_sandbox'] = 'XXXXXXXXXXXXXXXXXXXXXX'; //4. The Failed Transaction Message $SettingsPayPal['completely_failed_message'] = 'Your transaction has been failed.PayPal settings file
Please contact with us at company@email.com'; ?>
We can clearly see two sections of settings. The Download settings and the PayPal settings. From the download settings we have :
- The title of the download page. If you like the title leave it as is.
- The secret path. Make sure to change it with your personalized path.
- The referer site link. For the needs of our demo this should be something like this : www.yoursite.com/05Demo/PayPal/Code/pdthtml.php
- Enable download counter Leave it as is (recommended value: True)
- How many download attempts has one buyer. Leave it as is for now.
- Enable Logs The default setting is good for you. (recommended value: True)
- Specify the filename of the logs Leave it as is.
but generally should be :
www.yoursite.com/PayPal/Code/pdthtml.php
- The auth_token of the real account seller We will talk about this later in this book right now leave it as is.
- The sanbox mode Leave it to true for now. This means we are in TEST mode.
- The auth_token of the sandbox account seller. We will talk about this later in this book right now leave it as is.
- The Failed Transaction Message This you can customize it right now if you want.
Please note that all the other PayPal values will be set later.