Skip to content

Commit 35b31cd

Browse files
author
Stefano Franco
committed
Initial Commit
0 parents  commit 35b31cd

File tree

150 files changed

+11655
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+11655
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
build
3+
.DS_Store
4+
*.log
5+
.idea
6+
7+
# IDE
8+
.project
9+
.settings
10+
.buildpath
11+
*.bak
12+
13+
# Composer
14+
vendor
15+
composer.lock

CHANGELOG.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
### CHANGELOG
2+
3+
####Version 3.9.2 - Apr 8, 2016
4+
5+
- Removed Duplicate Directories.
6+
7+
####Version 3.9.1 - Dec 9, 2015
8+
9+
- Added TLSv1.2 Endpoint support
10+
11+
####Version 3.9.0 - Sep 22, 2015
12+
13+
- Updated IPN Endpoint
14+
15+
####Version 3.6.106 - August 22, 2013
16+
17+
- Updated stubs.
18+
- Updated samples to showcase dynamic configuration.
19+
20+
You can see source code of this release in github under https://github.com/paypal/adaptivepayments-sdk-php/tree/v3.6.106
21+
--------------------------------------------------------------------------------------------------
22+
23+
####Version 3.5.103 - June 11, 2013
24+
25+
- Updated stubs for 103 release.
26+
- Removed deprecated methods like setAccessToken, getAccessToken from baseService in core.
27+
- Added correct thirdparty auth header in core.
28+
- Updated install script in samples to handle wildcard tag names.
29+
30+
You can see source code of this release in github under https://github.com/paypal/adaptivepayments-sdk-php/tree/v3.5.103
31+
32+
--------------------------------------------------------------------------------------------------
33+
34+
#### Version 3.4.102 - May 20, 2013
35+
36+
- Updating SDK to use NameSpaces, Supported from PHP 5.3 and above
37+
38+
You can see source code of this release in github under https://github.com/paypal/adaptivepayments-sdk-php/tree/v3.4.102

LICENSE.txt

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
The PayPal SDK is released under the following license:
2+
3+
Copyright (c) 2013-2016 PAYPAL, INC.
4+
5+
SDK LICENSE
6+
7+
NOTICE TO USER: PayPal, Inc. is providing the Software and Documentation for use under the terms of
8+
this Agreement. Any use, reproduction, modification or distribution of the Software or Documentation,
9+
or any derivatives or portions hereof, constitutes your acceptance of this Agreement.
10+
11+
As used in this Agreement, "PayPal" means PayPal, Inc. "Software" means the software code accompanying
12+
this agreement. "Documentation" means the documents, specifications and all other items accompanying
13+
this Agreement other than the Software.
14+
15+
1. LICENSE GRANT Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive,
16+
worldwide, royalty free license to use, reproduce, prepare derivative works from, publicly display,
17+
publicly perform, distribute and sublicense the Software for any purpose, provided the copyright notice
18+
below appears in a conspicuous location within the source code of the distributed Software and this
19+
license is distributed in the supporting documentation of the Software you distribute. Furthermore,
20+
you must comply with all third party licenses in order to use the third party software contained in the
21+
Software.
22+
23+
Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free
24+
license to use, reproduce, publicly display, publicly perform, distribute and sublicense the Documentation
25+
for any purpose. You may not modify the Documentation.
26+
27+
No title to the intellectual property in the Software or Documentation is transferred to you under the
28+
terms of this Agreement. You do not acquire any rights to the Software or the Documentation except as
29+
expressly set forth in this Agreement.
30+
31+
If you choose to distribute the Software in a commercial product, you do so with the understanding that
32+
you agree to defend, indemnify and hold harmless PayPal and its suppliers against any losses, damages and
33+
costs arising from the claims, lawsuits or other legal actions arising out of such distribution. You may
34+
distribute the Software in object code form under your own license, provided that your license agreement:
35+
36+
(a) complies with the terms and conditions of this license agreement;
37+
38+
(b) effectively disclaims all warranties and conditions, express or implied, on behalf of PayPal;
39+
40+
(c) effectively excludes all liability for damages on behalf of PayPal;
41+
42+
(d) states that any provisions that differ from this Agreement are offered by you alone and not PayPal; and
43+
44+
(e) states that the Software is available from you or PayPal and informs licensees how to obtain it in a
45+
reasonable manner on or through a medium customarily used for software exchange.
46+
47+
2. DISCLAIMER OF WARRANTY
48+
PAYPAL LICENSES THE SOFTWARE AND DOCUMENTATION TO YOU ONLY ON AN "AS IS" BASIS WITHOUT WARRANTIES OR CONDITIONS
49+
OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE,
50+
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PAYPAL MAKES NO WARRANTY THAT THE
51+
SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. Each user of the Software or Documentation is solely responsible
52+
for determining the appropriateness of using and distributing the Software and Documentation and assumes all
53+
risks associated with its exercise of rights under this Agreement, including but not limited to the risks and
54+
costs of program errors, compliance with applicable laws, damage to or loss of data, programs, or equipment,
55+
and unavailability or interruption of operations. Use of the Software and Documentation is made with the
56+
understanding that PayPal will not provide you with any technical or customer support or maintenance. Some
57+
states or jurisdictions do not allow the exclusion of implied warranties or limitations on how long an implied
58+
warranty may last, so the above limitations may not apply to you. To the extent permissible, any implied
59+
warranties are limited to ninety (90) days.
60+
61+
62+
3. LIMITATION OF LIABILITY
63+
PAYPAL AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF THIS AGREEMENT OR FROM THE USE
64+
OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT WILL PAYPAL OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY
65+
FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST SAVINGS,
66+
COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF THIS AGREEMENT OR THE USE OR THE INABILITY
67+
TO USE THE SOFTWARE OR DOCUMENTATION, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
68+
STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
69+
PAYPAL'S AGGREGATE LIABILITY AND THAT OF ITS SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE
70+
LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION.
71+
72+
4. TRADEMARK USAGE
73+
PayPal is a trademark PayPal, Inc. in the United States and other countries. Such trademarks may not be used
74+
to endorse or promote any product unless expressly permitted under separate agreement with PayPal.
75+
76+
5. TERM
77+
Your rights under this Agreement shall terminate if you fail to comply with any of the material terms or
78+
conditions of this Agreement and do not cure such failure in a reasonable period of time after becoming
79+
aware of such noncompliance. If all your rights under this Agreement terminate, you agree to cease use
80+
and distribution of the Software and Documentation as soon as reasonably practicable.
81+
82+
6. GOVERNING LAW AND JURISDICTION. This Agreement is governed by the statutes and laws of the State of
83+
California, without regard to the conflicts of law principles thereof. If any part of this Agreement is
84+
found void and unenforceable, it will not affect the validity of the balance of the Agreement, which shall
85+
remain valid and enforceable according to its terms. Any dispute arising out of or related to this Agreement
86+
shall be brought in the courts of Santa Clara County, California, USA.

