-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentation.php
More file actions
307 lines (267 loc) · 10.8 KB
/
documentation.php
File metadata and controls
307 lines (267 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Transaction Reporting API Documentation</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://globalpayments-samples.github.io/css/styles.css">
<style>
.doc-content {
margin-top: 2rem;
}
.doc-section {
margin-bottom: 2.5rem;
}
.doc-section h2 {
color: #0074C7;
font-size: 1.75rem;
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid #E0E0E0;
font-weight: 600;
}
.doc-section h3 {
color: #003B5C;
font-size: 1.375rem;
margin-top: 1.5rem;
margin-bottom: 0.75rem;
font-weight: 600;
}
.doc-section h4 {
font-size: 1.125rem;
margin-top: 1rem;
margin-bottom: 0.5rem;
font-weight: 600;
}
.doc-section p {
margin-bottom: 1rem;
line-height: 1.6;
}
code {
background: #F5F5F5;
padding: 0.2rem 0.5rem;
border-radius: 4px;
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-size: 0.9em;
color: #d63384;
}
pre {
background: #2d2d2d;
color: #f8f8f2;
padding: 1.5rem;
border-radius: 8px;
overflow-x: auto;
margin: 1rem 0;
line-height: 1.5;
}
pre code {
background: transparent;
color: inherit;
padding: 0;
font-size: 0.9rem;
}
.doc-section ul {
margin-left: 1.5rem;
margin-bottom: 1rem;
}
.doc-section li {
margin-bottom: 0.5rem;
line-height: 1.6;
}
.endpoint-box {
background: #F5F5F5;
border-left: 4px solid #0074C7;
padding: 1.25rem;
margin: 1rem 0;
border-radius: 8px;
}
.endpoint-box pre {
margin: 0;
}
.endpoint-box p {
margin-bottom: 0.5rem;
}
.note-box {
background: #d1ecf1;
border-left: 4px solid #17a2b8;
padding: 1.25rem;
margin: 1rem 0;
border-radius: 8px;
}
.note-box ul {
margin: 0.5rem 0 0 1.5rem;
}
@media (max-width: 768px) {
.doc-section h2 {
font-size: 1.5rem;
}
.doc-section h3 {
font-size: 1.25rem;
}
pre {
font-size: 0.8rem;
padding: 1rem;
}
}
</style>
</head>
<body>
<!-- Header -->
<header class="gp-header">
<div class="gp-container">
<div class="gp-header-content">
<div class="gp-logo">
<picture>
<source media="(min-width: 768px)" srcset="https://globalpayments-samples.github.io/assets/img/GP_logo.svg">
<img src="https://globalpayments-samples.github.io/assets/img/GP_favicon.svg" alt="Global Payments" style="height: 32px; width: auto;">
</picture>
</div>
<nav class="gp-header-nav">
<a href="https://developer.globalpay.com/">Documentation</a>
<a href="https://developer.globalpay.com/api/references-overview">API Reference</a>
<a href="https://developer.globalpay.com/docs/integration-options/sdk/overview">SDKs</a>
</nav>
</div>
</div>
</header>
<div class="gp-container">
<!-- Page Title -->
<h1 class="gp-page-title">Transaction Reporting API</h1>
<p class="gp-page-subtitle">Query and export transaction data from Global Payments</p>
<div style="margin-top: 1.5rem; margin-bottom: 2rem;">
<a href="index.html" class="gp-button">← Back to Dashboard</a>
</div>
<div class="gp-card doc-content">
<div class="doc-section">
<h2>Setup</h2>
<p>Add the following to your <code>.env</code> file:</p>
<pre><code>GP_API_APP_ID=your_app_id_here
GP_API_APP_KEY=your_app_key_here</code></pre>
<p>Start server: <code>php -S localhost:8000</code></p>
</div>
<div class="doc-section">
<h2>Endpoints</h2>
<p>Base URL: <code>http://localhost:8000/reports.php?action=</code></p>
<h3>Search Transactions</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=search&start_date=2025-09-01&page_size=20"</code></pre>
</div>
<h4>Parameters:</h4>
<ul>
<li><code>page</code> - Page number (default: 1)</li>
<li><code>page_size</code> - Items per page (max: 100)</li>
<li><code>start_date</code> - YYYY-MM-DD</li>
<li><code>end_date</code> - YYYY-MM-DD</li>
<li><code>status</code> - CAPTURED, DECLINED, PENDING, REVERSED</li>
<li><code>transaction_id</code> - Specific transaction</li>
<li><code>amount_min</code> / <code>amount_max</code> - Amount range</li>
<li><code>card_last_four</code> - Last 4 card digits</li>
</ul>
<h3>Transaction Details</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=detail&transaction_id=TRN_xxx"</code></pre>
</div>
<h3>Export Data</h3>
<div class="endpoint-box">
<p><strong>CSV:</strong></p>
<pre><code>curl "http://localhost:8000/reports.php?action=export&format=csv&start_date=2025-09-01" -o file.csv</code></pre>
<p><strong>JSON:</strong></p>
<pre><code>curl "http://localhost:8000/reports.php?action=export&format=json&start_date=2025-09-01" -o file.json</code></pre>
</div>
<div class="note-box">
<strong>Note:</strong> Exports up to 1000 records. Use filters to narrow results.
</div>
<h3>Summary Stats</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=summary&start_date=2025-09-01&end_date=2025-09-30"</code></pre>
</div>
<p>Returns totals, averages, and breakdowns by status/payment type.</p>
<h3>Declined Transactions</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=declines&start_date=2025-09-01&page_size=20"</code></pre>
</div>
<p>Returns declined transactions with analysis (reasons, card types, trends).</p>
<h3>Settlement Report</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=settlement&start_date=2025-09-01"</code></pre>
</div>
<h3>Disputes</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=disputes&status=PENDING"</code></pre>
</div>
<h3>Deposits</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=deposits&start_date=2025-09-01"</code></pre>
</div>
<h3>Batches</h3>
<div class="endpoint-box">
<pre><code>curl "http://localhost:8000/reports.php?action=batches&start_date=2025-09-01"</code></pre>
</div>
</div>
<div class="doc-section">
<h2>Response Format</h2>
<p>All responses follow this structure:</p>
<p><strong>Success Response:</strong></p>
<pre><code>{
"success": true,
"data": { ... },
"timestamp": "2025-10-06 12:00:00"
}</code></pre>
<p><strong>Error Response:</strong></p>
<pre><code>{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid date format",
"timestamp": "2025-10-06 12:00:00"
}
}</code></pre>
</div>
<div class="doc-section">
<h2>Common Filters</h2>
<p>All search endpoints support:</p>
<ul>
<li>Date ranges: <code>start_date</code> and <code>end_date</code></li>
<li>Pagination: <code>page</code> and <code>page_size</code></li>
<li>Status filtering where applicable</li>
</ul>
</div>
<div class="doc-section">
<h2>Important Notes</h2>
<div class="note-box">
<ul>
<li>Dates must be YYYY-MM-DD format</li>
<li>Page size max is 100 (search/disputes/deposits)</li>
<li>Export limit is 1000 records</li>
<li>All timestamps are UTC</li>
<li>Transaction IDs start with <code>TRN_</code></li>
</ul>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="gp-footer">
<div class="gp-container">
<div class="gp-footer-content">
<div class="gp-footer-section">
<p class="gp-footer-copyright">
© 2024 Your Company Name. All rights reserved.
</p>
</div>
<div class="gp-footer-section">
<nav class="gp-footer-nav">
<a href="/terms-of-service" class="gp-footer-link">Terms of Service</a>
<a href="/privacy-policy" class="gp-footer-link">Privacy Policy</a>
<a href="/refund-policy" class="gp-footer-link">Refund Policy</a>
</nav>
</div>
</div>
</div>
</footer>
<script src="https://globalpayments-samples.github.io/js/script.js"></script>
</body>
</html>