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


PHP PayPalAPIInterfaceServiceService::GetExpressCheckoutDetails方法代码示例

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


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

示例1: getEC

 public function getEC()
 {
     $logger = new PPLoggingManager('GetExpressCheckout');
     // ## GetExpressCheckoutDetailsReq
     $getExpressCheckoutDetailsReq = new GetExpressCheckoutDetailsReq();
     // A timestamped token, the value of which was returned by
     // `SetExpressCheckout` response.
     $setEc = new SetExpressCheckout();
     $setEcResponse = $setEc->setExpressCheckout();
     var_dump($setEcResponse->Token);
     $getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($setEcResponse->Token);
     $getExpressCheckoutDetailsReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
     // ## Creating service wrapper object
     // Creating service wrapper object to make API call and loading
     // configuration file for your credentials and endpoint
     $service = new PayPalAPIInterfaceServiceService();
     try {
         // ## Making API call
         // Invoke the appropriate method corresponding to API in service
         // wrapper object
         $response = $service->GetExpressCheckoutDetails($getExpressCheckoutDetailsReq);
     } catch (Exception $ex) {
         $logger->error("Error Message : " + $ex->getMessage());
     }
     // ## Accessing response parameters
     // You can access the response parameters using variables in
     // response object as shown below
     // ### Success values
     if ($response->Ack == "Success") {
         // PayerID is PayPal Customer Account identification number
         // ($response->GetExpressCheckoutDetailsResponseDetails->PayerInfo->PayerID). This
         // value will be null unless you authorize the payment by
         // redirecting to PayPal after `SetExpressCheckout` call.
         $logger->log("PayerID : " . $response->GetExpressCheckoutDetailsResponseDetails->PayerInfo->PayerID);
     } else {
         $logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
     }
     return $response;
 }
开发者ID:andrewwakeling,项目名称:codesamples-php,代码行数:39,代码来源:GetExpressCheckout.php

示例2: PPLoggingManager

<?php

$path = '../../lib';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php';
require_once 'PPLoggingManager.php';
session_start();
$logger = new PPLoggingManager('GetExpressCheckout');
$token = $_REQUEST['token'];
$getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
$getExpressCheckoutDetailsRequest->Version = 92.0;
$getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
$getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
$getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
echo '<pre>';
print_r($getECResponse);
echo '</pre>';
if ($getECResponse->Ack == 'Success') {
    ?>
	<html>
	<body>

	</body>
	</html>
	<?php 
    require_once '../Response.php';
}
开发者ID:kashyapkk,项目名称:SDKs,代码行数:28,代码来源:GetExpressCheckout.php

