Example #1
0
 public function process($settings = array())
 {
     $usccess = (isset($_GET['success']) and !empty($_GET['success'])) ? $_GET['success'] : '';
     $paymentId = (isset($_GET['paymentId']) and !empty($_GET['paymentId'])) ? $_GET['paymentId'] : '';
     $token = (isset($_GET['token']) and !empty($_GET['token'])) ? $_GET['token'] : '';
     $payerId = (isset($_GET['PayerID']) and !empty($_GET['PayerID'])) ? $_GET['PayerID'] : '';
     ## unable to authenticate
     if (!$this->authenthication($settings['environment'])) {
         return false;
     }
     #set ApiContext
     $apiContext = PaypalContext::ApiContext($this->credentials, $this->sdkConfiguration);
     return Payment::execute($paymentId, $payerId, $apiContext);
 }
 public function start(array $items, $settings = array(), $paymentMethod = 'paypal', $currency = 'USD')
 {
     ## unable to authenticate
     if (!$this->authenthication($settings['environment'])) {
         return false;
     }
     #set ApiContext
     $apiContext = PaypalContext::ApiContext($this->credentials, $this->sdkConfiguration);
     #set payment method
     $payer = PaymentMethod::ConfigPayment($paymentMethod);
     #set Items and Total to bill
     if (!($itemsList = Items::setItemsList($items, $currency))) {
         ## unable to load the items to sell.
         return false;
     }
     #set final amount.
     $amount = Amount::setAmount(Items::getTotal(), $currency);
     #set transaction.
     $transaction = Transaction::setTransaction($amount, $itemsList);
     #set redirections.
     $redirectUrls = Redirections::setURLs();
     self::_createPaymentURL($payer, $redirectUrls, $transaction, $apiContext);
 }