本文整理汇总了PHP中PayPalAPIInterfaceServiceService类的典型用法代码示例。如果您正苦于以下问题:PHP PayPalAPIInterfaceServiceService类的具体用法?PHP PayPalAPIInterfaceServiceService怎么用?PHP PayPalAPIInterfaceServiceService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PayPalAPIInterfaceServiceService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refund
public function refund()
{
$logger = new PPLoggingManager('RefundTransaction');
// ## RefundTransactionReq
$refundTransactionReq = new RefundTransactionReq();
$refundTransactionRequest = new RefundTransactionRequestType();
// Either the `transaction ID` or the `payer ID` must be specified.
// PayerID is unique encrypted merchant identification number
// For setting `payerId`,
// `refundTransactionRequest.setPayerID("A9BVYX8XCR9ZQ");`
// Unique identifier of the transaction to be refunded.
$refundTransactionRequest->TransactionID = "1GF88795WC5643301";
// Type of refund you are making. It is one of the following values:
//
// * `Full` - Full refund (default).
// * `Partial` - Partial refund.
// * `ExternalDispute` - External dispute. (Value available since
// version
// 82.0)
// * `Other` - Other type of refund. (Value available since version
// 82.0)
$refundTransactionRequest->RefundType = "Partial";
// `Refund amount`, which contains
//
// * `Currency Code`
// * `Amount`
// The amount is required if RefundType is Partial.
// `Note:
// If RefundType is Full, do not set the amount.`
$amount = new BasicAmountType("USD", "1.00");
$refundTransactionRequest->Amount = $amount;
$refundTransactionReq->RefundTransactionRequest = $refundTransactionRequest;
// ## 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->RefundTransaction($refundTransactionReq);
} catch (Exception $ex) {
$logger->error("Error Message : " + $ex->getMessage());
}
// ## Accessing response parameters
// You can access the response parameters using getter methods in
// response object as shown below
// ### Success values
if ($response->Ack == "Success") {
// Unique transaction ID of the refund.
$logger->log("Refund Transaction ID" . $response->RefundTransactionID);
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例2: capture
public function capture()
{
$logger = new PPLoggingManager('DoCapture');
// `Amount` to capture which takes mandatory params:
//
// * `currencyCode`
// * `amount`
$amount = new BasicAmountType("USD", "1.00");
// `DoCaptureRequest` which takes mandatory params:
//
// * `Authorization ID` - Authorization identification number of the
// payment you want to capture. This is the transaction ID returned from
// DoExpressCheckoutPayment, DoDirectPayment, or CheckOut. For
// point-of-sale transactions, this is the transaction ID returned by
// the CheckOut call when the payment action is Authorization.
// * `amount` - Amount to capture
// * `CompleteCode` - Indicates whether or not this is your last capture.
// It is one of the following values:
// * Complete – This is the last capture you intend to make.
// * NotComplete – You intend to make additional captures.
// `Note:
// If Complete, any remaining amount of the original authorized
// transaction is automatically voided and all remaining open
// authorizations are voided.`
$doCaptureReqest = new DoCaptureRequestType("O-4VR15106P7416533H", $amount, "NotComplete");
// ## DoCaptureReq
$doCaptureReq = new DoCaptureReq();
$doCaptureReq->DoCaptureRequest = $doCaptureReqest;
// ## 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->DoCapture($doCaptureReq);
} 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") {
// ## Accessing response parameters
// You can access the response parameters using getter methods in
// response object as shown below
// ### Success values
$logger->log("Authorization ID:" . $response->DoCaptureResponseDetails->AuthorizationID);
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例3: doReauth
public function doReauth()
{
$logger = new PPLoggingManager('DoReauthorization');
// ## DoAuthorizationReq
$doReauthorizationReq = new DoReauthorizationReq();
// `Amount` to reauthorize which takes mandatory params:
//
// * `currencyCode`
// * `amount`
$amount = new BasicAmountType("USD", "3.00");
// `DoReauthorizationRequest` which takes mandatory params:
//
// * `Authorization Id` - Value of a previously authorized transaction
// identification number returned by PayPal.
// * `amount`
$doReauthorizationRequest = new DoReauthorizationRequestType("9B2288061E685550E", $amount);
$doReauthorizationReq->DoReauthorizationRequest = $doReauthorizationRequest;
// ## 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->doReauthorization($doReauthorizationReq);
} 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") {
// Authorization identification number
$logger->log("Authorization ID:" . $response->AuthorizationID);
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例4: 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;
}
示例5: searchTxn
public function searchTxn()
{
$logger = new PPLoggingManager('TransactionSearch');
// ## TransactionSearchReq
$transactionSearchReq = new TransactionSearchReq();
// `TransactionSearchRequestType` which takes mandatory argument:
//
// * `Start Date` - The earliest transaction date at which to start the
// search.
$transactionSearchRequest = new TransactionSearchRequestType("2013-01-11T00:00:00+0530");
$transactionSearchReq->TransactionSearchRequest = $transactionSearchRequest;
// ## 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->TransactionSearch($transactionSearchReq);
} catch (Exception $ex) {
$logger->error("Error Message : " + $ex->getMessage());
}
// ## Accessing response parameters
// You can access the response parameters using getter methods in
// response object as shown below
// ### Success values
if ($response->Ack == "Success") {
// Search Results
$txnSearchArray = $response->PaymentTransactions;
foreach ($txnSearchArray as $txn) {
// Merchant's transaction ID.
$logger->log("Transaction ID : " . $txn->TransactionID);
}
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例6: getBal
public function getBal()
{
$logger = new PPLoggingManager('GetBalance');
// ## GetBalanceReq
$getBalanceReq = new GetBalanceReq();
$getBalanceRequest = new GetBalanceRequestType();
// Indicates whether to return all currencies. It is one of the
// following values:
//
// * 0 – Return only the balance for the primary currency holding.
// * 1 – Return the balance for each currency holding.
$getBalanceRequest->ReturnAllCurrencies = "1";
$getBalanceReq->GetBalanceRequest = $getBalanceRequest;
// ## 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->GetBalance($getBalanceReq);
} 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") {
$balanceHoldingArray = $response->BalanceHoldings;
foreach ($balanceHoldingArray as $amount) {
$logger->log("Balance Holdings : " + $amount->value . $amount->currencyID);
}
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例7: void
public function void()
{
$logger = new PPLoggingManager('DoVoid');
// ## DoVoidReq
$doVoidReq = new DoVoidReq();
// DoVoidRequest which takes mandatory params:
//
// * `Authorization ID` - Original authorization ID specifying the
// authorization to void or, to void an order, the order ID.
// `Important:
// If you are voiding a transaction that has been reauthorized, use the
// ID from the original authorization, and not the reauthorization.`
$doVoidRequest = new DoVoidRequestType("9B2288061E685550E");
$doVoidReq->DoVoidRequest = $doVoidRequest;
// ## 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->DoVoid($doVoidReq);
} catch (Exception $ex) {
$logger->error("Error Message : " + $ex->getMessage());
}
// ## Accessing response parameters
// You can access the response parameters using getter methods in
// response object as shown below
// ### Success values
if ($response->Ack == "Success") {
// Authorization identification number you specified in the
// request.
$logger->log("Authorization ID:" . $response->AuthorizationID);
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例8: getTxnDetails
public function getTxnDetails()
{
$logger = new PPLoggingManager('GetTransactionDetails');
// ## GetTransactionDetailsReq
$getTransactionDetailsReq = new GetTransactionDetailsReq();
$getTransactionDetailsRequest = new GetTransactionDetailsRequestType();
// Unique identifier of a transaction.
// `Note:
// The details for some kinds of transactions cannot be retrieved with
// GetTransactionDetails. You cannot obtain details of bank transfer
// withdrawals, for example.`
$getTransactionDetailsRequest->TransactionID = "5AT5731435011481X";
$getTransactionDetailsReq->GetTransactionDetailsRequest = $getTransactionDetailsRequest;
// ## 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->GetTransactionDetails($getTransactionDetailsReq);
} 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") {
// Unique PayPal Customer Account identification number.
$logger->log("Payer ID:" . $response->PaymentTransactionDetails->PayerInfo->PayerID);
} else {
$logger->error("API Error Message : " . $response->Errors[0]->LongMessage);
}
return $response;
}
示例9: set_include_path
<?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';
}
示例10: set_include_path
<?php
$path = '../../lib';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php';
require_once 'PPLoggingManager.php';
$logger = new PPLoggingManager('GetRecurringPaymentsProfileDetails');
$getRPPDetailsReqest = new GetRecurringPaymentsProfileDetailsRequestType();
$getRPPDetailsReqest->ProfileID = $_REQUEST['profileID'];
$getRPPDetailsReq = new GetRecurringPaymentsProfileDetailsReq();
$getRPPDetailsReq->GetRecurringPaymentsProfileDetailsRequest = $getRPPDetailsReqest;
$paypalService = new PayPalAPIInterfaceServiceService();
try {
/* wrap API method calls on the service object with a try catch */
$getRPPDetailsResponse = $paypalService->GetRecurringPaymentsProfileDetails($getRPPDetailsReq);
} catch (Exception $ex) {
include_once "../Error.php";
exit;
}
if (isset($getRPPDetailsResponse)) {
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$getRPPDetailsResponse->Ack}</div> </td></tr>";
echo "<tr><td>ProfileID :</td><td><div id='ProfileID'>" . $getRPPDetailsResponse->GetRecurringPaymentsProfileDetailsResponseDetails->ProfileID . "</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($getRPPDetailsResponse);
echo "</pre>";
}
require_once '../Response.php';
示例11: BusinessOwnerInfoType
$ownerInfo = new BusinessOwnerInfoType();
$ownerInfo->SSN = $_REQUEST['SSN'];
$ownerInfo->MobilePhone = $_REQUEST['ownerPhone'];
$enterBoardingRequestDetails = new EnterBoardingRequestDetailsType();
$enterBoardingRequestDetails->ProductList = $_REQUEST['prodList'];
$enterBoardingRequestDetails->BankAccount = $bankAccount;
$enterBoardingRequestDetails->BusinessInfo = $businessInfo;
$enterBoardingRequestDetails->MarketingCategory = $_REQUEST['marketingCategory'];
$enterBoardingRequestDetails->OwnerInfo = $ownerInfo;
$enterBoardingRequestDetails->ProgramCode = $_REQUEST['programCode'];
$enterBoardingRequest = new EnterBoardingRequestType();
$enterBoardingRequest->EnterBoardingRequestDetails = $enterBoardingRequestDetails;
$enterBoardingReq = new EnterBoardingReq();
$enterBoardingReq->EnterBoardingRequest = $enterBoardingRequest;
/*
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig());
try {
/* wrap API method calls on the service object with a try catch */
$enterBoardingResponse = $paypalService->EnterBoarding($enterBoardingReq);
} catch (Exception $ex) {
include_once "../Error.php";
exit;
}
if (isset($enterBoardingResponse)) {
echo "<pre>";
print_r($enterBoardingResponse);
echo "</pre>";
}
require_once '../Response.php';
示例12: PPLoggingManager
\<?php
require_once '../PPBootStrap.php';
$logger = new PPLoggingManager('BMGetButtonDetails');
$bmGetButtonDetailsReqest = new BMGetButtonDetailsRequestType($_REQUEST['hostedID']);
$bmGetButtonDetailsReq = new BMGetButtonDetailsReq();
$bmGetButtonDetailsReq->BMGetButtonDetailsRequest = $bmGetButtonDetailsReqest;
$paypalService = new PayPalAPIInterfaceServiceService();
try {
$bmGetButtonDetailsResponse = $paypalService->BMGetButtonDetails($bmGetButtonDetailsReq);
} catch (Exception $ex) {
require '../Error.php';
exit;
}
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$bmGetButtonDetailsResponse->Ack}</div> </td></tr>";
echo "<tr><td>HostedButtonID :</td><td><div id='HostedButtonID'>" . $bmGetButtonDetailsResponse->HostedButtonID . "</div> </td></tr>";
echo "<tr><td>Email :</td><td><div id='Email'>" . $bmGetButtonDetailsResponse->Email . "</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($bmGetButtonDetailsResponse);
echo "</pre>";
require_once '../Response.php';
示例13: MassPayReq
$massPayRequest->MassPayItem[] = $masspayItem;
}
/*
* ## MassPayReq
Details of each payment.
`Note:
A single MassPayRequest can include up to 250 MassPayItems.`
*/
$massPayReq = new MassPayReq();
$massPayReq->MassPayRequest = $massPayRequest;
/*
* ## 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(Configuration::getAcctAndConfig());
// required in third party permissioning
if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
$cred = new PPSignatureCredential(USERNAME, PASSWORD, SIGNATURE);
$cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
}
try {
/* wrap API method calls on the service object with a try catch */
if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
$massPayResponse = $paypalService->MassPay($massPayReq, $cred);
} else {
$massPayResponse = $paypalService->MassPay($massPayReq);
}
} catch (Exception $ex) {
include_once "../Error.php";
exit;
示例14: set_include_path
$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('DoExpressCheckout');
$token = urlencode($_REQUEST['token']);
$payerId = urlencode($_REQUEST['payerID']);
$paymentAction = urlencode($_REQUEST['paymentAction']);
// ------------------------------------------------------------------
// this section is optional if parameters required for DoExpressCheckout is retrieved from your database
$getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
$getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
$getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
try {
/* wrap API method calls on the service object with a try catch */
$getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
} catch (Exception $ex) {
include_once "../Error.php";
exit;
}
//----------------------------------------------------------------------------
$orderTotal = new BasicAmountType();
$orderTotal->currencyID = $_REQUEST['currencyCode'];
$orderTotal->value = $_REQUEST['amt'];
$paymentDetails = new PaymentDetailsType();
$paymentDetails->OrderTotal = $orderTotal;
if (isset($_REQUEST['notifyURL'])) {
$paymentDetails->NotifyURL = $_REQUEST['notifyURL'];
示例15: set_include_path
<?php
$path = '../../lib';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php';
require_once 'PPLoggingManager.php';
$logger = new PPLoggingManager('TransactionSearch');
$transactionSearchRequest = new TransactionSearchRequestType();
$transactionSearchRequest->StartDate = $_REQUEST['startDate'];
$transactionSearchRequest->EndDate = $_REQUEST['endDate'];
$transactionSearchRequest->TransactionID = $_REQUEST['transactionID'];
$tranSearchReq = new TransactionSearchReq();
$tranSearchReq->TransactionSearchRequest = $transactionSearchRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
try {
/* wrap API method calls on the service object with a try catch */
$transactionSearchResponse = $paypalService->TransactionSearch($tranSearchReq);
} catch (Exception $ex) {
include_once "../Error.php";
exit;
}
if (isset($transactionSearchResponse)) {
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$transactionSearchResponse->Ack}</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($transactionSearchResponse);
echo "</pre>";
}
require_once '../Response.php';