Exemplo n.º 1
0
require_once "paypal.php";
/*
+-------------------------------------------------------------------------------+
|   Very simple implementation - using static methods                           |
+-------------------------------------------------------------------------------+
*/
//setExpressCheckout
//if successful/canceled redirects to url specified in .ini file
SetExpressCheckout::request("50.00");
//amount is optional, if not set
//amount from .ini file is used
//GetExpressCheckoutDetails - optional, returns customer's details from paypal
//this has to be one the page specified in SetExpressCheckout.ini
$response = GetExpressCheckoutDetails::request();
//DoExpressCheckoutPayment - returns success or failure
$response = DoExpressCheckoutPayment::request("50.00");
//amount is optional, if not set
//amount from .ini file is used
/*
+-------------------------------------------------------------------------------+
|   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