public function getDetails()
 {
     $logger = new PPLoggingManager('GetInvoiceDetails');
     // ##GetInvoiceDetailsRequest
     // Use the GetInvoiceDetailsRequest message to get detailed information
     // about an invoice.
     // The code for the language in which errors are returned, which must be
     // en_US.
     $requestEnvelope = new RequestEnvelope();
     $requestEnvelope->ErrorLanguage = "en_US";
     // GetInvoiceDetailsRequest which takes mandatory params:
     //
     // * `Request Envelope` - Information common to each API operation, such
     // as the language in which an error message is returned.
     // * `Invoice ID` - ID of the invoice to retrieve.
     $getInvoiceDetailsRequest = new GetInvoiceDetailsRequest($requestEnvelope, "INV2-ZC9R-X6MS-RK8H-4VKJ");
     // ## Creating service wrapper object
     // Creating service wrapper object to make API call and loading
     // configuration file for your credentials and endpoint
     $service = new InvoiceService();
     try {
         // ## Making API call
         // Invoke the appropriate method corresponding to API in service
         // wrapper object
         $response = $service->GetInvoiceDetails($getInvoiceDetailsRequest);
     } 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->responseEnvelope->ack == "Success") {
         // Status of the invoice searched.
         $logger->log("Status : " . $response->invoiceDetails->status);
     } else {
         $logger->error("API Error Message : " . $response->error[0]->message);
     }
     return $response;
 }
Exemple #2
0
<body>
<h2>GetInvoiceDetails API Test Page</h2>
<?php 
$logger = new PPLoggingManager('GetInvoiceDetails');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // create request object
    $requestEnvelope = new RequestEnvelope("en_US");
    $getInvoiceDetailsRequest = new GetInvoiceDetailsRequest($requestEnvelope, $_POST['invoiceID']);
    $logger->info("created GetInvoiceDetails Object");
    $invoiceService = new InvoiceService();
    // required in third party permissioning
    if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
        $invoiceService->setAccessToken($_POST['accessToken']);
        $invoiceService->setTokenSecret($_POST['tokenSecret']);
    }
    $getInvoiceDetailsResponse = $invoiceService->GetInvoiceDetails($getInvoiceDetailsRequest, 'jb-us-seller_api1.paypal.com');
    $logger->info("Received getInvoiceDetailsResponse");
    var_dump($getInvoiceDetailsResponse);
} else {
    ?>
<form method="POST">
<div id="apidetails">The GetInvoiceDetails API operation is used to get detailed information about an invoice.</div>
<div class="params">
<div class="param_name">Invoice ID *</div>
<div class="param_value"><input type="text" name="invoiceID" value=""
	size="50" maxlength="260" /></div>
</div>
<br/>
<?php 
    include 'permissions.php';
    ?>
         configuration file for your credentials and endpoint
    */
    $invoiceService = new InvoiceService(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 {
        /*
        *  ## Making API call
        					 Invoke the appropriate method corresponding to API in service
        					 wrapper object
        */
        if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
            $getInvoiceDetailsResponse = $invoiceService->GetInvoiceDetails($getInvoiceDetailsRequest, $cred);
        } else {
            $getInvoiceDetailsResponse = $invoiceService->GetInvoiceDetails($getInvoiceDetailsRequest);
        }
    } catch (Exception $ex) {
        require_once 'error.php';
        exit;
    }
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>" . $getInvoiceDetailsResponse->responseEnvelope->ack . "</div> </td></tr>";
    echo "</table>";
    require 'ShowAllResponse.php';
    echo "<pre>";
    var_dump($getInvoiceDetailsResponse);
    echo "</pre>";
} else {