PHP code example of ladela / paypal-adaptivepayments-sdk-php
1. Go to this page and download the library: Download ladela/paypal-adaptivepayments-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/ */
ladela / paypal-adaptivepayments-sdk-php example snippets
php
$payRequest = new PayRequest($requestEnvelope, $actionType, $cancelUrl,
$currencyCode, $receiverList, $returnUrl);
// Add optional params
if($_POST["feesPayer"] != "") {
$payRequest->feesPayer = $_POST["feesPayer"];
}
......
$service = new AdaptivePaymentsService();
$response = $service->Pay($payRequest);
$ack = strtoupper($response->responseEnvelope->ack);
if($ack == 'SUCCESS') {
// Success
}