Git Product home page Git Product logo

merchant-sdk-php's Introduction

status: archive

PayPal PHP Merchant SDK

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

TLSv1.2 Update

The Payment Card Industry (PCI) Council has mandated 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 for more information

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.

POODLE Update

  • Because of the Poodle vulnerability, PayPal has disabled SSLv3.
  • To enable TLS encryption, the changes were made to PPHttpConfig.php in SDK Core to use a cipher list specific to TLS encryption.
    /**
	 * Some default options for curl
	 * These are typically overridden by PPConnectionManager
	 */
	public static $DEFAULT_CURL_OPTS = array(
		CURLOPT_SSLVERSION => 1,
		CURLOPT_CONNECTTIMEOUT => 10,
		CURLOPT_RETURNTRANSFER => TRUE,
		CURLOPT_TIMEOUT        => 60,	// maximum number of seconds to allow cURL functions to execute
		CURLOPT_USERAGENT      => 'PayPal-PHP-SDK',
		CURLOPT_HTTPHEADER     => array(),
		CURLOPT_SSL_VERIFYHOST => 2,
		CURLOPT_SSL_VERIFYPEER => 1,
		CURLOPT_SSL_CIPHER_LIST => 'TLSv1',
	);
  • There are two primary changes done to curl options:
    • CURLOPT_SSLVERSION is set to 1 . See here for more information
    • CURLOPT_SSL_CIPHER_LIST was set to TLSv1, See here for more information

All these changes are included in the recent release, along with many other bug fixes.

Support

Please contact PayPal Technical Support for any live or account issues.

Prerequisites

PayPal's PHP Merchant SDK requires

  • PHP 5.3 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 composer (PHP V5.3+ only).

Using the SDK

To use the SDK,

  • Create a composer.json file with the following contents.
{
    "name": "me/shopping-cart-app",
    "require": {
        "paypal/merchant-sdk-php":"3.8.*"
    }
}
  • Install the SDK as a dependency using composer. To download composer, follow installation instructions provided in Composer documentation.
  • Require PPBootStrap.php in your application.
  • 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,

    // 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.

	$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-

  • 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)

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

Alternatively, you can configure the SDK via the sdk_config.ini file.

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

You can refer full list of configuration parameters in wiki page.

Instant Payment Notification (IPN)

Please refer to the IPN-README in 'samples/IPN' directory.

Links

merchant-sdk-php's People

Contributors

avidas avatar aydiv avatar braebot avatar carsongregory avatar devchristina avatar diemuzi avatar drhazemali avatar ganeshx avatar jaypatel512 avatar johnj avatar jyggen avatar koichiwada avatar kumaravel-jayakumar avatar lathavairamani avatar lvairamani avatar palavilli-godaddy avatar prannamalai avatar rglastra avatar scuissiatto avatar siddick avatar tkanta avatar tomk avatar yanivd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

merchant-sdk-php's Issues

PaymentAction does not work for Authorization/Order

