1. Go to this page and download the library: Download metaer/merchant-sdk-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
metaer / merchant-sdk-php example snippets
// Sets config file path(if config file is used) and registers the classloader
g 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
}
$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);
define('PP_CONFIG_PATH', '/directory/that/contains/sdk_config.ini');
$service = new PayPalAPIInterfaceServiceService();
php
/**
* 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',
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.