當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PayPal::doPayment方法代碼示例

本文整理匯總了PHP中PayPal::doPayment方法的典型用法代碼示例。如果您正苦於以下問題:PHP PayPal::doPayment方法的具體用法?PHP PayPal::doPayment怎麽用?PHP PayPal::doPayment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PayPal的用法示例。


在下文中一共展示了PayPal::doPayment方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: PayPal

 function do_payment()
 {
     $amount = $this->input->get('amount');
     $r = new PayPal();
     $r->doExpressCheckout($amount, 'Da Greatest Library You Ever Seen');
     $final = $r->doPayment();
     if ($final['ACK'] == 'Success') {
         echo 'Succeed!';
     } else {
         echo 'Error!';
     }
 }
開發者ID:adadsa,項目名稱:sosmed,代碼行數:12,代碼來源:c_payment.php

示例2: PayPal

<?php

require_once './paypal/paypal.php';
require_once './paypal/httprequest.php';
//Load PHPMailer Class
require_once 'phpmailer/class.phpmailer.php';
//Use this form for production server
$r = new PayPal(true);
//Use this form for sandbox tests
// $r = new PayPal();
$final = $r->doPayment();
if ($final['ACK'] == 'Success') {
    $payment = $r->getCheckoutDetails($final['TOKEN']);
    //If payment from PayPal is successful, send out our thankyou email
    $first_name = $payment['FIRSTNAME'];
    $last_name = $payment['LASTNAME'];
    $name = $first_name . ' ' . $last_name;
    $email = $payment['EMAIL'];
    $amount = $payment['CUSTOM'];
    $amount = explode("|", $amount, 2);
    $amount = $amount[0];
    $date = $payment['TIMESTAMP'];
    $date = strtotime($date);
    // Build and send the email *using PHPMailer
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->SMTPAuth = true;
    $mail->Host = $mailConfig['host'];
    $mail->Port = 587;
    $mail->Username = $mailConfig['user'];
開發者ID:eooes,項目名稱:processing-web,代碼行數:31,代碼來源:_ppEmailThanks.php

示例3: executeConfirmation

 public function executeConfirmation(sfWebRequest $request)
 {
     $paypal = new PayPal();
     $final = $paypal->doPayment();
     if ($final['ACK'] == 'Success') {
         $this->result = "Succeed!";
         /*        Array
         //            (
         //            [TOKEN] => EC-4AV72391LH8693509
         //            [TIMESTAMP] => 2012-10-10T13:40:58Z
         //            [CORRELATIONID] => b20d0c034074
         //            [ACK] => Success
         //            [VERSION] => 52.0
         //            [BUILD] => 3893058
         //            [TRANSACTIONID] => 27557320TK055573R
         //            [TRANSACTIONTYPE] => expresscheckout
         //            [PAYMENTTYPE] => instant
         //            [ORDERTIME] => 2012-10-10T13:40:56Z
         //            [AMT] => 900.00
         //            [FEEAMT] => 30.85
         //            [TAXAMT] => 0.00
         //            [CURRENCYCODE] => EUR
         //            [PAYMENTSTATUS] => Completed
         //            [PENDINGREASON] => None
         //            [REASONCODE] => None
         //            )
                 
              :*/
         // CONTRAT
         $contratMobilyrent = new MobilyrentContrat();
         $contratMobilyrent->setDatecontrat(date('Y-m-d'));
         $contratMobilyrent->setDatedepart($this->getUser()->getAttribute('datedepart'));
         $contratMobilyrent->setDateretourprevue($this->getUser()->getAttribute('dateretour'));
         $contratMobilyrent->setDateretourreelle($this->getUser()->getAttribute('dateretour'));
         $contratMobilyrent->setPrixjournalierconvenu($this->getUser()->getAttribute('voiture')->getTarifJour());
         $contratMobilyrent->setNocontrat($final['CORRELATIONID']);
         $contratMobilyrent->setKmdepart(0);
         $contratMobilyrent->setKmretour(0);
         $contratMobilyrent->setIsActivated(1);
         $contratMobilyrent->setMontantaccompte($this->getUser()->getAttribute('voiture')->getMobilyrentModele()->getCaution());
         $contratMobilyrent->save();
         //FACTURE
         $factureMobilyrent = new MobilyrentFacture();
         $factureMobilyrent->setDatefacture(date('Y-m-d'));
         $factureMobilyrent->setNofacture($final['CORRELATIONID']);
         $factureMobilyrent->setTotalfacture($this->getUser()->getAttribute('montantLocation'));
         $factureMobilyrent->setIsActivated(1);
         $factureMobilyrent->setMobilyrentContrat($contratMobilyrent);
         $factureMobilyrent->save();
         //PAIEMENT
         $paiementMobilyrent = new MobilyrentPaiement();
         $paiementMobilyrent->setNom("test");
         $paiementMobilyrent->setPrenom("test");
         $paiementMobilyrent->setAdresse("1 Allée colette");
         $paiementMobilyrent->setCodepostal("91270");
         $paiementMobilyrent->setDatepaiement(date('Y-m-d'));
         $paiementMobilyrent->setMontantpaiement($this->getUser()->getAttribute('montantLocation'));
         $paiementMobilyrent->setMobilyrentFacture($factureMobilyrent);
         $paiementMobilyrent->setIdtypepaiement(2);
         $paiementMobilyrent->setIdstatut(1);
         $paiementMobilyrent->save();
         //GET SF_GUARD_USER
         $user = Doctrine::getTable('sfGuardUser')->retrieveByUsername($this->getUser()->getAttribute('email_address'));
         //echo '<pre>';
         //print_r();
         //exit;
         //LOCATION
         $locationMobilyrent = new MobilyrentLocation();
         $locationMobilyrent->setMobilyrentContrat($contratMobilyrent);
         $locationMobilyrent->setMobilyrentVehicule($this->getUser()->getAttribute('voiture'));
         //$locationMobilyrent->setIduserprofile($this->getUser()->getGuardUser()->getProfile()->getId());
         $locationMobilyrent->setIduserprofile($user->getProfile()->getId());
         $locationMobilyrent->setIsActivated(1);
         $locationMobilyrent->save();
         $message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $this->getUser()->getAttribute('email_address'), '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture', '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture');
         $this->getMailer()->send($message);
     } else {
         $this->result = "Failure!";
     }
 }
