-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started to add examples to Checkout API and fix the documentation to …
…match the reality
- Loading branch information
1 parent
a3610b5
commit 86d1515
Showing
5 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# PHP | ||
|
||
Start typing here... | ||
Here you will find examples of how to interact with the Qvickly APIs using PHP. | ||
|
||
The examples are simple and could be used as a starting point for your own implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Get info on non-activated invoices | ||
|
||
In this example we will authenticate against the Auth API, fetch a list of invoices from the Portal API and then use the Payment API to get more information about the invoices. | ||
|
||
The invoices we are looking for are invoices that are created, but not yet activated. We will use the `status`, `search` and `invoiceType` filters to find the invoices we are looking for. The number of invoices we want to fetch is limited to 5. | ||
|
||
<code-block lang="php"> | ||
<![CDATA[ | ||
<?php | ||
declare(strict_types=1); | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
use Dotenv\Dotenv; | ||
use Qvickly\Api\Auth\AuthAPI; | ||
use Qvickly\Api\Portal\PortalAPI; | ||
use Qvickly\Api\Payment\PaymentAPI; | ||
$dotenv = Dotenv::createImmutable(__DIR__ . '/../..'); | ||
$dotenv->load(); | ||
|
||
$authAPI = new AuthAPI(); | ||
$auth = $authAPI->login($_ENV['USERNAME'], $_ENV['PASSWORD']); | ||
|
||
$portalAPI = new PortalAPI($auth); | ||
|
||
$paymentAPI = new PaymentAPI($_ENV['EID'], $_ENV['SECRET']); | ||
|
||
$invoices = $portalAPI->get('invoices?filter=status,search,invoiceType&status=created&search=tess&invoicetype=F&limit=5'); | ||
|
||
echo "Found " . count($invoices) . " invoices to activate.\n"; | ||
|
||
foreach($invoices as $invoice) { | ||
echo "Fetching invoice {$invoice['invoiceid_real']}...\n"; | ||
$payment = $paymentAPI->getPaymentInfo([ 'number' => $invoice['invoiceid_real']]); | ||
echo json_encode($payment, JSON_PRETTY_PRINT) . "\n\n"; | ||
} | ||
]]> | ||
</code-block> | ||
|
||
<include from="Snippets-PHP-Module.md" element-id="snippet-composer-require" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters