当前位置: 首页>>代码示例>>PHP>>正文


PHP PayPalAPIInterfaceServiceService::BMCreateButton方法代码示例

本文整理汇总了PHP中PayPalAPIInterfaceServiceService::BMCreateButton方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPalAPIInterfaceServiceService::BMCreateButton方法的具体用法?PHP PayPalAPIInterfaceServiceService::BMCreateButton怎么用?PHP PayPalAPIInterfaceServiceService::BMCreateButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PayPalAPIInterfaceServiceService的用法示例。


在下文中一共展示了PayPalAPIInterfaceServiceService::BMCreateButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OptionDetailsType

    $optionSelectionDetails->PaymentPeriod = $paymentPeriod;
    $optionDetails = new OptionDetailsType();
    $optionDetails->OptionName = "CreateButton";
    $optionDetails->OptionSelectionDetails = $optionSelectionDetails;
} elseif ($_REQUEST['buttonType'] == "AUTOBILLING") {
    $buttonVar["min_amount"] = $_REQUEST['minAmt'];
} elseif ($_REQUEST['buttonType'] == "GIFTCERTIFICATE") {
    $buttonVar["shopping_url"] = $_REQUEST['shoppingUrl'];
} elseif ($_REQUEST['buttonType'] == "PAYMENT") {
    $buttonVar["subtotal"] = $_REQUEST['subTotal'];
} elseif ($_REQUEST['buttonType'] == "SUBSCRIBE") {
    $buttonVar["a3"] = $_REQUEST['subAmt'];
    $buttonVar["p3"] = $_REQUEST['subPeriod'];
    $buttonVar["t3"] = $_REQUEST['subInterval'];
}
$createButtonRequest = new BMCreateButtonRequestType();
$createButtonRequest->ButtonCode = $_REQUEST['buttonCode'];
$createButtonRequest->ButtonType = $_REQUEST['buttonType'];
$createButtonRequest->Version = 86.0;
$createButtonRequest->ButtonVar[0] = $buttonVar;
if ($_REQUEST['buttonType'] == "PAYMENTPLAN") {
    $createButtonRequest->OptionDetails = $optionDetails;
}
$createButtonReq = new BMCreateButtonReq();
$createButtonReq->BMCreateButtonRequest = $createButtonRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
$createButtonResponse = $paypalService->BMCreateButton($createButtonReq);
echo "<pre>";
print_r($createButtonResponse);
echo "</pre>";
require_once '../Response.php';
开发者ID:kashyapkk,项目名称:SDKs,代码行数:31,代码来源:BMCreateButton.php

示例2: actionPay

 public function actionPay($id)
 {
     $reservation = Reservation::model()->findByPk($id);
     if (isset($reservation)) {
         Yii::app()->session['llegada'] = $reservation->arrival_date;
         Yii::app()->session['salida'] = $reservation->departure_date;
         Yii::app()->session['maxPersonas'] = $reservation->number_people;
         Yii::app()->session['total'] = $reservation->total;
         $count = 0;
         $habitacion = [];
         foreach (RoomsBooked::model()->findAllByAttributes(array('reservation_id' => $reservation->id)) as $i => $rb) {
             $count += $rb->quantity;
             for ($i = 0; $i < $rb->quantity; $i++) {
                 $n = 'room_' . TypeRoom::model()->findByPk($rb->type_room_id)->name . '_name';
                 array_push($habitacion, Yii::t('rooms', $n));
             }
         }
         Yii::app()->session['habitacion'] = $habitacion;
         Yii::app()->session['habitaciones'] = $count;
         /* paypal */
         require_once 'paypal/PPBootStrap.php';
         $buttonVar = array("item_name=reservacion", "item_number=" . $this->generateRandomString(3) . $reservation->id . $this->generateRandomString(1), "return=" . Yii::app()->request->getBaseUrl(true) . "#cuenta", "business=marisaloorv@yahoo.com", "amount=" . $reservation->total, "notify_url=" . Yii::app()->request->getBaseUrl(true) . "/site/ipn", "no_shipping=1", "cancel_return=" . Yii::app()->request->getBaseUrl(true) . "#cuenta");
         $createButtonRequest = new BMCreateButtonRequestType();
         $createButtonRequest->ButtonCode = "ENCRYPTED";
         $createButtonRequest->ButtonType = "BUYNOW";
         $createButtonRequest->ButtonSubType = 'SERVICES';
         $createButtonRequest->BuyNowText = 'PAYNOW';
         $createButtonRequest->ButtonLanguage = 'es';
         $createButtonRequest->ButtonImageURL = Yii::app()->request->getBaseUrl(true) . "/images/paypal.png";
         $createButtonRequest->ButtonVar = $buttonVar;
         $createButtonReq = new BMCreateButtonReq();
         $createButtonReq->BMCreateButtonRequest = $createButtonRequest;
         $paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig());
         try {
             $createButtonResponse = $paypalService->BMCreateButton($createButtonReq);
             if ($createButtonResponse->Ack == 'Success') {
                 Yii::app()->session['button'] = $createButtonResponse->Website;
             } else {
                 $this->redirect(Yii::app()->request->getBaseUrl(true) . '#cuenta');
             }
         } catch (Exception $ex) {
             print_r($ex);
             die;
         }
         /* --- */
         $this->redirect(Yii::app()->request->getBaseUrl(true) . '#pagar');
     } else {
         $this->redirect(Yii::app()->request->getBaseUrl(true) . '#cuenta');
     }
 }
开发者ID:frankpaul142,项目名称:edenblue,代码行数:50,代码来源:SiteController.php

示例3: getPaymentCode

 /**
  * Get HTML code for payment button
  *
  */
 public function getPaymentCode()
 {
     $path = JPATH_COMPONENT . '/lib/payment/paypal_standard/lib';
     set_include_path($path);
     require_once 'services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php';
     $createButtonRequest = new BMCreateButtonRequestType();
     $createButtonRequest->ButtonCode = 'ENCRYPTED';
     $createButtonRequest->ButtonType = 'BUYNOW';
     $createButtonRequest->ButtonVar = $this->buttonVars;
     $createButtonReq = new BMCreateButtonReq();
     $createButtonReq->BMCreateButtonRequest = $createButtonRequest;
     $paypalService = new PayPalAPIInterfaceServiceService();
     $credentials = new PPSignatureCredential($this->credentials->user, $this->credentials->password, $this->credentials->signature);
     try {
         $createButtonResponse = $paypalService->BMCreateButton($createButtonReq, $credentials);
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
         exit;
     }
     if ($createButtonResponse->Ack == 'Failure') {
         // Log error here
         //print_r($createButtonResponse); die;
         // Throw exception
         throw new Exception($createButtonResponse->Errors[0]->LongMessage);
     }
     //print_r($createButtonResponse);
     return $createButtonResponse->Website;
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:32,代码来源:PaymentProvider.php


注:本文中的PayPalAPIInterfaceServiceService::BMCreateButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。