class/paypal.php
/**
	 * Main payment function
	 * 
	 * If OK, the customer is redirected to PayPal gateway
	 * If error, the error info is returned
	 * 
	 * @param float $amount Amount (2 numbers after decimal point)
	 * @param string $desc Item description
	 * @param string $invoice Invoice number (can be omitted)
	 * @param string $currency 3-letter currency code (USD, GBP, CZK etc.)
	 * 
	 * @return array error info
	 */
Main payment function

If OK, the customer is redirected to PayPal gateway
If error, the error info is returned

@param float $amount Amount (2 numbers after decimal point)
@param string $desc Item description
@param string $invoice Invoice number (can be omitted)
@param string $currency 3-letter currency code (USD, GBP, CZK etc.)

@return array error info
Main payment function If OK the customer is redirected to PayPal gateway If error the error info is returned @param float $amount Amount ( 2 numbers after decimal point ) @param string $desc Item description @param string $invoice Invoice number ( can be omitted ) @param string $currency 3 - letter currency code ( USD GBP CZK etc . ) @return array error info
public function doExpressCheckout($amount, $desc, $invoice='', $currency='USD'){
		$data = array(
		'PAYMENTACTION' =>'Sale',
		'AMT' =>$amount,
		'RETURNURL' => self::PP_RETURN,
		'CANCELURL'  => self::PP_CANCEL,
		'DESC'=>$desc,
		'NOSHIPPING'=>"1",
		'ALLOWNOTE'=>"1",
		'CURRENCYCODE'=>$currency,
		'METHOD' =>'SetExpressCheckout');
		$data['CUSTOM'] = $amount.'|'.$currency.'|'.$invoice;
		if ($invoice) $data['INVNUM'] = $invoice;
		$query = $this->buildQuery($data);
		$result = $this->response($query);
		if (!$result) return false;
		$response = $result->getContent();
		$return = $this->responseParse($response);
		if ($return['ACK'] == 'Success') {
			header('Location: '.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].'');
			die();
		}
		return($return);
	}
public function doExpressCheckout ( $ amount , $ desc , $ invoice = '' , $ currency = 'USD' ) { $ data = array ( 'PAYMENTACTION' => 'Sale' , 'AMT' => $ amount , 'RETURNURL' => self :: PP_RETURN , 'CANCELURL' => self :: PP_CANCEL , 'DESC' => $ desc , 'NOSHIPPING' => " 1 " , 'ALLOWNOTE' => " 1 " , 'CURRENCYCODE' => $ currency , 'METHOD' => 'SetExpressCheckout' ) ; $ data [ 'CUSTOM' ] = $ amount . '|' . $ currency . '|' . $ invoice ; if ( $ invoice ) $ data [ 'INVNUM' ] = $ invoice ; $ query = $ this -> buildQuery ( $ data ) ; $ result = $ this -> response ( $ query ) ; if ( ! $ result ) return false ; $ response = $ result -> getContent ( ) ; $ return = $ this -> responseParse ( $ response ) ; if ( $ return [ 'ACK' ] == 'Success' ) { header ( 'Location: ' . $ this -> gate . 'cmd=_express-checkout&useraction=commit&token=' . $ return [ 'TOKEN' ] . '' ) ; die ( ) ; } return ( $ return ) ; }
Main payment function
Main payment function