2017 © Pedro Peláez
 

library merchant-sdk-php

PayPal Merchant SDK for PHP

image

tanatoss/merchant-sdk-php

PayPal Merchant SDK for PHP

  • Tuesday, September 2, 2014
  • by tanatoss
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 138 Forks
  • 0 Open issues
  • 18 Versions
  • 0 % Grown

The README.md

PayPal PHP Merchant SDK

The merchant SDK can be used for integrating with the Express Checkout, Mass Pay, Web Payments Pro APIs., (*1)

Prerequisites

PayPal's PHP Merchant SDK requires, (*2)

  • PHP 5.2 and above
  • curl/openssl PHP extensions

Running the sample

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) or by running a custom installation script provided with the SDK., (*3)

If using composer, run composer update from the samples folder. Otherwise, run install.php from merchant-sdk-php/samples directory, (*4)


cd samples curl https://raw.github.com/paypal/merchant-sdk-php/stable/samples/install.php | php OR php install.php

Using the SDK

To use the SDK,, (*5)

  • Create a composer.json file with the following contents.
{
    "name": "me/shopping-cart-app",
    "require": {
        "paypal/merchant-sdk-php":"v2.*"
    }
}
  • Install the SDK as a dependency using composer or the install.php script.
  • Require vendor/autoload.php OR PPBootStrap.php in your application depending on whether you used composer or the custom installer.
  • Choose how you would like to configure the SDK - You can either
    • Create a hashmap containing configuration parameters and pass it to the service object OR
    • Create a sdk_config.ini file and set the PP_CONFIG_PATH constant to point to the directory where this file exists.
  • Instantiate a service wrapper object and a request object as per your project's needs.
  • Invoke the appropriate method on the service object.

For example,, (*6)

    // Sets config file path(if config file is used) and registers the classloader
    require("PPBootStrap.php");

    // Array containing credentials and confiuration parameters. (not required if config file is used)
    $config = array(
       'mode' => 'sandbox',
       'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
       'acct1.Password' => 'WX4WTU3S8MY44S7F'
       .....
    );

    // Create request details
    $itemAmount = new BasicAmountType($currencyId, $amount);
    $setECReqType = new SetExpressCheckoutRequestType();
    $setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;

    // Create request
    $setECReq = new SetExpressCheckoutReq();
    $setECReq->SetExpressCheckoutRequest = $setECReqType;
    ......

    // Perform request
    $paypalService = new PayPalAPIInterfaceServiceService($config);
    $setECResponse = $paypalService->SetExpressCheckout($setECReq);

    // Check results
    if(strtoupper($setECResponse->Ack) == 'SUCCESS') {
        // Success
    }  

Authentication

The SDK provides multiple ways to authenticate your API call., (*7)

    $paypalService = new PayPalAPIInterfaceServiceService($config);

    // Use the default account (the first account) configured in sdk_config.ini
    $response = $paypalService->SetExpressCheckout($setECReq);

    // Use a specific account configured in sdk_config.ini
    $response = $paypalService->SetExpressCheckout($setECReq, 'jb-us-seller_api1.paypal.com');

    // Pass in a dynamically created API credential object
    $cred = new PPCertificateCredential("username", "password", "path-to-pem-file");
    $cred->setThirdPartyAuthorization(new PPTokenAuthorization("accessToken", "tokenSecret"));
    $response = $paypalService->SetExpressCheckout($setECReq, $cred);

SDK Configuration

The SDK allows you to configure the following parameters-, (*8)

  • Integration mode (sandbox / live)
  • (Multiple) API account credentials.
  • HTTP connection parameters
  • Logging

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), (*9)

    $config = array(
       'mode' => 'sandbox',
       'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
       'acct1.Password' => 'WX4WTU3S8MY44S7F'
       .....
    );
    $service  = new PayPalAPIInterfaceServiceService($config);

Alternatively, credential and configuration can be loaded from a file., (*10)

    define('PP_CONFIG_PATH', '/directory/that/contains/sdk_config.ini');
    $service  = new PayPalAPIInterfaceServiceService();

You can refer full list of configuration parameters in wiki page., (*11)

Please refer to the sample config file provided with this bundle for more., (*12)

Instant Payment Notification (IPN)

Please refer to the IPN-README in 'samples/IPN' directory., (*13)

Troubleshooting

  • API Reference - https://developer.paypal.com/webapps/developer/docs/classic/api/#merchant
  • 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/merchant-sdk-php/issues

The Versions

02/09 2014

dev-master

9999999-dev https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

22/08 2014

dev-stable

dev-stable https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

22/08 2014

v2.11.117

2.11.117.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

23/07 2014

v2.10.116

2.10.116.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

20/06 2014

v2.9.115

2.9.115.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

14/05 2014

v2.8.114

2.8.114.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

24/04 2014

v2.7.113

2.7.113.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

16/04 2014

dev-namespace-php5.3

dev-namespace-php5.3 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

09/04 2014

v2.6.112

2.6.112.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

31/03 2014

dev-stable-php5.3

dev-stable-php5.3 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

22/08 2013

v3.6.106

3.6.106.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

22/08 2013

v2.5.106

2.5.106.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

11/06 2013

v3.5.103

3.5.103.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

11/06 2013

v2.4.103

2.4.103.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

28/05 2013

v3.4.102

3.4.102.0 https://developer.paypal.com

PayPal Merchant SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

30/04 2013

v2.3.101

2.3.101.0 https://www.x.com/developers/paypal

PayPal Core SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

27/03 2013

v2.3.100

2.3.100.0 https://www.x.com/developers/paypal

PayPal Core SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal

25/02 2013

v2.2.98

2.2.98.0 https://www.x.com/developers/paypal

PayPal Core SDK for PHP

  Sources   Download

Apache2

The Requires

 

php sdk paypal