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


PHP PayPalAPIInterfaceServiceService::DoReferenceTransaction方法代碼示例

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


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

示例1: ReferenceCreditCardDetailsType

    $creditCardNumberType->CreditCardType = $_REQUEST['creditCardType'];
    $creditCard = new ReferenceCreditCardDetailsType();
    $creditCard->CardOwnerName = $cardOwner;
    $creditCard->BillingAddress = $billingAddress;
    $creditCard->CreditCardNumberType = $creditCardNumberType;
    $creditCard->CVV2 = $_REQUEST['CVV2'];
    $creditCard->ExpMonth = $_REQUEST['expMonth'];
    $creditCard->ExpYear = $_REQUEST['expYear'];
}
$paymentDetails = new PaymentDetailsType();
$paymentDetails->OrderTotal = $amount;
$paymentDetails->ShipToAddress = $shippingAddress;
$RTRequestDetails = new DoReferenceTransactionRequestDetailsType();
if (isset($_REQUEST['ReferenceCreditCardDetails']) && $_REQUEST['ReferenceCreditCardDetails'] == "ON") {
    $RTRequestDetails->CreditCard = $creditCard;
}
$RTRequestDetails->PaymentDetails = $paymentDetails;
$RTRequestDetails->ReferenceID = $_REQUEST['referenceID'];
$RTRequestDetails->PaymentAction = $_REQUEST['paymentAction'];
$RTRequestDetails->PaymentType = $_REQUEST['paymentType'];
$RTRequest = new DoReferenceTransactionRequestType();
$RTRequest->DoReferenceTransactionRequestDetails = $RTRequestDetails;
$RTRequest->Version = 92;
$RTReq = new DoReferenceTransactionReq();
$RTReq->DoReferenceTransactionRequest = $RTRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
$RTResponse = $paypalService->DoReferenceTransaction($RTReq);
echo "<pre>";
print_r($RTResponse);
echo "</pre>";
require_once '../Response.php';
開發者ID:kashyapkk,項目名稱:SDKs,代碼行數:31,代碼來源:DoReferenceTransaction.php

示例2: doReferenceTxn

 public function doReferenceTxn()
 {
     $logger = new PPLoggingManager('DoReferenceTransaction');
     // ## DoReferenceTransactionReq
     $doReferenceTransactionReq = new DoReferenceTransactionReq();
     // Information about the payment.
     $paymentDetails = new PaymentDetailsType();
     // The total cost of the transaction to the buyer. If shipping cost and
     // tax charges are known, include them in this value. If not, this value
     // should be the current subtotal of the order.
     // If the transaction includes one or more one-time purchases, this field must be equal to
     // the sum of the purchases. Set this field to 0 if the transaction does
     // not include a one-time purchase such as when you set up a billing
     // agreement for a recurring payment that is not immediately charged.
     // When the field is set to 0, purchase-specific fields are ignored
     //
     // * `Currency ID` - You must set the currencyID attribute to one of the
     // 3-character currency codes for any of the supported PayPal
     // currencies.
     // * `Amount`
     $orderTotal = new BasicAmountType("USD", "3.00");
     $paymentDetails->OrderTotal = $orderTotal;
     //Your URL for receiving Instant Payment Notification (IPN) about this transaction. If you do not specify this value in the request, the notification URL from your Merchant Profile is used, if one exists.
     $paymentDetails->NotifyURL = "http://localhost/ipn";
     // `DoReferenceTransactionRequestDetails` takes mandatory params:
     //
     // * `Reference Id` - A transaction ID from a previous purchase, such as a
     // credit card charge using the DoDirectPayment API, or a billing
     // agreement ID.
     // * `Payment Action Code` - How you want to obtain payment. It is one of
     // the following values:
     // * Authorization
     // * Sale
     // * Order
     // * None
     // * `Payment Details`
     $doReferenceTransactionRequestDetails = new DoReferenceTransactionRequestDetailsType("97U72738FY126561H", "Sale", $paymentDetails);
     $doReferenceTransactionRequest = new DoReferenceTransactionRequestType($doReferenceTransactionRequestDetails);
     $doReferenceTransactionReq->DoReferenceTransactionRequest = $doReferenceTransactionRequest;
     // ## 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->DoReferenceTransaction($doReferenceTransactionReq);
     } 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") {
         // The final amount charged, including any shipping and taxes from your Merchant Profile.
         $logger->log("Amount: " . $response->DoReferenceTransactionResponseDetails->Amount->value . $response->DoReferenceTransactionResponseDetails->Amount->currencyID);
     } else {
         $logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
     }
     return $response;
 }
開發者ID:andrewwakeling,項目名稱:codesamples-php,代碼行數:63,代碼來源:DoReferenceTransaction.php


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