forked from LiveCarta/PayPal-PHP-SDK
More Invoice API Updates
This commit is contained in:
@@ -187,6 +187,94 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><a href="https://developer.paypal.com/webapps/developer/docs/api/#authorizations"
|
||||
target="_blank">Authorization and capture</a></h3>
|
||||
</div>
|
||||
<!-- List group -->
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Authorize Payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/AuthorizePayment.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/AuthorizePayment.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Get details of an authorized payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/GetAuthorization.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/GetAuthorization.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Capture an authorized payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/AuthorizationCapture.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/AuthorizationCapture.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Get details of a captured payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/GetCapture.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/GetCapture.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Void an authorized payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/VoidAuthorization.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/VoidAuthorization.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Reauthorize a payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/Reauthorization.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/Reauthorization.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Refund captured payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/RefundCapture.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/RefundCapture.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><a href="https://developer.paypal.com/webapps/developer/docs/api/#sale-transactions"
|
||||
@@ -394,93 +482,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><a href="https://developer.paypal.com/webapps/developer/docs/api/#authorizations"
|
||||
target="_blank">Authorization and capture</a></h3>
|
||||
</div>
|
||||
<!-- List group -->
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Authorize Payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/AuthorizePayment.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/AuthorizePayment.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Get details of an authorized payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/GetAuthorization.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/GetAuthorization.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Capture an authorized payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/AuthorizationCapture.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/AuthorizationCapture.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Get details of a captured payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/GetCapture.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/GetCapture.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Void an authorized payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/VoidAuthorization.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/VoidAuthorization.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Reauthorize a payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/Reauthorization.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/Reauthorization.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Refund captured payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="payments/RefundCapture.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/payments/RefundCapture.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><a href="https://developer.paypal.com/webapps/developer/docs/api/#payment-experience"
|
||||
@@ -566,7 +567,7 @@
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Create Invoice</h5></div>
|
||||
<div class="col-md-8"><h5>Create an Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/CreateInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
@@ -577,29 +578,7 @@
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Get Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/GetInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/GetInvoice.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>List All Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/ListInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/ListInvoice.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Send Invoice</h5></div>
|
||||
<div class="col-md-8"><h5>Send an Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/SendInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
@@ -610,7 +589,51 @@
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Remind Invoice</h5></div>
|
||||
<div class="col-md-8"><h5>Update an Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/UpdateInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/UpdateInvoice.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Retrieve an Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/GetInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/GetInvoice.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Get Invoices of a Merchant</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/ListInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/ListInvoice.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Search for Invoices</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/SearchInvoices.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/SearchInvoices.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Send an Invoice Reminder</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/RemindInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
@@ -621,7 +644,7 @@
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Cancel Invoice</h5></div>
|
||||
<div class="col-md-8"><h5>Cancel an Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/CancelInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
@@ -630,6 +653,50 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Delete an Invoice</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/DeleteInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/DeleteInvoice.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Retrieve a QR Code</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/RetrieveQRCode.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/RetrieveQRCode.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Record a Payment</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/RecordPayment.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/RecordPayment.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Record a Refund</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/RecordRefund.php" class="btn btn-primary pull-left execute"> Execute <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/RecordRefund.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ try {
|
||||
// static `get_all` method on the Invoice class.
|
||||
// Refer the method doc for valid values for keys
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
$invoices = Invoice::get_all($apiContext);
|
||||
$invoices = Invoice::getAll(array('page' => 0, 'page_size' => 4, 'total_count_required' => true), $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Lookup Invoice History", "Invoice", null, null, $ex);
|
||||
exit(1);
|
||||
|
||||
@@ -11,13 +11,6 @@ use PayPal\Api\Invoice;
|
||||
use PayPal\Api\Notification;
|
||||
|
||||
try {
|
||||
// ### Retrieve Invoice
|
||||
// Retrieve the invoice object by calling the
|
||||
// static `get` method
|
||||
// on the Invoice class by passing a valid
|
||||
// Invoice ID
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
$invoice = Invoice::get($invoice->getId(), $apiContext);
|
||||
|
||||
// ### Notification Object
|
||||
// This would send a notification to both merchant as well
|
||||
|
||||
41
sample/invoice/RetrieveQRCode.php
Normal file
41
sample/invoice/RetrieveQRCode.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
// # Retrieve QR Code for Invoice Sample
|
||||
// Specify an invoice ID to get a QR code (image) that corresponds to the invoice ID. A QR code for an invoice can be added to a paper or PDF invoice. When a customer uses their mobile device to scan the QR code, the customer is redirected to the PayPal mobile payment flow, where they can pay online with PayPal or a credit card.
|
||||
|
||||
/** @var Invoice $invoice */
|
||||
$invoice = require 'SendInvoice.php';
|
||||
|
||||
use PayPal\Api\Invoice;
|
||||
use PayPal\Api\Notification;
|
||||
|
||||
try {
|
||||
|
||||
// ### Retrieve QR Code of Sent Invoice
|
||||
// Retrieve QR Code of Sent Invoice by calling the
|
||||
// `qrCode` method
|
||||
// on the Invoice class by passing a valid
|
||||
// notification object
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
$image = Invoice::qrCode($invoice->getId(), array('height' => '300', 'width' => '300'), $apiContext);
|
||||
|
||||
// ### Optionally Save to File
|
||||
// This is not a required step. However, if you want to store this image as a file, you can use
|
||||
// 'saveToFile' method with proper file name.
|
||||
// This will save the image as /samples/invoice/images/sample.png
|
||||
$path = $image->saveToFile("images/sample.png");
|
||||
|
||||
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $image);
|
||||
|
||||
// ### Show the Image
|
||||
// In PHP, there are many ways to present an images.
|
||||
// One of the ways, you could directly inject the base64-encoded string
|
||||
// with proper image information in front of it.
|
||||
echo '<img src="data:image/png;base64,'. $image->getImageBase64() . '" alt="Invoice QR Code" />';
|
||||
|
||||
@@ -10,13 +10,6 @@ $invoice = require 'CreateInvoice.php';
|
||||
use PayPal\Api\Invoice;
|
||||
|
||||
try {
|
||||
// ### Retrieve Invoice
|
||||
// Retrieve the invoice object by calling the
|
||||
// static `get` method
|
||||
// on the Invoice class by passing a valid
|
||||
// Invoice ID
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
$invoice = Invoice::get($invoice->getId(), $apiContext);
|
||||
|
||||
// ### Send Invoice
|
||||
// Send a legitimate invoice to the payer
|
||||
|
||||
31
sample/invoice/UpdateInvoice.php
Normal file
31
sample/invoice/UpdateInvoice.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// # Update Invoice Sample
|
||||
// This sample code demonstrate how you can update
|
||||
// an invoice.
|
||||
|
||||
/** @var Invoice $invoice */
|
||||
$invoice = require 'CreateInvoice.php';
|
||||
use PayPal\Api\Invoice;
|
||||
|
||||
// ### Update Invoice
|
||||
// Lets update some information
|
||||
$invoice->setInvoiceDate("2014-11-16 PST");
|
||||
|
||||
|
||||
// For Sample Purposes Only.
|
||||
$request = clone $invoice;
|
||||
|
||||
try {
|
||||
// ### Update Invoice
|
||||
// Update an invoice by calling the invoice->update() method
|
||||
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||
$invoice->update($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Invoice Updated", "Invoice", null, $request, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Invoice Updated", "Invoice", $invoice->getId(), $request, $invoice);
|
||||
|
||||
return $invoice;
|
||||
Reference in New Issue
Block a user