![]() |
|
prestaPaypalPlugin - 0.0.4Shortcut for Paypal API usage |
|
![]() |
17
users
Sign-in
to change your status |
The prestaPaypal plugin 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 :
|
Plugin that allow to easily use Paypal API.
Orginally developed by Prestaconcept for it's projects.
| Name | Status | |
|---|---|---|
|
|
lead | ten.tpecnocatserp <<ta>> dnauqnircm |
Copyright (c) 2009 PrestaConcept
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
| 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 |
| 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 |
| 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 |
WARNING : project who use 0.0.1 release must have to change its implementation. "pfwPaypal" class become "prestaPaypal" class
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.
The prestaPaypal plugin is licensed under the MIT License.
Install the plugin:
$ symfony plugin:install prestaPaypalPlugin $ symfony cc
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.
// 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;
$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')); // Warning : you must be in an action method for this line sfContext::getInstance()->getConfiguration()->loadHelpers('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()); }
//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 � prompt for an address, but do not require one // 1 � do not prompt for an address // 2 � prompt for an address, and require one $paypalData["no_shipping"] = 1; // Passthrough variable never presented to the payer. $paypalData["custom"] = $id_invoice; // The URL to which the payer's browser is redirected after completing the payment $paypalData["return"] = url_for('invoice/listInvoice', true); // A URL to which the payer's browser is redirected if payment is cancelled $paypalData["cancel_return"] = url_for('invoice/cancelPaypal?id_invoice='.$this->o_order->getIdInvoiceSite(), true); // The URL to which PayPal posts information about the transaction, in the form of Instant Payment Notification messages. $paypalData["notify_url"] = url_for('general/paypalNotify', true); // Do not prompt payers to include a note with their payments $paypalData["no_note"] = '1'; // The currency of prices for trial periods and the subscription. The default is USD. $paypalData["currency_code"] = sfConfig::get('app_paypal_currency'); // Transaction-based tax override variable. // Set this to a flat tax amount to apply to the transaction regardless of the buyer's location. // This value overrides any tax settings set in your account profile. // Valid only for Buy Now and Add to Cart buttons. // Default � Profile tax settings, if any, apply. $paypalData["tax"] = _calc_montant_TVA( $this->o_order->getOfferValueHt(), $this->o_order->getTvaValue() ); // The language of the login or sign-up page that subscribers see when they click the Subscribe button $paypalData["lc"] = 'FR'; // Type of button. For example, PP-BuyNowBF. $paypalData["bn"] = sfConfig::get('app_paypal_bn'); // Host for payement. For example, https://www.paypal.com/cgi-bin/webscr $paypalData["host"] = sfConfig::get('app_paypal_host'); // The picture used for the button. For example, https://www.paypal.com/fr_FR/FR/i/btn/btn_buynow_LG.gif $paypalData["button"] = sfConfig::get('app_paypal_button'); // Don't need to load paypal's api $payment_form = new prestaPaypal(); $this->paypal_form = $payment_form->getFormStandardPayment($paypalData); // In <view>Success.php : // echo $paypal_form->render();
HTML Variables for Website Payments Standard : here
The prestaPaypalPlugin use the PHP Paypal's API Version 4.3.7.
