well paypal SDK is extremely simple. first if i were you i would install their example code and make sure it work on your server, from my previous experience there are rare cases where the SDK wont work and have php version issues.
Secondly after you're sure it works on your server, the chart flow is:
step 1.) SetExpressCheckout - with all the required fields like:billing address, products cart total etc...
if that was done correct you'll get a token,
step 2.) GetExpressCheckout - With the previously acquired token you'll do GetExpressCheckout passing the token, if that done correct you'll get:Ack, Token, PayerID, value, currencyID and basically an object that has all the purchase details.
step 3.) DoExpressCheckout - use the acquired fields from 2 to do a DoExpressCheckout as follows:
$path = $pluginfolder.'paypal/lib';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once('services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php');
require_once('PPLoggingManager.php');
$logger = new PPLoggingManager('DoExpressCheckout');
$token = urlencode( $getToken );
$payerId = urlencode( $getPayerID);
$paymentAction = urlencode( $paymentType);
$orderTotal = new BasicAmountType();
$orderTotal->currencyID = $getCurrencyID;
$orderTotal->value = $getOrderTotal;
$paymentDetails= new PaymentDetailsType();
$paymentDetails->OrderTotal = $orderTotal;
if(isset($notifyURL))
{
$paymentDetails->NotifyURL = $notifyURL;
}
$DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
$DoECRequestDetails->PayerID = $payerId;
$DoECRequestDetails->Token = $token;
$DoECRequestDetails->PaymentAction = $paymentAction;
$DoECRequestDetails->PaymentDetails[0] = $paymentDetails;
$DoECRequest = new DoExpressCheckoutPaymentRequestType();
$DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
$DoECReq = new DoExpressCheckoutPaymentReq();
$DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
/*
* Trying to go a head with the payment and catching errors that might occure.
*/
try {
/* wrap API method calls on the service object with a try catch */
$DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq);
} catch (Exception $ex) {
if(isset($ex)) {
$ex_message = $ex->getMessage();
$ex_type = get_class($ex);
if($ex instanceof PPConnectionException) {
$error[] = "Error connecting to " . $ex->getUrl();
$errorCheck = true;
} else if($ex instanceof PPMissingCredentialException || $ex instanceof PPInvalidCredentialException) {
$error[] = $ex->errorMessage();
$errorCheck = true;
} else if($ex instanceof PPConfigurationException) {
$error[] = "Invalid configuration. Please check your configuration file";
$errorCheck = true;
}
}
}
i hope that helps.