if ($_POST['refundDate'] != "") {
     $refundDetails->date = $_POST['refundDate'];
 }
 $markInvoiceAsRefundedRequest = new MarkInvoiceAsRefundedRequest($requestEnvelope, $_POST['invoiceID'], $refundDetails);
 /*
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $markInvoiceAsRefundedResponse = $invoiceService->MarkInvoiceAsRefunded($markInvoiceAsRefundedRequest, $cred);
     } else {
         $markInvoiceAsRefundedResponse = $invoiceService->MarkInvoiceAsRefunded($markInvoiceAsRefundedRequest);
     }
 } catch (Exception $ex) {
     require_once 'error.php';
     exit;
 }
 echo "<table>";
 echo "<tr><td>Ack :</td><td><div id='Ack'>" . $markInvoiceAsRefundedResponse->responseEnvelope->ack . "</div> </td></tr>";
 echo "<tr><td>InvoiceID :</td><td><div id='InvoiceID'>" . $markInvoiceAsRefundedResponse->invoiceID . "</div> </td></tr>";
 echo "</table>";
 require 'ShowAllResponse.php';
 echo "<pre>";
 var_dump($markInvoiceAsRefundedResponse);
 echo "</pre>";