public function revieworderAction() { require_once "paypal/paypal.php"; $cart =& $_SESSION['jCart']; if (!is_object($cart)) { $cart = new jCart(); } $this->view->cart = $cart; $jcartId = $this->view->cart->items; $totalAmount = number_format(count($jcartId) * 20.0, 2); if (!empty($_GET['token'])) { //get express checkout details (optional) //the code below has to be placed in the file specified in RETURNURL //(in SetExpressCheckout.ini) or setNVP() method $result = GetExpressCheckoutDetails::request(); //there's no need to use: $data = new GetExpressCheckoutDetails(); //but if you want, you can // now you can save data in database or whatever you want $this->view->token = $_GET['token']; $this->view->payerId = $_GET['PayerID']; $this->view->amount = $totalAmount; } }
+-------------------------------------------------------------------------------+ | Recurring payments implementation | +-------------------------------------------------------------------------------+ */ $test = new SetExpressCheckout("50.00"); //amount - optional, if not set //amount form .ini file will be used $test->setNVP("L_BILLINGTYPE0", "RecurringPayments"); $test->setNVP("L_BILLINGAGREEMENTDESCRIPTION0", "book order"); $test->getResponse(); //!!! you cannot use static method if you wan to use recurring payment, because //you neet to set L_BILLINGTYPEn and L_BILLINGAGREEMENTDESCRIPTIONn //get express checkout details (optional) //the code below has to be placed in the file specified in RETURNURL //(in SetExpressCheckout.ini) or setNVP() method $result = GetExpressCheckoutDetails::request(); //there's no need to use: $data = new GetExpressCheckoutDetails(); //but if you want, you can // now you can save data in database or whatever you want //do express checkout returns success or failure $doPay = new DoExpressCheckoutPayment("50.00"); //amount is optional but should be //similar to the one set in //SetExpressCehckout $result = $doPay->getResponse(); //result holds response from PayPal so you need to check if it was successful //create recurring payments profile response is success or failure ///first value is description and is required - same as //L_BILLINGAGREEMENTDESCRIPTIONn in SetExpressCheckout. //second value is amountt $recPay = new CreateRecurringPaymentsProfile("book order", "50.00");