这是indexloc提供的服务,不要输入任何密码
Skip to content

kingjay66/permissions-sdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayPal PHP Permissions SDK

Prerequisites

PayPal's PHP Permissions SDK requires

  • PHP 5.2 and above with curl/openssl extensions enabled

Using the SDK

To use the SDK,

  • Copy the config and lib folders into your project. Modify the config file sdk_config.ini to suit your needs.
  • Make sure that the lib folder in your project is available in PHP's include path.
  • Include the services\Permissions\PermissionsService.php file in your code.
  • Create a service wrapper object.
  • Create a request object as per your project's needs. All the API request and response classes are available in services\Permissions\PermissionsService.php
  • Invoke the appropriate method on the service object.

For example,

require_once('services\Permissions\PermissionsService.php');

$request = new RequestPermissionsRequest($scope, $returnURL);
$request->requestEnvelope = $requestEnvelope;
.......

$permissions = new PermissionsService();
$response = $permissions->RequestPermissions($request);

$ack = strtoupper($response->responseEnvelope->ack); 
if($ack == 'SUCCESS') {
	// Success
}

The SDK provides multiple ways to authenticate your API call.

$permissions = new PermissionsService();

// Use the default account (the first account) configured in sdk_config.ini
$response = $permissions->RequestPermissions($request);	

// Use a specific account configured in sdk_config.inig
$response = $permissions->RequestPermissions($request, '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 = $permissions->RequestPermissions($request, $cred);	

SDK Configuration

Replace the API credential in config/sdk_config.ini . You can use the configuration file to configure

  • (Multiple) API account credentials.
  • Service endpoint and other HTTP connection parameters
  • Logging

Please refer to the sample config file provided with this bundle.

Using multiple SDKs together

*copy the contents in 'lib/service/' to one of the SDKs *add the service endpoint to 'config/sdk_config.ini', for the endpoints refer the list below

Endpoint Configuration

*The list below specifies endpoints for different services, in SANDBOX and PRODUCTION, with their property keys and end-point as property values.

------------------------------SANDBOX------------------------------

------------------------------PRODUCTION------------------------------

For additional information please refer to https://www.x.com/developers/paypal/documentation-tools/api

Getting help

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/permissions-sdk-php/issues

About

PHP SDK for integrating with PayPal's Permissions API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%