سؤال

I'm asking if it's possible to retrieve users PayPal history by using some PHP SDK. I found in Google and didn't find any helpful information about this, can any give me some starting point? I don't know if using REST API I can get this done or I need another SDK like SDK Core and examples are not clear for me

هل كانت مفيدة؟

المحلول

You can search transactions using the TransactionSearch API which is part of the Merchant SDK. There's an example on how to do it:

$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>";
}

Take a look at the API reference for limitations and other variables.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top