README.md

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
2+
# PayPal PHP Adaptive Payments SDK
3+
4+
## TLSv1.2 Update
5+
> **The Payment Card Industry (PCI) Council has [mandated](http://blog.pcisecuritystandards.org/migrating-from-ssl-and-early-tls) that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, PayPal is updating its services to require TLS 1.2 for all HTTPS connections. At this time, PayPal will also require HTTP/1.1 for all connections. [Click here](https://github.com/paypal/tls-update) for more information**
6+
7+
> A new `mode` has been created to test if your server/machine handles TLSv1.2 connections. Please use `tls` mode instead of `sandbox` to verify. You can return back to `sandbox` mode once you have verified. Please have a look at this [Sample Configuration](https://github.com/paypal/adaptivepayments-sdk-php/blob/namespace-php5.3/samples/Configuration.php#L10-15).
8+
9+
## POODLE Update
10+
- Because of the Poodle vulnerability, PayPal has disabled SSLv3.
11+
- To enable TLS encryption, the changes were made to [PPHttpConfig.php](https://github.com/paypal/sdk-core-php/blob/namespace-5.3/lib/PayPal/Core/PPHttpConfig.php#L11) in [SDK Core](https://github.com/paypal/sdk-core-php/tree/namespace-5.3) to use a cipher list specific to TLS encryption.
12+
``` php
13+
/**
14+
* Some default options for curl
15+
* These are typically overridden by PPConnectionManager
16+
*/
17+
public static $DEFAULT_CURL_OPTS = array(
18+
CURLOPT_SSLVERSION => 1,
19+
CURLOPT_CONNECTTIMEOUT => 10,
20+
CURLOPT_RETURNTRANSFER => TRUE,
21+
CURLOPT_TIMEOUT => 60, // maximum number of seconds to allow cURL functions to execute
22+
CURLOPT_USERAGENT => 'PayPal-PHP-SDK',
23+
CURLOPT_HTTPHEADER => array(),
24+
CURLOPT_SSL_VERIFYHOST => 2,
25+
CURLOPT_SSL_VERIFYPEER => 1,
26+
CURLOPT_SSL_CIPHER_LIST => 'TLSv1',
27+
);
28+
```
29+
- There are two primary changes done to curl options:
30+
- CURLOPT_SSLVERSION is set to 1 . See [here](http://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html) for more information
31+
- CURLOPT_SSL_CIPHER_LIST was set to TLSv1, See [here](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html) for more information
32+
33+
All these changes are included in the recent release, along with many other bug fixes. We highly encourage you to update your versions, by either using `composer` or running this command shown below:
34+
35+
```
36+
curl -L https://raw.github.com/paypal/adaptivepayments-sdk-php/stable-php5.3/samples/install.php | php
37+
OR
38+
wget https://raw.github.com/paypal/adaptivepayments-sdk-php/stable-php5.3/samples/install.php
39+
php install.php
40+
```
41+
42+
## Prerequisites
43+
44+
PayPal's PHP Adaptive Payments SDK requires
45+
46+
* PHP 5.3 and above
47+
* curl/openssl PHP extensions
48+
49+
## Running the sample
50+
51+
To run the bundled sample, first copy the samples folder to your web server root. You will then need to install the SDK as a dependency using either composer (PHP V5.3+ only).
52+
53+
54+
run `composer update` from the samples folder.
55+
56+
## Using the SDK
57+
58+
59+
To use the SDK,
60+
61+
* Create a composer.json file with the following contents.
62+
```json
63+
{
64+
"name": "me/shopping-cart-app",
65+
"require": {
66+
"paypal/adaptivepayments-sdk-php":"v3.6.106"
67+
}
68+
}
69+
```
70+
71+
* Install the SDK as a dependency using composer.
72+
* Require `vendor/autoload.php` OR `PPBootStrap.php` in your application.
73+
* Choose how you would like to configure the SDK - You can either
74+
* Create a hashmap containing configuration parameters and pass it to the service object OR
75+
* Create a `sdk_config.ini` file and set the PP_CONFIG_PATH constant to point to the directory where this file exists.
76+
* Instantiate a service wrapper object and a request object as per your project's needs.
77+
* Invoke the appropriate method on the service object.
78+
79+
For example,
80+
81+
```php
82+
// Sets config file path(if config file is used) and registers the classloader
83+
require("PPBootStrap.php");
84+
85+
// Array containing credentials and confiuration parameters. (not required if config file is used)
86+
$config = array(
87+
'mode' => 'sandbox',
88+
'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
89+
'acct1.Password' => 'WX4WTU3S8MY44S7F'
90+
.....
91+
);
92+
93+
$payRequest = new PayRequest($requestEnvelope, $actionType, $cancelUrl,
94+
$currencyCode, $receiverList, $returnUrl);
95+
// Add optional params
96+
if($_POST["feesPayer"] != "") {
97+
$payRequest->feesPayer = $_POST["feesPayer"];
98+
}
99+
......
100+
101+
$service = new AdaptivePaymentsService($config);
102+
$response = $service->Pay($payRequest);
103+
if(strtoupper($response->responseEnvelope->ack == 'SUCCESS') {
104+
// Success
105+
}
106+
```
107+
108+
## Authentication
109+
110+
The SDK provides multiple ways to authenticate your API call.
111+
112+
```php
113+
$service = new AdaptivePaymentsService($config);
114+
115+
// Use the default account (the first account) configured in sdk_config.ini or config hashmap
116+
$response = $service->Pay($payRequest);
117+
118+
// Use a specific account configured in sdk_config.ini or config hashmap
119+
$response = $service->Pay($payRequest, 'jb-us-seller_api1.paypal.com');
120+
121+
// Pass in a dynamically created API credential object
122+
$cred = new PPCertificateCredential("username", "password", "path-to-pem-file");
123+
$cred->setThirdPartyAuthorization(new PPTokenAuthorization("accessToken", "tokenSecret"));
124+
$response = $service->Pay($payRequest, $cred);
125+
```
126+
127+
## SDK Configuration
128+
129+
130+
The SDK allows you to configure the following parameters.
131+
132+
* Integration mode (sandbox / live)
133+
* (Multiple) API account credentials.
134+
* HTTP connection parameters
135+
* Logging
136+
137+
Dynamic configuration values can be set by passing a map of credential and config values (if config map is passed the config file is ignored)
138+
```php
139+
$config = array(
140+
'mode' => 'sandbox',
141+
'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
142+
'acct1.Password' => 'WX4WTU3S8MY44S7F'
143+
.....
144+
);
145+
$service = new AdaptivePaymentsService($config);
146+
```
147+
Alternatively, you can configure the SDK via the sdk_config.ini file.
148+
```php
149+
define('PP_CONFIG_PATH', '/directory/that/contains/sdk_config.ini');
150+
$service = new AdaptivePaymentsService();
151+
```
152+
153+
You can refer full list of configuration parameters in [wiki](https://github.com/paypal/sdk-core-php/wiki/Configuring-the-SDK) page.
154+
155+
## Instant Payment Notification (IPN)
156+
157+
Please refer to the IPN-README in the 'samples/IPN' directory.
158+
159+
## Links
160+
161+
* API Reference - https://developer.paypal.com/webapps/developer/docs/classic/api/#ap
162+
* If you need help using the SDK, a new feature that you need or have a issue to report, please visit https://github.com/paypal/adaptivepayments-sdk-php/issues

composer.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "skuola/paypal-adaptivepayments-sdk-php",
3+
"description": "PayPal adaptivepayments SDK for PHP",
4+
"keywords": ["paypal", "php", "sdk"],
5+
"homepage": "https://developer.paypal.com",
6+
"license": "Apache2",
7+
"authors": [
8+
{
9+
"name": "PayPal",
10+
"homepage": "https://gitlab.skuola.net/skuola/paypal-adaptivepayments-sdk-php/contributors"
11+
}
12+
],
13+
"require": {
14+
"php": ">=5.3.0",
15+
"ext-curl": "*",
16+
"skuola/paypal-sdk-core-php":"dev-master"
17+
},
18+
"autoload": {
19+
"psr-0": {
20+
"PayPal\\Service": "lib/",
21+
"PayPal\\Types": "lib/"
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)