This post is in response to this missing bit of documentation. I won't attempt to cover anything more than the official documentation covers since it does a really good job in that respect already.
To get started you need to head over to the Sandbox Accounts page and create two accounts that you will use during development and testing. These are for the Sandbox PayPal site. When creating these accounts you can assign the amount of money they will contain, whether they are verified, etc. You need at least the business account, but it's best to create a business and a personal account straight away. Remember these are just for the sandbox and will not affect the live PayPal servers.
Once the accounts are created, you can go over to the My Apps page and start creating an App by clicking the Create App button.
Fill in the App name and select the Sandbox developer account for the app, then click Create App.
The next screen will display your App's credentials, for now you can scroll past those all the way to the bottom and select the features that your app will use. It's best to select a minimal set of features rather than have everything available. Not all apps will have all features unlocked, this depends on your country. The Return URL is not necessary because you specify this when making a call to PayPal anyway. Click Save when done.
You should take note of the Client ID and Secret from your App's information page, this is used in your bootstrap.php file later.
Now you are almost ready to use the SDK. I opted for the 'direct download' approach without using Composer. This meant that I needed to use an auto-loader. The API examples keep referencing the autoload.php script in the PayPal directory from the SDK, but this is nowhere to be found, so I've created the following as a quick fix.
PayPal/autoload.php
<?php
function PayPal_PHP_SDK_autoload($className)
{
$classPath = explode('\\', $className);
if ($classPath[0] != 'PayPal') {
return;
}
$classPath = array_slice($classPath, 1, 2);
$filePath = dirname(__FILE__) . '/' . implode('/', $classPath) . '.php';
if (file_exists($filePath)) {
require_once($filePath);
}
}
spl_autoload_register('PayPal_PHP_SDK_autoload');
?>
To make use of that in your code, simply use the following snippet:
Your Code
require __DIR__ . '/PayPal/autoload.php';
Now you are ready for the rest of the SDK. Good luck!
-i