I have been integration PayPal Direct using the Merchant SDK. When doing authorizations however, I set the PaymentAction to Authorization (I've tried Order) yet when DoDirectPayment is called with this action, the transaction is still going through with a PaymentAction of Sale.

I've spoken with PayPal Technical Services and we've sandboxed this to verify, and this is in fact what is happening. The way this presented was that I'd take the resulting Transaction ID from the DoDirectPayment call and use that when calling DoCapture resulting in an error 'Invalid Transaction ID'.

I've confirmed that when I'm doing a preauth I am in fact setting the PaymentAction to Authorization (as mentioned, we also tried setting it to Order) but regardless of what its set to, the SDK seems to still send the action as Sale.

Is this a known issue, and is there a fix for this?

Feature Request: Branded Logo and Shipping Address Disable Entry

Hello,

I am really confused here, I am implementing Paypal API for the first time. I have my code working for both Merchant and REST api. I need features of Express Checkout such as Branded Logo Image and Disabled shipping address entry.

The merchant SDK readme states that "This SDK is deprecated. It is strongly recommended that new implementations use the PHP Rest SDK". But the REST SDK/API does not have all the features for Merchant SDK/API.

So, I am not sure if I should use Merchant API or REST API. Any idea when will REST API have all the features of the Merchant API.

Thanks,
Chirag

Laravel Issue

I m trying to configure recurring payment here is my code i m using laravel and this is my model class. no error appear and no response.

BillingStartDate = "2014-11-17T00:00:00:000Z"; $paymentBillingPeriod = new BillingPeriodDetailsType(); $paymentBillingPeriod->BillingFrequency = 30; $paymentBillingPeriod->BillingPeriod = "Day"; $paymentBillingPeriod->Amount = new BasicAmountType("USD", "1.0"); $scheduleDetails = new ScheduleDetailsType(); $scheduleDetails->Description = "recurring billing"; $scheduleDetails->PaymentPeriod = $paymentBillingPeriod; $createRPProfileRequestDetails = new CreateRecurringPaymentsProfileRequestDetailsType(); $creditCard = new CreditCardDetailsType(); $creditCard->CreditCardNumber = "4032034992341100"; $creditCard->CreditCardType = "Visa"; $creditCard->CVV2 = "123"; $creditCard->ExpMonth = 11; $creditCard->ExpYear = 2019; $createRPProfileRequestDetails->CreditCard = $creditCard; $createRPProfileRequestDetails->ScheduleDetails = $scheduleDetails; $createRPProfileRequestDetails->RecurringPaymentsProfileDetails = $profileDetails; $createRPProfileRequest = new CreateRecurringPaymentsProfileRequestType(); $createRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $createRPProfileRequestDetails; $createRPProfileReq = new CreateRecurringPaymentsProfileReq(); $createRPProfileReq->CreateRecurringPaymentsProfileRequest = $createRPProfileRequest; $config = array ( 'mode' => Config::get('paypal.mode') , 'acct1.UserName' => Config::get('paypal.username'), 'acct1.Password' => Config::get('paypal.password'), 'acct1.Signature' => Config::get('paypal.signature') ); $paypalService = new PayPalAPIInterfaceServiceService($config); $createRPProfileResponse = $paypalService->CreateRecurringPaymentsProfile($createRPProfileReq); } } ``` ?>

Version issue error in installing SDK

I am installing SDK dependencies using install.php for billing agreement api. I have downloaded merchant-sdk-php-master for github.
Now I run samples/install.php and getting following error :-
composer not installed or 'useComposer' is set to false in install.php. Running custom installation ... error: invalid version tag in composer.json

My php version is 5.4.7.

cURL Warnings for DoDirectPayment sample

Merchant PHP SDK 2.2.98 DoDirectPayment sample returns several warning and eventually fails to submit the request. It's returning the following errors when submitting the form in the DoDirectPayment sample:

PHP Warning: curl_init() expects parameter 1 to be string, array given in /var/www/xxxxxxxx.net/public/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 50

PHP Warning: curl_setopt_array(): supplied argument is not a valid cURL handle resource in /var/www/xxxxxxxx.net/public/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 51

PHP Warning: curl_setopt() expects parameter 1 to be resource, null given in /var/www/xxxxxxxx.net/public/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 52

PHP Warning: curl_setopt() expects parameter 1 to be resource, null given in /var/www/xxxxxxxx.net/public/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 53

PHP Warning: curl_setopt() expects parameter 1 to be resource, null given in /var/www/xxxxxxxx.net/public/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 54

PHP Warning: curl_setopt() expects parameter 1 to be resource, null given in /var/www/xxxxxxxx.net/
2013/02/20 20:42:02 [error] 3118#0: *1219 FastCGI sent in stderr: "p/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 84

PHP Warning: curl_close() expects parameter 1 to be resource, null given in /var/www/xxxxxxxx.net/public/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPHttpConnection.php on line 90

Fatal error on getNamespaces() in PPUtils.php when running the DoDirectPayment sample

As per title. DoDirectPayment sample returns a fatal error on getNamespaces() when submitted.

PHP Fatal error: Call to a member function getNamespaces() on a non-object in /var/www/xxxxxx.net/public/xxxxxxxxxx/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPUtils.php on line 85" while reading response header from upstream, client: 193.28.178.38, server: xxxxxxx.net, request: "POST /merchant-sdk-php/samples/DirectPayment/DoDirectPayment.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php.socket:", host: "xxxxxxxx.net", referrer: "http://xxxxxxxxxx.net/xxxxxxxxx/merchant-sdk-php/samples/DirectPayment/DoDirectPayment.html.php"

Instant Update Callback URL not working in Live environment

I'm using the current version of the SDK (2.5.106). PayPal's payment page successfully uses my Instant Update Callback URL to fetch and display shipping and tax amounts in the Sandbox environment. I have the Callback URL configured on HTTPS (certificate from GoDaddy).

As soon as I switch the following 4 values in the config:

  • UserName
  • Password
  • Signature
  • Mode

to 'Live' values, PayPal's checkout page stops hitting the Instant Update Callback URL. I have debug lines at the very start of the callback URL controller, but a request is never made.

I've posted this issue on Stack Overflow as well; it contains a few more details.

I've contacted PayPal Technical Support, but it's been weeks and they haven't gotten back to me.

Please help, this issue is preventing us from launching PayPal on our site.

Thanks!

DoExpressCheckoutPayment returns PPXmlMessage Error

Hi everyone.
I am implementing an express checkout solution with this sdk on php5.2.

I can get the token and the payerID but when I have to request "DoExpressCheckoutPayment" to confirm the payment the following message is given:

Fatal error: Call to undefined method stdClass::toXMLString() in /.../vendor/paypal/paypal-sdk-core-php-2ee73c7/lib/PPXmlMessage.php on line 96

Does someone have any idea how to fix this?

Thanks in advance

To be fixed

In documentation is used $strtoupper as var insted strtoupper as a function.

Incorrect README

You indicate in the README:

Alternatively, 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)
php
$config = array(
'mode' => 'sandbox',
'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
'acct1.Password' => 'WX4WTU3S8MY44S7F'
.....
);
$service = new PayPalAPIInterfaceServiceService($config);

This is incorrect. PayPalAPIInterfaceServiceService constructor does not take a configMap.

Log location is unclear, leading to permission denied errors

The log location is defined as ../PayPal.log in sdk_config.ini by default. Is ../PayPal.log supposed to be the parent directory of sdk_config.ini, or is another directory referenced?

merchant-sdk-php/PayPal.log still does not get written even with global write privileges applied, leading me to suspect it's looking for a different directory elsewhere.

Can you please include additional documentation on the SDK its logging capabilities (log location, levels, etc)?

PHP Warning: error_log(PayPal.log): failed to open stream: Permission denied in /var/www/xxxxxx.net/public/xxxxxx/merchant-sdk-php/samples/vendor/paypal/paypal-sdk-core-php-24d3b58/lib/PPLoggingManager.php on line 54

Fatal error: Cannot redeclare class IPPCredential

Hi everyone,

Loading the DoDirectPayment.html.php sample fails with a

Fatal error: Cannot redeclare class IPPCredential in .../lib/IPPCredential.php on line 7

I think the problem is that both auth/PPSignatureCredential.php and auth/PPCertificateCredential.php require IPPCredential.php instead of auth/IPPCredential.php.

It seems from the code that PPCredentialManager expects IPPCredential subclasses to have the setThirdPartyAuthorization() and setThirdPartyAuthorization() methods which are only defined in auth/IPPCredential.php. Besides, PPSignatureCredential and PPCertificateCredential overwrite all methods they currently inherit from IPPCredential.php.

Does any of the above makes sense? if not, how can I get rid of the Fatal error. I just downloaded Version 2.1.96 but that error does not allow me to start testing the integration.

Thank you.

composer not yet online

the packages are not yet on packagist?

$ composer install
Loading composer repositories with package information
Installing dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package paypal/sdk-core-php could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Cannot update recurring payments profile Billing Period

When using the code from the sample for UpdateRecurringPaymentsProfile to update the BillingPeriod details on an existing recurring payments profile, the updated BillingPeriod isn't actually persisted on the profile. Retrieving the recurring payments profile's details yields the previous BillingPeriod.

Adding $PaymentDetails->ShippingTotal->value to $PaymentDetails causes this program to hang

SDK 98, Express Checkout, PHP, Samples/DoDirectPayment

Look at file DoDirectPayment.php

Problem: Adding $PaymentDetails->ShippingTotal->value to
to $PaymentDetails causes this program to hang
at the following line.

  $doDirectPaymentResponse=
$paypalService->DoDirectPayment($doDirectPaymentReq); 

Problem2: This same problem happens with $PaymentDetails->HandlingTotal->value

Reproduce by:
Go to the line

    $paymentDetails->ShipToAddress = $address;

and then add this line after it.

$paymentDetails->ShippingTotal->value = 2.00;

Then modify the following line to include the 2.00

      $paymentDetails->OrderTotal = new BasicAmountType('USD', $_POST['amount'] +  $paymentDetails->ShippingTotal->value ); 

Now print out the $paymentDetails object like this

       echo "<pre>";
       print_r( $paymentDetails);
       echo "</pre>"; 

You will see the values in the $paymentDetails object look
good. They add up correctly. OrderTotal is $3.00 as it should be.

actual results:
The program hangs.
Here is code snippet from DoDirect
It only echoes "BEFORE CALL", it does not
echo "AFTER CALL" or "IN EXCEPTION".

 echo "BEFORE CALL";
          $doDirectPaymentResponse = $paypalService->DoDirectPayment($doDirectPaymentReq);
          echo "AFTER CALL";
  } catch (Exception $ex) {
         echo "IN EXCEPTION";

composer install not working

error on console
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for paypal/merchant-sdk-php dev-master -> satisfiable by paypal/merchant-sdk-php[dev-master].
- Can only install one of: paypal/merchant-sdk-php[v2.5.106, dev-master].
- Installation request for paypal/merchant-sdk-php v2.5.106 -> satisfiable by paypal/merchant-sdk-php[v2.5.106].

my composer.json contains
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"paypal/merchant-sdk-php": "v2.5.106",
"fusesource/stomp-php" : "2.1.1"
},
also can someone update composer.json for v3.6.106

cURL error no. 0 while installing

I get a weird error while trying to run the install.php from the sample folder.

When it tries to download the SDK from the GitHub link it returns a cURL error no. 0, but looking it up that's the code for "everything is okay" and that seems to be right since the error description is empty.

I don't have a command line access so I'm running the script through my browser.

The link: https://api.github.com/repos/paypal/merchant-sdk-php/zipball/v2.11.117
Is working, I could easily download the zip file. I also have the installer on full(777) rights and have cURL and zip extensions installed.

Looking through the code this function must have some wrong settings.

function curlExec($targetUrl, $writeToFile = null) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $targetUrl);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'curl/installScript');
curl_setopt($ch, CURLOPT_BINARYTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
if($writeToFile != null)
{
curl_setopt($ch, CURLOPT_FILE, $writeToFile);
}
$res = curl_exec($ch);
if (!$res) {
echo PHP_EOL . "cURL error number:" .curl_errno($ch) . " for $targetUrl";
echo PHP_EOL . "cURL error:" . curl_error($ch);
exit;
}
curl_close($ch);
return $res;
}

If everything is working as it should then what could be the problem.

Digital Good Express Checkout Sample Error

I got an error like below:

Fatal error: Uncaught exception 'PPConfigurationException' with message 'Config file D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\sdk-core-php\lib..\config\sdk_config.ini not found' in D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\sdk-core-php\lib\PPConfigManager.php:47 Stack trace: #0 D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\sdk-core-php\lib\PPConfigManager.php(30): PPConfigManager->load('D:\Web-Project...') #1 D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\sdk-core-php\lib\PPConfigManager.php(37): PPConfigManager->__construct() #2 D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\sdk-core-php\lib\PPBaseService.php(53): PPConfigManager::getInstance() #3 D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\merchant-sdk-php\lib\services\PayPalAPIInterfaceService\PayPalAPIInterfaceServiceService.php(21): PPBaseService->__construct('PayPalAPIInterf...', 'SOAP', Array, NULL) #4 D:\Web-Project\xampp\htdocs\research\paypal\ExpressCheckout\DGdoExpressCheckout.ph in D:\Web-Project\xampp\htdocs\research\paypal\vendor\paypal\sdk-core-php\lib\PPConfigManager.php on line 4

Typo in repository subtitle "Chechkout" vs "Checkout".

Original subtitle: "PHP SDK for integrating with PayPal's Express Chechkout / MassPay / Web Payments Pro APIs"

Fixed subtitle: "PHP SDK for integrating with PayPal's Express Checkout / MassPay / Web Payments Pro APIs"

Problem with country field in shipping address for DoReferenceTransaction Sample

In the BillingAgreements/DoReferenceTransaction.php file, if you have a country thats more than two letters, the sample will fail. Errors returned from paypal's server don't do a good job of mentioning this correctly so it took some testing to figure this out.

I would suggest that either the SDK return an error or that at least the sample list "US" instead of "USA" in the default field of the demo.

Unable to use the SDK

Hi, I wanted to start using the SDK, installing it with install.php. Here I found the first issue: where is install.php? I didn't find it here https://github.com/paypal/merchant-sdk-php/tree/stable-php5.3, so used this one: https://github.com/paypal/merchant-sdk-php/blob/71850935a19437b913d08b0a59e445f50a53b489/samples/install.php

Then I followed the instructions and set up the composer.json and then tried to make the first call ( I used the sample code in the seciton "Using SDK").
I got this error: mod_fcgid: stderr: PHP Fatal error: Class 'PayPal\Core\PPXmlMessage' not found in /var/www/merchant-sdk/vendor/paypal/paypal-merchant-sdk-php-0ad863b/lib/PayPal/CoreComponentTypes/BasicAmountType.php on line 14, referer: http://91.239.64.221/merchant-sdk/

Seems like merchant-sdk is ok but sdk-core has some problems.

Adding paypal/merchant-sdk-php via composer in Symfony2 project

This is not an issue but a question.

I would like to use merchant-sdk-php in my Symfony2 project. I added the following line to my composer.json file:

"paypal/merchant-sdk-php": "2.3.*"

I then ran a composer.phar update and composer installed the following 2 packages:

  - Installing paypal/sdk-core-php (v1.3.0)
    Downloading: 100%

  - Installing paypal/merchant-sdk-php (v2.3.100)
    Downloading: 100%

Looking at the examples I see that I might also have to add the following line to my composer.json file:

"paypal/permissions-sdk-php":"v2.3.100"

Is this required or is it optional and it's required only for certain functionality?

Thanks

Not compatible with PHP 5.2

Hey,

I don't think it is compatible (as described in the README) to use with PHP < 5.3.
Usage of "DIR" as well as global namespaces like '\Composer\Autoload\ClassLoader' which are features of >= 5.3.

Cheers,
Kim

Improvement Request: Add Errors for Missing Payer Objects

Hi, I've been in touch with your technical support team (friendly and helpful, thank you) and I was writing code for the new REST API.

For end-user developers to understand quickly what's happening (and free up the PP MTS team's time to do more important tasks), I propose an additional error code under the formal error list returned by the API.

Whenever a call for "sale" that doesn't include a Payer object is made, return an Error object with a name like PAYER_OBJECT_NOT_SET or MISSING_PAYER_OBJECT instead of the generic INTERNAL_SERVICE_ERROR. Of course you may name it according to your internal naming conventions.

Paypal recurring payments

On paypal website I am asked to download the merchant sdk
https://devtools-paypal.com/guide/recurring_payment_ec/php?env=sandbox
and I downloaded it from here https://github.com/paypal/merchant-sdk-php

but , when i run the $paypalService=new PayPalAPIInterfaceServiceService(Yii::app()->Paypal);
I got a lot of errors on missing files from the library e.g PPBaseService.php was missing the merchant SDK.

So I had to download the core SDK from here : https://github.com/paypal/sdk-core-php
and copy those missing library files.

Now when everything works well,
I recieved the error below

array_merge(): Argument #2 is not an array 
 */
106     private function getConfigHashmap()
107     {
108         return $this->config;
109     }
110     
111     /**
112      * use  the default configuration if it is not passed in hashmap
113      */
114     public static function getConfigWithDefaults($config=null)
115     {
116         return array_merge(PPConfigManager::$defaults, 
117                 ($config != null) ? $config : PPConfigManager::getInstance()->getConfigHashmap());
118     }
119 }

Fatal error: Call to undefined method stdClass::toXMLString()

Hey guys I am getting this error when processing a direct recurring transaction

Fatal error: Call to undefined method stdClass::toXMLString() in /home/content/08/10639508/html/wp-content/plugins/donation-manager/library/vendor/paypal/paypal-sdk-core-php-bc7822a/lib/PPXmlMessage.php on line 89

Express Checkout, set NoShipping = 1, ShipToAddress info gets lost.

I am using SDK 98, Express Checkout, PHP

Problem: When NoShipping =1, ShipToAddress info shows up in
SetExpressCheckout response, but that info does not get
carried over to be picked up by
GetExpressCheckoutDetails.

Reproduce by:

Goto samples/ExpressCheckout/SetExpressCheckout.html.php

On that page, go to the section "Shipping information"

On the selection item labeled "Requires shipping", select
"Do not select shipping address in PayPal pages"
This sets NoShipping = 1

Click SetExpressCheckout button. This will take you
to the next page. On that next page click the
link *Redirect to PayPal login

login and keep going through the PayPal pages until
you return.

It will return to page
samples/ExpressCheckout/GetExpressCheckout.php

Results
On that page notice that the ShipToAddress section
is blank. Also, the payerInfo address section is blank.
I expect that shipping address info to be populated with the info
I gave it in SetExpressCheckout.

By the way, when you set NoShipping=0 or NoShipping=2, those
fields get populated with the addresses in PayPal, as they
should.

Latest release

Hi, this repo's readme suggests requiring v2.*. However I am on v3.8.106 which was suggested elsewhere. What is the "correct" latest version and if it is 2.* instead of 3.*, can someone explain why that is and what the differences are between these major releases?

Thanks!

Using namespaced library : PayPal

I extracted the merchant sdk in my YII framework based application under the vendor folder

I also registered the root as path alias
E.g
Yii::setPathOfAlias('PaypalApi', Yii::getPathOfAlias('application.vendor.Paypalmerchant.lib.PayPalAPIInterfaceService'));

And my UserController has the following code
$paypalService=new PayPalApi\PayPalAPIInterfaceServiceService(Yii::app()->Paypal);
$paymentDetails= new PayPalApi\PaymentDetailsType();
$orderTotal = new BasicAmountType();
$orderTotal->currencyID = 'USD';
$orderTotal->value = 0;
...
....
...

I got the following error ::::

Fatal error: Class 'PayPalApi\PayPalAPIInterfaceServiceService' not found in /Applications/XAMPP/xamppfiles/htdocs/boatapp/protected/controllers/UserController.php on line 254

Warning: Ambiguous class resolution in Composer

When installing by composer ( have updated to the latest composer ), I receive dozens of the following Warnings:

Warning: Ambiguous class resolution, "PayPalAPIInterfaceServiceService" was found in both "/var/www/site.dev/vendor/paypal/merchant-sdk-php/lib/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php" and "/var/www/site.dev/vendor/paypal/merchant-sdk-php/lib/services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php", the first will be used.

Samples Not Working

When I try to run the samples I get this error message:

Fatal error: Access to undeclared static property: PPBaseService::$SDK_NAME in /var/www/robertevansmb/paypal/vendor/paypal/merchant-sdk-php/samples/vendor/paypal/paypal-merchant-sdk-php-4f570f5/lib/services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php on line 22

Can't install with composer

My composer.json:

{
    "require":{
        "zendframework/zendframework1": "1.12.6",
        "twig/twig": "1.*",
        "swiftmailer/swiftmailer": "@stable",
        "vendors/anet_php_sdk": "1.1.8",
        "tpyo/amazon-s3-php-class": "v0.5.0",
        "silex/silex":"v1.0.0",
        "oyejorge/less.php": "~1.5",
        "opauth/opauth": "*",
        "opauth/google": "*",
        "paypal/merchant-sdk-php":"v3.6.106"
    }
}

Output from composer

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for paypal/merchant-sdk-php v3.6.106 -> satisfiable by paypal/merchant-sdk-php[v3.6.106].
    - Conclusion: remove paypal/sdk-core-php V1.2.0
    - paypal/merchant-sdk-php v3.6.106 requires paypal/sdk-core-php 2.4.* -> satisfiable by paypal/sdk-core-php[v2.4.0, v2.4.1, v2.4.2, v2.4.3].
    - Can only install one of: paypal/sdk-core-php[v2.4.0, V1.2.0].
    - Can only install one of: paypal/sdk-core-php[v2.4.1, V1.2.0].
    - Can only install one of: paypal/sdk-core-php[v2.4.2, V1.2.0].
    - Can only install one of: paypal/sdk-core-php[v2.4.3, V1.2.0].
    - Installation request for paypal/sdk-core-php == 1.2.0.0 -> satisfiable by paypal/sdk-core-php[V1.2.0].

small bug in DGsetExpressCheckout sample

\samples\ExpressCheckout\DGsetExpressCheckout.php
line 103

$setECResponse = $PayPal_service->SetExpressCheckout($setECReq);
should be
$setECResponse = $paypalService->SetExpressCheckout($setECReq);

ShippingDiscount and InsuranceTotal do not get carried to GetTransactionDetails object.

I am using SDK 98, Express Checkout, PHP

problem
Set $paymentDetails->ShippingTotal and
$paymentDetails->InsuranceTotal, do a DoDirectPayment,
grab the transaction id, and call getTransactionDetails. In getTransactionDetails response object, ShipDiscount and InsuranceAmount are not set.

Reproduce by:
step 1.
go to samples/DirectPayment
modify DoDirectPayment.php to add the
following to the paymentDetails object:
ItemTotal, ShippingTotal, ShippingDiscount,
InsuranceTotal. You would also need to modify
the OrderTotal. It would look something like this.

$paymentDetails->ItemTotal = new BasicAmountType('USD', $_POST['amount']);

$paymentDetails->ShippingTotal = new BasicAmountType('USD', 2.00);

$paymentDetails->ShippingDiscount = new BasicAmountType('USD', -1.60);

$paymentDetails->InsuranceTotal = new BasicAmountType('USD', 1.40);

$paymentDetails->OrderTotal = new BasicAmountType('USD', $paymentDetails->ItemTotal + $paymentDetails->ShippingTotal->value  + $paymentDetails->ShippingDiscount->value + $paymentDetails->InsuranceTotal->value);

step 2.
run the program. Notice that the paymentDetails objects are all set correctly. Good so far.

step 3.
Down at the bottom, after this code:

  echo "<pre>";
  print_r($doDirectPaymentResponse);
  echo "</pre>";

Add some code here to call GetTransactionDetails
using the transaction id you just got
($doDirectPaymentResponse->TransactionID)

step 4.
run it.

results:

Observe the GetTransactionDetails response object.
Notice that ShipDiscount and InsuranceAmount are
not set. Also notice that ShipAmount is not a
BasicAmountType object here; it was back in PaymentDetails when we defined it.
Here are some snippets from that object.

                    [ShipAmount] => 2.00
                    [ShipHandleAmount] => 0.00
                    [ShipDiscount] => 
                    [InsuranceAmount] =>

                    [GrossAmount] => BasicAmountType Object
                        (
                            [currencyID] => USD
                            [value] => 2.80
                        )

SSL3 wrong version number

I get this error when trying to start a transaction:

PayPal\Exception\PPConnectionException error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

I think it's related to this pull request on the rest api: paypal/PayPal-PHP-SDK#127

The endpoint is wrong

The $httpConfig->getUrl() always returns an array no matter what I set in the sdk_config.ini file. It should be a string.

Version PayPal Core SDK - V1.5.0 has namespace references in 2 modules

Trying to install the PHP 5.2 version and getting errors during install because of namespace references in two modules.
PHP Warning: Unexpected character in input: '' (ASCII=92) state=1 in samples/install.php on line 340
PHP Warning: Unexpected character in input: '' (ASCII=92) state=1 in samples/install.php on line 340

The offending modules and code are:
PPApiContext.php: $this->config = \PPConfigManager::getInstance()->getConfigHashmap();
PPReflectionUtil.php: $refl = new \ReflectionMethod($class, $getter);

The build is paypal-sdk-core-php-2ee73c7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.