本文整理汇总了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';
示例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;
}