A simple app using AngularJS and PHP to integrate PayPal Express Checkout with PayPal REST API and Smart Payment Buttons
Disclaimer: The applications provided here and all code is provided as-is. These examples are intended to be EXAMPLES and are not intended to be used in a production environment. I am employed at PayPal, however, the code herein is provided from myself as an example not from PayPal, Inc. I hope these are helpful to helping you understand the API's, but please do not use in a production environment.
- Clone, Fork, or download this repo ::
$ git clone https://github.com/ppnsanders/php-pp-spb-example.git
- Place the repo at the root of your
htdocs
directory (e.g./htdocs/php-pp-spb-example
). - Download the PayPal PHP SDK and extract it into the
php-pp-spb-example
directory (e.g./htdocs/php-pp-spb-example/PayPal-PHP-SDK
).
To setup your config file, simply copy the content of /php-pp-spb-example/config/paypal_sample.json
and update the JSON with your actual information. Where <YOUR_CLIENT_ID>
would be your actual client_id
from developer.paypal.com. Then save that file in the /php-pp-spb-example/config/
directory as paypal.json
(i.e. /php-pp-spb-example/config/paypal.json
).
{
"client_id": "<YOUR_CLIENT_ID>",
"client_secret": "<YOUR_CLIENT_SECRET>",
"email": "<YOUR_EMAIL>",
"payerId": "<YOUR_PAYER_ID>",
"brandName": "<YOUR_BRAND_NAME>",
"environment": "sandbox"
}
Update the /api/paypal/bootstrap.php file to set the full path to your autoload.php
file in the $composerAutoload
variable.
Once you have the Setup & Config File steps complete, fire up your Apache Server and go to http://localhost:8888/php-pp-spb-example/.
Note:: I was using MAMP so my port was set to
8888
(i.e.http://localhost:8888/
), your URL and/or PORT may be different.