Releases for sf 1.4
| Version |
License |
API |
Released |
|
0.0.4beta
|
MIT license |
0.0.4beta
|
20/03/2012 |
|
0.0.3beta
|
MIT license |
0.0.3beta
|
30/03/2010 |
Releases for sf 1.3
| Version |
License |
API |
Released |
|
0.0.4beta
|
MIT license |
0.0.4beta
|
20/03/2012 |
|
0.0.3beta
|
MIT license |
0.0.3beta
|
30/03/2010 |
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.0.4beta
|
MIT license |
0.0.4beta
|
20/03/2012 |
|
0.0.3beta
|
MIT license |
0.0.3beta
|
30/03/2010 |
|
0.0.2beta
|
MIT license |
0.0.2beta
|
29/10/2009 |
Changelog for release 0.0.3 - 30/03/2010
- Update plugin package.xml to allow installation for sf1.3/1.4
Other releases
Release 0.0.4 - 20/03/2012
- Update plugin package.xml to allow installation for sf1.3/1.4
- ticket #17 improve README file for sf1.4+ use
Release 0.0.3 - 30/03/2010
- Update plugin package.xml to allow installation for sf1.3/1.4
Release 0.0.2 - 29/10/2009
- Renaming of all "pfw" stuff in the code to "presta" one
- update README to give a real documentation in markdown syntax
WARNING : project who use 0.0.1 release must have to change its implementation. "pfwPaypal" class become "prestaPaypal" class
prestaPaypalPlugin
The prestaPaypalPlugin provides an easy way to integrate paypal on your website.
The PHP Paypal's API: SOAP Interface is included.
This plugin is largely inspired from sfPaypalDirectPlugin developped by Isaac Saldana.
Features
- Express checkout
- Direct payment
- Website payment standard
License
The prestaPaypal plugin is licensed under the MIT License.
Installation
First
First of all, you must create a developer account for testing on the sandbox : https://developer.paypal.com/.
Next step, generate your business account to recieve payements and user account to do payements.
The prestaPaypal constructor takes the path where you install Paypal's API. I don't recommend putting it on lib since you don't want it to be automatically loaded on every page view.
Direct Payment method
// Setup API's credentials
$cc = new prestaPaypal( sfConfig::get('sf_plugins_dir').DIRECTORY_SEPARATOR.'prestaPaypalPlugin'.DIRECTORY_SEPARATOR.'sdk'.DIRECTORY_SEPARATOR.'lib' );
// Your PayPal ID or an email address associated with your PayPal account. Email addresses must be confirmed.
$cc->setUserName(sfConfig::get('mod_registration_paypal_username'));
$cc->setPassword(sfConfig::get('mod_registration_paypal_password'));
// API signature
// How to get a signature ? https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_NVPAPIBasics
$cc->setSignature(sfConfig::get('mod_registration_paypal_signature'));
// Usefull in development environment
$cc->setTestMode(sfConfig::get('mod_registration_paypal_test'));
// Amount payement incl. taxes
$cc->setTransactionTotal($total);
// A description for the transaction
$cc->setTransactionDescription($desc);
// Client information :
$cc->setBillingFirstName($this->getRequestParameter('firstname'));
$cc->setBillingLastName($this->getRequestParameter('lastname'));
$cc->setBillingStreet1($this->getRequestParameter('address'));
$cc->setBillingStreet2($this->getRequestParameter('address2'));
$cc->setBillingCity($this->getRequestParameter('city'));
$cc->setBillingState($this->getRequestParameter('state'));
$cc->setBillingZip($this->getRequestParameter('zip'));
$cc->setCardType($this->getRequestParameter('cctype'));
$cc->setCardNumber($this->getRequestParameter('cc'));
$cc->setCardVerificationNumber($this->getRequestParameter('ccv'));
$cc->setCardExpirationMonth($this->getRequestParameter('expmonth'));
$cc->setCardExpirationYear($this->getRequestParameter('expyear'));
$cc->setBuyerIP($_SERVER['REMOTE_ADDR']);
// Do payement
if ( !$cc->chargeDirect() )
{
$error = $cc->getErrorString();
}
return $error;
Express Checkout
$cc = new prestaPaypal( sfConfig::get('sf_plugins_dir').DIRECTORY_SEPARATOR.'prestaPaypalPlugin'.DIRECTORY_SEPARATOR.'sdk'.DIRECTORY_SEPARATOR.'lib' );
// Setup API's credentials
// Your PayPal ID or an email address associated with your PayPal account. Email addresses must be confirmed.
$cc->setUserName(sfConfig::get('mod_registration_paypal_username'));
$cc->setPassword(sfConfig::get('mod_registration_paypal_password'));
// API signature
// How to get a signature ? https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_NVPAPIBasics
$cc->setSignature(sfConfig::get('mod_registration_paypal_signature'));
// Usefull in development environment
$cc->setTestMode(sfConfig::get('mod_registration_paypal_test'));
sfLoader::loadHelpers(array('Url'));
// A URL to which the payer's browser is redirected if payment is cancelled
$cc->setCancelURL(url_for('registration/cancelpaypal', true));
// The URL to which the payer's browser is redirected after completing the payment
$cc->setReturnURL(url_for('registration/chargepaypal', true));
// Amount payement incl. taxes
$cc->setTransactionTotal('39.95');
$cc->setTransactionDescription('Registration');
// The express url well-formed
$goto = $cc->GetExpressUrl();
if ( $goto )
{
$this->redirect($goto);
}
else
{
return $this->renderText('Error: ' . $cc->getErrorString());
}
Website payment standard
//paypal payment method
// We construct datas to send to paypal
$paypalData = array();
// _xclick, _donations, _cart, ...
$paypalData["cmd"] = sfConfig::get('app_paypal_cmd');
// Your PayPal ID or an email address associated with your PayPal account. Email addresses must be confirmed.
$paypalData["business"] = sfConfig::get('app_paypal_business');
// Name of the item or a name for the entire Shopping Cart
$paypalData["item_name"] = $offer_label;
// Price of the item or the total price of all items in the shopping cart.
$paypalData["amount"] = $offer_value;
// The cost of shipping this item
$paypalData["shipping"] = 0;
// 0