PayPal\Service\PayPalAPIInterfaceServiceService::TransactionSearch PHP Method

TransactionSearch() public method

Service Call: TransactionSearch
public TransactionSearch ( TransactionSearchReq $transactionSearchReq, mixed $apiCredential = null ) : TransactionSearchResponseType
$transactionSearchReq PayPal\PayPalAPI\TransactionSearchReq
$apiCredential mixed - Optional API credential - can either be a username configured in sdk_config.ini or a ICredential object created dynamically
return PayPal\PayPalAPI\TransactionSearchResponseType
    public function TransactionSearch($transactionSearchReq, $apiCredential = null)
    {
        $apiContext = new PPApiContext($this->config);
        $handlers = array(new PPMerchantServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
        $this->setStandardParams($transactionSearchReq->TransactionSearchRequest);
        $ret = new TransactionSearchResponseType();
        $resp = $this->call('PayPalAPI', 'TransactionSearch', $transactionSearchReq, $apiContext, $handlers);
        $ret->init(PPUtils::xmlToArray($resp));
        return $ret;
    }

Usage Example

Example #1
0
* `Start Date` - The earliest transaction date at which to start the
search.
*/
$transactionSearchRequest = new TransactionSearchRequestType();
$transactionSearchRequest->StartDate = $_REQUEST['startDate'];
$transactionSearchRequest->EndDate = $_REQUEST['endDate'];
$transactionSearchRequest->TransactionID = $_REQUEST['transactionID'];
$tranSearchReq = new TransactionSearchReq();
$tranSearchReq->TransactionSearchRequest = $transactionSearchRequest;
/*
 * 		 ## 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());
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';