示例3: getExpressCheckout

 public function getExpressCheckout($setToken)
 {
     $logger = new PPLoggingManager('GetTransactionDetails');
     $token = $setToken;
     $getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
     $getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
     $getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
     /*
     Creating service wrapper object
     Creating service wrapper object to make API call and loading
     Configuration::getAcctAndConfig() returns array that contains credential and config parameters
     */
     $paypalService = new PayPalAPIInterfaceServiceService();
     try {
         /* wrap API method calls on the service object with a try catch */
         $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
     } catch (Exception $ex) {
         $logger->error("API Error Message : " . $ex->getMessage());
     }
     if ($getECResponse->Ack == 'Success') {
         return $getECResponse;
     } else {
         $logger->error("API Error Message : " . $getECResponse);
         return FALSE;
     }
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:26,代码来源:PaypalComponent.php

示例4: confirm

 public function confirm($id, $token, $payer_id)
 {
     $products = $this->products;
     $product = $products[$id];
     if (empty($product)) {
         return;
     }
     $paypal_service = new PayPalAPIInterfaceServiceService($this->pp_settings);
     $ec_details_req_type = new GetExpressCheckoutDetailsRequestType($token);
     $ec_detail_req = new GetExpressCheckoutDetailsReq();
     $ec_detail_req->GetExpressCheckoutDetailsRequest = $ec_details_req_type;
     $ec_resp = $paypal_service->GetExpressCheckoutDetails($ec_detail_req);
     if (!$ec_resp && $ec_resp->Ack != 'Success') {
         throw new Exception("Paypal Request Failed");
     }
     //we now have the payer info
     $payer_info = $ec_resp->GetExpressCheckoutDetailsResponseDetails->PayerInfo;
     if ($product['recurring']) {
         $order_total = new BasicAmountType($product['currency'], $product['init_amount']);
     } else {
         $order_total = new BasicAmountType($product['currency'], $product['amount']);
     }
     $payment_details = new PaymentDetailsType();
     $payment_details->OrderTotal = $order_total;
     $payment_details->NotifyURL = $this->thankyou_url . '?action=ipn&id=' . $id;
     $do_ec_details = new DoExpressCheckoutPaymentRequestDetailsType();
     $do_ec_details->PayerID = $payer_id;
     $do_ec_details->Token = $token;
     $do_ec_details->PaymentDetails[0] = $payment_details;
     $do_ec_request = new DoExpressCheckoutPaymentRequestType();
     $do_ec_request->DoExpressCheckoutPaymentRequestDetails = $do_ec_details;
     if ($order_total->value > 0) {
         $do_ec = new DoExpressCheckoutPaymentReq();
         $do_ec->DoExpressCheckoutPaymentRequest = $do_ec_request;
         $do_ec_resp = $paypal_service->DoExpressCheckoutPayment($do_ec);
         if (!$do_ec_resp || $do_ec_resp->Ack != 'Success') {
             throw new Exception("Paypal Checkout Error Has Occured");
         }
         //we now have a payment info. Yeehaaa
         $payment_info = current($do_ec_resp->DoExpressCheckoutPaymentResponseDetails->PaymentInfo);
         $accept_statuses = array('Completed', 'In-Progress', 'Pending', 'Processed');
         if (!in_array($payment_info->PaymentStatus, $accept_statuses)) {
             throw new Exception("Paypal Payment Checkout Failed");
         }
     }
     if ($product['recurring']) {
         //create a recurring payment profile
         $schedule_details = new ScheduleDetailsType();
         $payment_billing_period = new BillingPeriodDetailsType();
         $payment_billing_period->BillingFrequency = $product['recur_billing_frequency'];
         $payment_billing_period->BillingPeriod = $product['recur_billing_period'];
         $payment_billing_period->Amount = new BasicAmountType($product['currency'], $product['recur_amount']);
         $schedule_details->PaymentPeriod = $payment_billing_period;
         $schedule_details->Description = sprintf("%s %s", $product['name'], __("Subscription", "wishlist-member"));
         $recur_profile_details = new RecurringPaymentsProfileDetailsType();
         $recur_profile_details->BillingStartDate = date(DATE_ATOM, strtotime(sprintf("+%s %s", $product['recur_billing_frequency'], $product['recur_billing_period'])));
         $create_recur_paypay_profile_details = new CreateRecurringPaymentsProfileRequestDetailsType();
         $create_recur_paypay_profile_details->Token = $token;
         $create_recur_paypay_profile_details->ScheduleDetails = $schedule_details;
         $create_recur_paypay_profile_details->RecurringPaymentsProfileDetails = $recur_profile_details;
         $create_recur_profile = new CreateRecurringPaymentsProfileRequestType();
         $create_recur_profile->CreateRecurringPaymentsProfileRequestDetails = $create_recur_paypay_profile_details;
         $create_recur_profile_req = new CreateRecurringPaymentsProfileReq();
         $create_recur_profile_req->CreateRecurringPaymentsProfileRequest = $create_recur_profile;
         $create_profile_resp = $paypal_service->CreateRecurringPaymentsProfile($create_recur_profile_req);
         if (!$create_profile_resp || $create_profile_resp->Ack != 'Success') {
             throw new Exception("Could not create recurring profile");
         }
     }
     $address = array();
     $address['company'] = $payer_info->PayerBusiness;
     $address['address1'] = $payer_info->Address->Street1;
     $address['address2'] = $payer_info->Address->Street2;
     $address['city'] = $payer_info->Address->CityName;
     $address['state'] = $payer_info->Address->StateOrProvince;
     $address['zip'] = $payer_info->Address->PostalCode;
     $address['country'] = $payer_info->Address->CountryName;
     $_POST['wpm_useraddress'] = $address;
     $_POST['lastname'] = $payer_info->PayerName->LastName;
     $_POST['firstname'] = $payer_info->PayerName->FirstName;
     $_POST['action'] = 'wpm_register';
     $_POST['wpm_id'] = $product['sku'];
     $_POST['username'] = $payer_info->Payer;
     $_POST['email'] = $payer_info->Payer;
     $_POST['password1'] = $_POST['password2'] = $this->wlm->PassGen();
     $_POST['sctxnid'] = $product['recurring'] ? $create_profile_resp->CreateRecurringPaymentsProfileResponseDetails->ProfileID : $payment_info->TransactionID;
     $pending_statuses = array('In-Progress', 'Pending');
     if (in_array($payment_info->PaymentStatus, $pending_statuses) || $create_profile_resp->CreateRecurringPaymentsProfileResponseDetails->ProfileStatus == 'PendingProfile') {
         $this->wlm->ShoppingCartRegistration(null, null, 'Paypal Pending');
     } else {
         $this->wlm->ShoppingCartRegistration();
     }
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:93,代码来源:integration.shoppingcart.paypalpro.php


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