Skip to content

Commit 73035e3

Browse files
committed
Add payments api read example
1 parent 1cd38fc commit 73035e3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

payments/read.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# ITFlow API - PowerShell examples
2+
# https://itflow.org
3+
4+
# Read payments (requires "All Clients" API key)
5+
6+
# API Key
7+
$apiKey = "a1wEoh1F3omPhea6"
8+
9+
# Base site URL
10+
$siteUrl = "https://demo.itflow.org"
11+
12+
# Module / Endpoint
13+
$module = "/api/v1/payments/read.php"
14+
15+
# Build URI from defined data
16+
# Will return all payments by default
17+
$uri = $siteUrl + $module + "?api_key=" + $apiKey
18+
19+
20+
# Other URL examples (uncomment to use)
21+
22+
# Specific payment ID
23+
# $payment_id = 1
24+
# $uri = $siteUrl + $module + "?api_key=" + $apiKey + "&payment_id=" + $payment_id
25+
26+
27+
# Specific invoice ID
28+
# $payment_invoice_id = 46
29+
# $uri = $siteUrl + $module + "?api_key=" + $apiKey + "&payment_invoice_id=" + $payment_invoice_id
30+
31+
# Request
32+
# Use Invoke-WebMethod instead to see more info about the request/response
33+
$payments = (Invoke-RestMethod -Method GET -Uri $uri).data
34+
35+
36+
# Show payments
37+
For ($i=0; $i -le ($payments.Count - 1); $i++) {
38+
Write-Host "`n"
39+
Write-Host "Date:" $payments[$i].payment_date
40+
Write-Host "Method:" $payments[$i].payment_method
41+
Write-Host "Amount:" $payments[$i].payment_amount
42+
Write-Host "Invoice ID:" $payments[$i].payment_invoice_id
43+
Write-Host "Ref:" $payments[$i].payment_reference
44+
}

0 commit comments

Comments
 (0)