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


PHP PayPal::PPHttpPost方法代码示例

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


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

示例1: checkout_response

 public static function checkout_response($registrationid, $PayerID, $token)
 {
     //we will be using these two variables to execute the "DoExpressCheckoutPayment"
     //Note: we haven't received any payment yet.
     $token = $_GET["token"];
     $payer_id = $_GET["PayerID"];
     $PayPalMode = Config::get('billing.paypalmode');
     // sandbox or live
     $PayPalApiUsername = Config::get('billing.paypalapiusername');
     //PayPal API Username
     $PayPalApiPassword = Config::get('billing.paypalapipassword');
     //Paypal API password
     $PayPalApiSignature = Config::get('billing.paypalapisignature');
     //Paypal API Signature
     $totalitemstring = Session::get('totalitemstring');
     $GrandTotal = Session::get('grandtotal');
     if ($totalitemstring == NULL || $GrandTotal == NULL) {
         return Redirect::to('/billing')->with('message', 'Your session has timed out, your card has not been charged, please try again.');
     }
     $padata = '&TOKEN=' . urlencode($token) . '&PAYERID=' . urlencode($payer_id) . '&PAYMENTREQUEST_0_PAYMENTACTION=' . urlencode("SALE") . $totalitemstring . '&PAYMENTREQUEST_0_AMT=' . urlencode($GrandTotal) . '&PAYMENTREQUEST_0_CUSTOM=' . urlencode($registrationid);
     //We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
     $paypal = new PayPal();
     $httpParsedResponseAr = $paypal->PPHttpPost('DoExpressCheckoutPayment', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
     // we can retrive transection details using either GetTransactionDetails or GetExpressCheckoutDetails
     // GetTransactionDetails requires a Transaction ID, and GetExpressCheckoutDetails requires Token returned by SetExpressCheckOut
     $paypal = new PayPal();
     if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
         $orderid = urldecode($httpParsedResponseAr['PAYMENTINFO_0_TRANSACTIONID']);
         $status = urldecode($httpParsedResponseAr['PAYMENTINFO_0_PAYMENTSTATUS']);
     } else {
         $orderid = 'N/A';
     }
     $padata = '&TOKEN=' . urlencode($token);
     $httpParsedResponseAr = $paypal->PPHttpPost('GetExpressCheckoutDetails', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
     $totalamount = urldecode($httpParsedResponseAr['AMT']);
     $registrationid = Auth::user()->registration->registrationid;
     $status = str_replace('PaymentAction', '', urldecode($httpParsedResponseAr['CHECKOUTSTATUS']));
     $order = new Bill();
     $order->registrationid = $registrationid;
     $order->method = "PayPal";
     $order->currency = 'USD';
     $order->description = 'PayPal Order Number: ' . $orderid;
     $order->amount = $totalamount;
     $order->checkout_id = $orderid;
     $order->status = ucwords($status);
     $order->save();
 }
开发者ID:JosephCrandall44,项目名称:assistance.net,代码行数:47,代码来源:Bill.php

示例2: sidebarAction

 public function sidebarAction()
 {
     $em = $this->getDoctrine()->getEntityManager();
     $tags = $em->getRepository('BloggerBlogBundle:Blog')->getTags();
     $tagWeights = $em->getRepository('BloggerBlogBundle:Blog')->getTagWeights($tags);
     $commentLimit = $this->container->getParameter('blogger_blog.comments.latest_comment_limit');
     $latestComments = $em->getRepository('BloggerBlogBundle:Comment')->getLatestComments($commentLimit);
     // call paypal values.
     $paypal = new PayPal();
     $credentials = array('API_UserName' => $this->container->getParameter('API_UserName'), 'API_Password' => $this->container->getParameter('API_Password'), 'API_Signature' => $this->container->getParameter('API_Signature'), 'nvpStr' => $this->container->getParameter('nvpStr'));
     $list = $paypal->PPHttpPost($credentials);
     $count = count($list);
     $valuetag = 'L_AMT';
     $currencytag = 'L_CURRENCYCODE';
     /*
     Paypal answer API GetBalance
     GetBalance Completed Successfully: Array
     (
         [L_AMT0] => 0%2e00
         [L_AMT1] => 3%2e42
         [L_CURRENCYCODE0] => EUR
         [L_CURRENCYCODE1] => USD
         [TIMESTAMP] => 2015%2d07%2d06T08%3a33%3a54Z
         [CORRELATIONID] => eb155640cfe0
         [ACK] => Success
         [VERSION] => 51%2e0
         [BUILD] => 17103657
     )
     */
     $lists = [];
     for ($i = 0; $i < ($count - 5) / 2; $i++) {
         $lists += array($list[$currencytag . $i] => urldecode($list[$valuetag . $i]));
     }
     return $this->render('BloggerBlogBundle:Page:sidebar.html.twig', array('latestComments' => $latestComments, 'tags' => $tagWeights, 'Show_PayPal' => $this->container->getParameter('Show_PayPal'), 'lists' => $lists, 'locale' => $this->container->getParameter('locale')));
 }
开发者ID:hrobben,项目名称:sf2_blog,代码行数:35,代码来源:PageController.php


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