開發者ID:sfinx13,項目名稱:appsmartproject,代碼行數:80,代碼來源:_actions.class.php

示例4: executeConfirmation

 public function executeConfirmation(sfWebRequest $request)
 {
     $paypal = new PayPal();
     $final = $paypal->doPayment();
     if ($final['ACK'] == 'Success') {
         $this->result = "Succeed!";
         // CONTRAT
         $contratMobilyrent = new MobilyrentContrat();
         $contratMobilyrent->setDatecontrat(date('Y-m-d'));
         $contratMobilyrent->setDatedepart($this->getUser()->getAttribute('datedepart'));
         $contratMobilyrent->setDateretourprevue($this->getUser()->getAttribute('dateretour'));
         $contratMobilyrent->setDateretourreelle($this->getUser()->getAttribute('dateretour'));
         $contratMobilyrent->setPrixjournalierconvenu($this->getUser()->getAttribute('voiture')->getTarifJour());
         $contratMobilyrent->setNocontrat($final['CORRELATIONID']);
         $contratMobilyrent->setKmdepart(0);
         $contratMobilyrent->setKmretour(0);
         $contratMobilyrent->setIsActivated(1);
         $contratMobilyrent->setMontantaccompte($this->getUser()->getAttribute('voiture')->getMobilyrentModele()->getCaution());
         $contratMobilyrent->save();
         //FACTURE
         $factureMobilyrent = new MobilyrentFacture();
         $factureMobilyrent->setDatefacture(date('Y-m-d'));
         $factureMobilyrent->setNofacture($final['CORRELATIONID']);
         $factureMobilyrent->setTotalfacture($this->getUser()->getAttribute('montantLocation'));
         $factureMobilyrent->setIsActivated(1);
         $factureMobilyrent->setMobilyrentContrat($contratMobilyrent);
         $factureMobilyrent->save();
         //PAIEMENT
         $paiementMobilyrent = new MobilyrentPaiement();
         $paiementMobilyrent->setNom($this->getUser()->getGuardUser()->getLastName());
         $paiementMobilyrent->setPrenom($this->getUser()->getGuardUser()->getFirstName());
         $paiementMobilyrent->setAdresse($this->getUser()->getGuardUser()->getProfile()->getAdresse());
         $paiementMobilyrent->setCodepostal($this->getUser()->getGuardUser()->getProfile()->getCodepostal());
         $paiementMobilyrent->setDatepaiement(date('Y-m-d'));
         $paiementMobilyrent->setMontantpaiement($this->getUser()->getAttribute('montantLocation'));
         $paiementMobilyrent->setMobilyrentFacture($factureMobilyrent);
         $paiementMobilyrent->setIdtypepaiement(2);
         $paiementMobilyrent->setIdstatut(1);
         $paiementMobilyrent->save();
         //GET SF_GUARD_USER
         $user = Doctrine::getTable('sfGuardUser')->retrieveByUsername($this->getUser()->getAttribute('email_address'));
         $locationMobilyrent = new MobilyrentLocation();
         $locationMobilyrent->setMobilyrentContrat($contratMobilyrent);
         $locationMobilyrent->setMobilyrentVehicule($this->getUser()->getAttribute('voiture'));
         $locationMobilyrent->setIduserprofile($this->getUser()->getGuardUser()->getProfile()->getId());
         //$locationMobilyrent->setIduserprofile($user->getProfile()->getId());
         $locationMobilyrent->setIsActivated(1);
         $locationMobilyrent->save();
         $message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $this->getUser()->getAttribute('email_address'), '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture', '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture');
         $this->getMailer()->send($message);
         $startDate = $this->getUser()->getAttribute('datedepart');
         $startTime = $this->getUser()->getAttribute('heuredepart');
         $endDate = $this->getUser()->getAttribute('dateretour');
         $endTime = $this->getUser()->getAttribute('heureretour');
         $title = $this->getUser()->getGuardUser()->getName();
         $voitureObject = $this->getUser()->getAttribute('voiture');
         $content = "Reservation de la voiture:" . ' ' . $voitureObject->getNoimmatriculation();
         $startDate = "{$startDate}T{$startTime}";
         $endDate = "{$endDate}T{$endTime}";
         $this->setPlanning($startDate, $endDate, $title, $content);
     } else {
         $this->result = "Failure!";
     }
 }
開發者ID:sfinx13,項目名稱:appsmartproject,代碼行數:64,代碼來源:actions.class.php


注:本文中的PayPal::doPayment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。