/** * Start pyament processing through Paypal. * This method never returns. * * @param string $amount a single transaction's price * @param unknown $localTrxID application transaciton object * @throws PayPal_Exception_InvalidResponse */ public static function payment($amount, $localTrxID = null) { $impl = new PayPal(); $registration = $impl->registerTransaction($amount, $impl->storeLocalTrx($localTrxID)); Session::instance()->set(self::SESSION_TOKEN, $registration->id); foreach ($registration->links as $link) { if ($link->rel == 'approval_url') { HTTP::redirect($link->href); exit; // shouldn't be needed, redirect throws } } throw new PayPal_Exception_InvalidResponse('Missing approval URL'); }