This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/sample
Jay Patel 2cb32696d8 Identity API Samples to include all scopes
- Obtain User Consent now show all possible scopes
- Get User Info now has all the fields shown for demonstration purposes
2015-02-18 13:14:33 -06:00
..
2014-11-22 22:17:00 -06:00
2015-01-26 13:38:17 -06:00
2014-11-03 16:31:03 -06:00
2015-02-04 15:52:34 -06:00
2015-01-09 14:03:20 -06:00
2015-02-17 13:20:26 -06:00
2015-02-17 13:20:26 -06:00
2014-12-15 13:54:11 -06:00
2015-02-04 15:52:34 -06:00

Rest API Samples

This sample project is a simple web app that you can explore to understand what the payment APIs can do for you.

To try out the sample, run composer update --no-dev from the PayPal-PHP-SDK folder and you are all set.

Running Samples

PHP 5.4 or higher
  • If you are running PHP 5.4 or greater, PHP provides a built-in support for hosting PHP sites.
  • The fastest way to get it running is
php -f sample/index.php
LM-AUN-00876403:PayPal-PHP-SDK japatel$ php -f sample/index.php
PHP 5.5.14 Development Server started at Wed Nov 19 21:07:52 2014
Listening on http://localhost:5000
Document root is /Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample
Press Ctrl-C to quit.
[Wed Nov 19 21:07:56 2014] ::1:60826 [200]: /index.php
...
PHP 5.3 or less
  • You could host the entire project in your local web server, by using tools like MAMP or XAMPP.
  • 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!

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 samples itself 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:
php -f payments/CreatePaymentUsingSavedCard.php

The result would be as shown below: Console Output!

Configuration

The sample comes pre-configured with a test account but in case you need to try them against your account, you must

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