} if ($_POST['note'] != "") { $payment->note = $_POST['note']; } if ($_POST['paymentDate'] != "") { $payment->date = $_POST['paymentDate']; } $markInvoiceAsPaidRequest = new MarkInvoiceAsPaidRequest($requestEnvelope, $_POST['invoiceID'], $payment); $logger->info("created MarkInvoiceAsPaid Object"); $invoiceService = new InvoiceService(); // required in third party permissioning if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) { $invoiceService->setAccessToken($_POST['accessToken']); $invoiceService->setTokenSecret($_POST['tokenSecret']); } $markInvoiceAsPaidResponse = $invoiceService->MarkInvoiceAsPaid($markInvoiceAsPaidRequest, 'jb-us-seller_api1.paypal.com'); $logger->info("Received MarkInvoiceAsPaidResponse:"); var_dump($markInvoiceAsPaidResponse); } else { ?> <form method="POST"> <div id="apidetails">The MarkInvoiceAsPaid API operation is used to mark an invoice as paid.</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> <div class="section_header">Other Payment Details *</div> <div class="params"> <div class="param_name">Payment Method used for offline payment</div>
} $markInvoiceAsPaidRequest = new MarkInvoiceAsPaidRequest($requestEnvelope, $_POST['invoiceID'], $payment); /* * ## Creating service wrapper object Creating service wrapper object to make API call and loading 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 { if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) { $markInvoiceAsPaidResponse = $invoiceService->MarkInvoiceAsPaid($markInvoiceAsPaidRequest, $cred); } else { $markInvoiceAsPaidResponse = $invoiceService->MarkInvoiceAsPaid($markInvoiceAsPaidRequest); } } catch (Exception $ex) { require_once 'error.php'; exit; } echo "<table>"; echo "<tr><td>Ack :</td><td><div id='Ack'>" . $markInvoiceAsPaidResponse->responseEnvelope->ack . "</div> </td></tr>"; echo "<tr><td>InvoiceID :</td><td><div id='InvoiceID'>" . $markInvoiceAsPaidResponse->invoiceID . "</div> </td></tr>"; echo "</table>"; require 'ShowAllResponse.php'; echo "<pre>"; var_dump($markInvoiceAsPaidResponse); echo "</pre>";