diff --git a/README.md b/README.md index 57cc78a..1099f5d 100644 --- a/README.md +++ b/README.md @@ -58,12 +58,17 @@ If you do not want to use composer, you can grab the SDK zip that contains Paypa - This *autoload.php* file registers a custom autoloader that can autoload the PayPal SDK files, that allows you to access PHP SDK system in your application. -## Running the sample +## Samples +### View + * Using the [htmlpreview](https://github.com/htmlpreview/htmlpreview.github.com) tool you can now [view sample source codes here](http://htmlpreview.github.io/?https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/index.html) + +### Running Locally * Clone the repo and navigate to the samples folder. * Samples have dependency on the sdk and you can use [`composer`](http://getcomposer.org) to get the dependencies. Ensure that you have composer installed on your machine, navigate to the root folder and run `composer update --no-dev` to fetch the SDK. * Optionally, update the bootstrap.php file with your own client Id and client secret, that you could find from the [developer portal](https://developer.paypal.com) - * Run any of the samples in the 'samples' folder to see what the APIs can do. + * You need to host this project locally using any server, e.g. Apache. + * Open the `index.html` page under `/sample` directory and checkout the samples. ## Usage @@ -162,6 +167,7 @@ PayPal\Validation\ModelAccessorValidator: WARNING: Missing Accessor: PayPal\Api\ ## More help + * [Sample Source Codes](http://htmlpreview.github.io/?https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/index.html) * [API Reference](https://developer.paypal.com/webapps/developer/docs/api/) * [Reporting issues / feature requests] (https://github.com/paypal/PayPal-PHP-SDK/issues) * [Pizza App Using Paypal REST API] (https://github.com/paypal/rest-api-sample-app-php) diff --git a/sample/README.md b/sample/README.md index cb22013..a1938a6 100644 --- a/sample/README.md +++ b/sample/README.md @@ -5,10 +5,32 @@ This sample project is a simple web app that you can explore to understand what To try out the sample, run `composer update --no-dev` from the PayPal-PHP-SDK folder and you are all set. +#### Running on a web +* If you plan to run these samples on the web, you will need to host this project under a local server. E.g. Apache. +* Once done, you could easily open the samples by opening the matching URL. For e.g.: +`http://localhost/PayPal-PHP-SDK/sample/index.html` + +You should see a sample dashboard page as shown below: +![Web Output!](/sample/images/sample_web.png) + +#### Running on console +> Please note that there are few samples that requires you to have a working local server, to receive redirects when user accepts/denies PayPal Web flow + +* To run on console, you need to open command prompt, and direct to samples directory. +* Execute the sample php script by using `php -f` command as shown below: +```bat +php -f payments/CreatePaymentUsingSavedCard.php +``` + +The result would be as shown below: +![Console Output!](/sample/images/sample_console.png) +#### Configuration + The sample comes pre-configured with a test account but in case you need to try them against your account, you must - + * Obtain your client id and client secret from the developer portal * Update the bootstrap.php file with your new client id and secret. - - -If you are looking for a full fledged application that uses the new RESTful APIs, check out the Pizza store sample app at https://github.com/paypal/rest-api-sample-app-php + +#### More Help + +If you are looking for a full fledged application that uses the new RESTful APIs, check out the Pizza store sample app at https://github.com/paypal/rest-api-sample-app-php diff --git a/sample/images/sample_console.png b/sample/images/sample_console.png new file mode 100644 index 0000000..321bf7d Binary files /dev/null and b/sample/images/sample_console.png differ diff --git a/sample/images/sample_web.png b/sample/images/sample_web.png new file mode 100644 index 0000000..6e40e39 Binary files /dev/null and b/sample/images/sample_web.png differ diff --git a/sample/index.html b/sample/index.html index 23b6b7a..8d4668d 100644 --- a/sample/index.html +++ b/sample/index.html @@ -12,7 +12,7 @@ PayPal REST API Samples - +