-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathNetellerAPI.html
More file actions
871 lines (788 loc) · 39.5 KB
/
NetellerAPI.html
File metadata and controls
871 lines (788 loc) · 39.5 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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
<!DOCTYPE html>
<html>
<head>
<title>NetellerAPI</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */
/* Author: Nicolas Hery - http://nicolashery.com */
/* Version: b13fe65ca28d2e568c6ed5d7f06581183df8f2ff */
/* Source: https://github.com/nicolahery/markdownpad-github */
/* RESET
=============================================================================*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
/* BODY
=============================================================================*/
body {
font-family: Helvetica, arial, freesans, clean, sans-serif;
font-size: 14px;
line-height: 1.6;
color: #333;
background-color: #fff;
padding: 20px;
max-width: 960px;
margin: 0 auto;
}
body>*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 28px;
color: #000;
}
h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777;
font-size: 14px;
}
body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* TABLES
=============================================================================*/
table th {
font-weight: bold;
}
table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}
table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
max-width: 100%
}
</style>
</head>
<body>
<h1>NETELLER REST API PHP Library</h1>
<h2>Introduction</h2>
<p>The NETELLER PHP Library provides PHP developers an easy way to integrate the NETELLER REST API. It is a client library which provides PHP classes that correspond to resources in the NETELLER REST API. </p>
<ul>
<li><a href="#Installation">Installation</a></li>
<li><a href="#Configuration">Configuration</a></li>
<li><a href="#NetellerAPI">NetellerAPI Class</a></li>
<li><a href="#requestPayment">RequestPayment Class</a></li>
<li><a href="#CreatePayment">CreatePayment Class</a></li>
<li><a href="#LookupPayment">LookupPayment Class</a></li>
<li><a href="#CreateOrder">CreateOrder Class</a></li>
<li><a href="#LookupOrder">LookupOrder Class</a></li>
<li><a href="#LookupOrderInvoice">LookupOrderInvoice Class</a></li>
<li><a href="#CreateCustomer">CreateCustomer Class</a></li>
<li><a href="#LookupCustomer">LookupCustomer Class</a></li>
<li><a href="#CreatePlan">CreatePlan Class</a></li>
<li><a href="#LookupPlan">LookupPlan Class</a></li>
<li><a href="#CancelPlan">CancelPlan Class</a></li>
<li><a href="#DeletePlan">DeletePlan Class</a></li>
<li><a href="#ListPlans">ListPlans Class</a></li>
<li><a href="#CreateSubscription">CreateSubscription Class</a></li>
<li><a href="#LookupSubscription">LookupSubscription Class</a></li>
<li><a href="#CancelSubscription">CancelSubscription Class</a></li>
<li><a href="#ListSubscriptions">ListSubscriptions Class</a></li>
<li><a href="#LookupSubscriptionInvoice">LookupSubscriptionInvoice Class</a></li>
<li><a href="#LookupAllSubscriptionInvoices">LookupAllSubscriptionInvoices Class</a></li>
<li><a href="#WebhookHandler">WebhookHandler Class</a></li>
</ul>
<h1>Installation <a name="Installation"></a></h1>
<p>Simply download and include the "NetellerAPI.php" file in your script.</p>
<pre><code>include_once("NetellerAPI.php");
</code></pre>
<h1>Configuration <a name="Configuration"></a></h1>
<p>You need to define the configuration details using the following PHP constants:</p>
<ul>
<li><strong>NETELLER_BASE_URL</strong> - should contain the relevant REST API endpoint depending on whether you are using the sandbox or live environment.</li>
<li><strong>NETELLER_CLIENT_ID</strong> - should contain the Client ID from the merchant account App.</li>
<li><strong>NETELLER_CLIENT_SECRET</strong> - should contain the Client Secret from the merchant account App.</li>
</ul>
<p>Example:</p>
<pre><code>define('NETELLER_BASE_URL', 'https://test.api.neteller.com/');
define('NETELLER_CLIENT_ID', 'AAABTAiQ9pKruN2Z');
define('NETELLER_CLIENT_SECRET', '0.iSLQ7zzMinac6SbI62onxTdqEYFES1LXoI4paRFFz74.4yFz4Pr3BMIccXgQOb3Ea_FNG2Y');
</code></pre>
<h1>NetellerAPI Class <a name="NetellerAPI"></a></h1>
<p>A parent class which all classes below extend.</p>
<h2>Methods</h2>
<ul>
<li><strong>getIP()</strong> - Returns the outgoing IP address of the server where the script is hosted using an external service. Useful for debugging the "invalid_client" API error.</li>
<li><strong>getUrl(string $url)</strong> - Executes a GET request to a URL from the NETELLER API and returns the result. Useful when implementing webhooks.</li>
<li><strong>getToken_ClientCredentials()</strong> - Returns a new access token - "client_credentials" grant type.</li>
<li><strong>getToken_AuthCode(string $authCode, string $redirectUri)</strong> - Returns a new access token - "auth_code" grant type.</li>
<li><strong>getToken_RefreshToken(string $refreshToken)</strong> - Returns a new access token using a refresh token.</li>
</ul>
<h2>Example</h2>
<pre><code>$api = new NetellerAPI();
$ip = $api->getIP();
var_dump($ip);
</code></pre>
<p>It can also be used in the context of a child class:</p>
<pre><code>$deposit = new RequestPayment();
$deposit->setPaymentMethodValue('netellertest_USD@neteller.com')
->setVerificationCode(270955)
->setTransactionMerchantRefId('adfiu1i23478172349a')
->setTransactionAmount(1234)
->setTransactionCurrency('USD');
$result = $deposit->doRequest();
$ip = $deposit->getIP();
var_dump($result);
var_dump($ip);
</code></pre>
<h1>RequestPayment Class <a name="requestPayment"></a></h1>
<p>Creates a new incoming transfer payment. </p>
<h2>Methods</h2>
<ul>
<li><strong>setPaymentMethodValue(string $paymentMethod)</strong> - Sets the member's email or 12 digit NETELLER Account ID.</li>
<li><strong>setVerificationCode(string $verificationCode)</strong> - Sets the member's Secure ID or Google Authenticator OTP. </li>
<li><strong>setTransactionMerchantRefId(string $merchantRefId)</strong> - Sets the merchant reference ID.</li>
<li><strong>setTransactionAmount(int $transactionAmount)</strong> - Sets the amount for the transaction.</li>
<li><strong>setTransactionCurrency(string $transactionCurrency)</strong> - Sets the currency for the transaction.</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$deposit = new RequestPayment();
$deposit->setPaymentMethodValue('netellertest_USD@neteller.com')
->setVerificationCode(270955)
->setTransactionMerchantRefId('adfiu1i23478172349a')
->setTransactionAmount(1234)
->setTransactionCurrency('USD');
$result = $deposit->doRequest();
var_dump($result);
</code></pre>
<h1>CreatePayment Class <a name="CreatePayment"></a></h1>
<p>Creates a new outgoing payment. </p>
<h2>Methods</h2>
<ul>
<li><strong>setPayeeProfileEmail(string $payeeProfileEmail)</strong> - Sets the email of the member receiving the payment.</li>
<li><strong>setTransactionAmount(int $transactionAmount)</strong> - Sets the amount for the transaction.</li>
<li><strong>setTransactionCurrency(string $transactionCurrency)</strong> - Sets the currency for the transaction.</li>
<li><strong>setTransactionMerchantRefId(string $transactionMerchantRefId)</strong> - Sets the merchant reference ID.</li>
<li><strong>setMessage(string $message)</strong> - Sets the message that will be shown to the member notifying them of the pending transfer.</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$withdrawal = new CreatePayment();
$withdrawal->setPayeeProfileEmail('netellertest_USD@neteller.com')
->setTransactionAmount(1234)
->setTransactionCurrency('USD')
->setTransactionMerchantRefId('adfiu1i23478172349W2')
->setMessage('sample message');
$result = $withdrawal->doRequest();
var_dump($result);
</code></pre>
<h1>LookupPayment Class <a name="LookupPayment"></a></h1>
<p>Returns details about a previous payment request.</p>
<h2>Methods</h2>
<ul>
<li><strong>setTransactionId(string $transactionId)</strong> - Sets the NETELLER transaction ID of the transaction you want to look up. You can either use this method or use "setMerchantRefId".</li>
<li><strong>setMerchantRefId(string $merchantRefId)</strong> - Sets the merchant reference ID of the transaction you want to look up. You can either use this method or use "setTransactionId".</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupPayment();
$lookup->setTransactionId('850430740226289')
->setExpand('customer');
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>CreateOrder Class <a name="CreateOrder"></a></h1>
<p>Creates a payment order for NETELLERgo! You will need to redirect your customer to the returned URL to initiate the hosted Quick Checkout flow and collect the payment.</p>
<h2>Methods</h2>
<ul>
<li><strong>setOrderMerchantRefId(string $orderMerchantRefId)</strong> - Sets the merchant reference ID.</li>
<li><strong>setOrderTotalAmount(int $orderTotalAmount)</strong> - Sets the total amount for the order.</li>
<li><strong>setOrderCurrency(string $orderCurrency)</strong> - Sets the currency for the order.</li>
<li><strong>setOrderLang(string $orderLang)</strong> - Sets the language of the hosted payment page.</li>
<li><strong>setOrderCustomerIp(string $orderCustomerIp)</strong> - Sets the IP address of the customer.</li>
<li><strong>setItems(array $item)</strong> - Sets the item you are requesting payment for. </li>
<li><strong>setFees(array $fee)</strong> - Sets the fee for this order.</li>
<li><strong>setTaxes(array $tax)</strong> - Sets the tax for this order.</li>
<li><strong>setPaymentMethods(array $paymentMethod)</strong> - sets the allowed payment methods for this order.</li>
<li><strong>setRedirectOnSuccess(string $url)</strong> - Sets the success redirect URL.</li>
<li><strong>setRedirectOnCancel(string $url)</strong> - Sets the cancel redirect URL.</li>
<li><strong>setBillingDetailsEmail(string $billingDetailsEmail)</strong> - Sets the email address of the customer.</li>
<li><strong>setBillingDetailsCountry(string $billingDetailsCountry)</strong> - Sets the country of residence of the customer (ISO 3166-1 Alpha 2-code)</li>
<li><strong>setBillingDetailsFirstName(string $billingDetailsFirstName)</strong> - Sets the First Name of the customer.</li>
<li><strong>setBillingDetailsLastName(string $billingDetailsLastName)</strong> - Sets the Last Name of the customer.</li>
<li><strong>setBillingDetailsCity(string $billingDetailsCity)</strong> - Sets the city of residence of the customer.</li>
<li><strong>setBillingDetailsAddress1(string $billingDetailsAddress1)</strong> - Sets the address (line 1) of the customer.</li>
<li><strong>setBillingDetailsAddress2(string $billingDetailsAddress2)</strong> - Sets the address (line 2) of the customer.</li>
<li><strong>setBillingDetailsAddress3(string $billingDetailsAddress3)</strong> - Sets the address (line 3) of the customer.</li>
<li><strong>setBillingDetailsCountrySubDivisionCode(string $countrySubDivisionCode)</strong> - Sets the country subdivision code of the customer. The ISO 3166-2 code indicating the state/province/district or other value denoting the clients country subdivision</li>
<li><strong>setBillingDetailsPostCode(string $billingDetailsPostCode)</strong> - Sets the post code of the customer.</li>
<li><strong>setBillingDetailsLang(string $billingDetailsLang)</strong> - Sets the preferred language of communication of the customer. </li>
<li><strong>setAttributes(array $attribute)</strong> - Sets additional attributes for this order.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getRedirectUrl()</strong> - Returns the URL where the client needs to be redirected to complete the payment.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$order = new CreateOrder();
$order->setOrderMerchantRefId('adfiu1i23478172349o1')
->setOrderTotalAmount(2099)
->setOrderCurrency('USD')
->setOrderLang('en_US')
->setItems(array
(
"quantity" => 1,
"name" => "Item A",
"description" => "Lorem ipsum dolor sit amet",
"sku" => "XYZPART1",
"amount" => 1000
)
)
->setItems(array
(
"quantity" => 2,
"name" => "Item B",
"description" => "Consectetur adipiscing elit",
"sku" => "XYZPART2",
"amount" => 200
)
)
->setFees(array
(
"feeName" => "Setup Fee",
"feeAmount" => 500
)
)
->setTaxes(array
(
"taxName" => "VAT",
"taxAmount" => 199
)
)
->setPaymentMethods(array
(
"type" => "onlinebanking",
"value" => "sofortbanking"
)
)
->setRedirectOnSuccess("https://example.com/success.html")
->setRedirectOnCancel("https://example.com/cancel.html")
->setBillingDetailsEmail("netellertest_USD@neteller.com")
->setBillingDetailsCountry("DE")
->setBillingDetailsFirstName("John")
->setBillingDetailsLastName("Smith")
->setBillingDetailsCity("Calgary")
->setBillingDetailsAddress1("address line 1")
->setBillingDetailsAddress2("address line 2")
->setBillingDetailsAddress3("address line 3")
->setBillingDetailsCountrySubDivisionCode("AB")
->setBillingDetailsPostCode("T8A22J")
->setBillingDetailsLang("en");
$result = $order->doRequest();
$redirectUrl = $order->getRedirectUrl();
var_dump($result);
var_dump($redirectUrl);
</code></pre>
<h1>LookupOrder Class <a name="LookupOrder"></a></h1>
<p>Returns details about a previous order request.</p>
<h2>Methods</h2>
<ul>
<li><strong>setOrderId(string $orderId)</strong> - Sets the order ID.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupOrder();
$lookup->setOrderId("ORD_1f21ca9d-e647-46bc-9dde-91c70632e587");
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>LookupOrderInvoice Class <a name="LookupOrderInvoice"></a></h1>
<p>Returns details about an invoice for an order.</p>
<h2>Methods</h2>
<ul>
<li><strong>setOrderId(string $orderId)</strong> - Sets the order ID.</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupOrderInvoice();
$lookup->setOrderId("ORD_5c0023d3-c928-4771-9016-1fc169283b0f")
->setExpand("customer,order");
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>CreateCustomer Class <a name="CreateCustomer"></a></h1>
<p>Pre-populate the NETELLER sign-up page with information from your database, so you can speed up the registration process. </p>
<h2>Methods</h2>
<ul>
<li><strong>setEmail(string $email)</strong> - Sets the email of the customer.</li>
<li><strong>setFirstName(string $firstName)</strong> - Sets the first name of the customer.</li>
<li><strong>setLastName(string $lastName)</strong> - Sets the last name of the customer.</li>
<li><strong>setAddress1(string $address1)</strong> - Sets the address line 1 of the customer.</li>
<li><strong>setAddress2(string $address2)</strong> - Sets the address line 2 of the customer.</li>
<li><strong>setAddress3(string $address3)</strong> - Sets the address line 3 of the customer.</li>
<li><strong>setCity(string $city)</strong> - Sets the city of the customer.</li>
<li><strong>setCountry(string $country)</strong> - Sets the country of the customer. ISO 3166-1 Alpha 2-code.</li>
<li><strong>setCountrySubDivisionCode(string $countrySubDivisionCode)</strong> - Sets the state/province of the customer. ISO 3166-2 code.</li>
<li><strong>setPostCode(string $postCode)</strong> - Sets the post code of the customer.</li>
<li><strong>setGender(string $gender)</strong> - Sets the gender of the customer.</li>
<li><strong>setDobDay(string $dobDay)</strong> - Sets the date of birth day of the customer.</li>
<li><strong>setDobMonth(string $dobMonth)</strong> - Sets the date of birth month of the customer.</li>
<li><strong>setDobYear(string $dobYear)</strong> - Sets the date of birth year of the customer.</li>
<li><strong>setLanguage(string $language)</strong> - Sets the preferred language of the customer.</li>
<li><strong>setCurrency(string $currency)</strong> - Sets the preferred currency of the customer.</li>
<li><strong>setMobile(string $mobile)</strong> - Sets the mobile phone of the customer.</li>
<li><strong>setLandLine(string $landLine)</strong> - Sets the land line phone of the customer.</li>
<li><strong>setBtag(string $btag)</strong> - sets the btag, used for affiliate tracking.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getRedirectUrl()</strong> - Returns the URL where the client needs to be redirected to complete the sign-up.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$signup = new CreateCustomer();
$signup->setEmail("john.smith@example.com")
->setFirstName("John")
->setLastName("Smith")
->setAddress1("address line 1")
->setAddress2("address line 2")
->setAddress3("address line 3")
->setCity("Calgary")
->setCountry("CA")
->setCountrySubDivisionCode("AB")
->setPostCode("T8A22J")
->setGender("m")
->setDobDay("31")
->setDobMonth("01")
->setDobYear("1975")
->setLanguage("en_US")
->setCurrency("EUR")
->setMobile("14035552333")
->setLandLine("14032332333")
->setLinkBackUrl("https://example.com/")
->setBtag("A_234B_345C_");
$response = $signup->doRequest();
$redirectUrl = $signup->getRedirectUrl();
var_dump($response);
var_dump($redirectUrl);
</code></pre>
<h1>LookupCustomer Class <a name="LookupCustomer"></a></h1>
<p>Lookup details for a specific customer.</p>
<h2>Methods</h2>
<ul>
<li><strong>setAccountId(string $accountId)</strong> - Sets the account ID of the customer. You can either use this method or "setCustomerId" and "setEmail".</li>
<li><strong>setCustomerId(string $customerId)</strong> - Sets the customer ID of the customer. You can either use this method or "setAccountId" and "setEmail".</li>
<li><strong>setEmail(string $email)</strong> - Sets the email of the customer. You can either use this method or "setAccountId" and "setCustomerId".</li>
<li><strong>setRefreshToken(string $refreshToken)</strong> - Sets the refresh token to be used in order to obtain an access token. You can either use this method or use "setAuthCode". This method is used only when you want to receive customer data outside of the default scope.</li>
<li><strong>setAuthCode(string $authCode)</strong> - Sets the authentication code to be used in order to obtain an access token. You can either use this method or use "setRefreshToken". This method is used only when you want to receive customer data outside of the default scope.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupCustomer();
$lookup->setCustomerId("453523712313")
->setRefreshToken("0.AgAAAU0yy4sHAAAAB1jwsOC9J7TBAYynTble-g2fdC-d.7xIAyXxQWsDaiLzjY4qimsqfyYU");
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>CreatePlan Class <a name="CreatePlan"></a></h1>
<p>Creates a subscription plan.</p>
<h2>Methods</h2>
<ul>
<li><strong>setPlanId(string $planId)</strong> - Sets the unique ID for the plan.</li>
<li><strong>setPlanName(string $planName)</strong> - Sets the name of the plan.</li>
<li><strong>setInterval(int $interval)</strong> - Sets the number of intervals between each billing attempt.</li>
<li><strong>setIntervalType(string $intervalType)</strong> - Sets the frequency at which the plan subscriber will be billed (daily, weekly, monthly, yearly).</li>
<li><strong>setIntervalCount(int $intervalCount)</strong> - Sets the length of the contract in intervals.</li>
<li><strong>setAmount(int $amount)</strong> - Sets the amount to bill for each recurring payment.</li>
<li><strong>setCurrency(string $currency)</strong> - Sets the currency in which the customer will be billed.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$plan = new CreatePlan();
$plan->setPlanId("MONTHLYGREENPLAN")
->setPlanName("Sample Premier Monthly Membership")
->setInterval(3)
->setIntervalType("monthly")
->setIntervalCount(4)
->setAmount(2995)
->setCurrency("USD");
$result = $plan->doRequest();
var_dump($result);
</code></pre>
<h1>LookupPlan Class <a name="LookupPlan"></a></h1>
<p>Returns details about a previously created subscription plan.</p>
<h2>Methods</h2>
<ul>
<li><strong>setPlanId(string $planId)</strong> - Sets the plan ID.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupPlan();
$lookup->setPlanId("MONTHLYGREENPLAN");
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>CancelPlan Class <a name="CancelPlan"></a></h1>
<p>Cancels a previously created subscription plan.</p>
<h2>Methods</h2>
<ul>
<li><strong>setPlanId(string $planId)</strong> - Sets the plan ID.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$plan = new CancelPlan();
$plan->setPlanId("MONTHLYGREENPLAN");
$result = $plan->doRequest();
var_dump($result);
</code></pre>
<h1>Delete Plan <a name="DeletePlan"></a></h1>
<p>Deletes a previously created subscription plan.</p>
<h2>Methods</h2>
<ul>
<li><strong>setPlanId(string $planId)</strong> - Sets the plan ID.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$plan = new DeletePlan();
$plan->setPlanId("MONTHLYGREENPLAN");
$result = $plan->doRequest();
var_dump($result);
</code></pre>
<h1>ListPlans Class <a name="ListPlans"></a></h1>
<p>Returns a list of all plans.</p>
<h2>Methods</h2>
<ul>
<li><strong>setLimit(int $limit)</strong> - Sets the number of records to be returned. </li>
<li><strong>setOffset(int $offset)</strong> - Sets the results offset.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$plans = new ListPlans();
$plans->setLimit(10)
->setOffset(0);
$result = $plans->doRequest();
var_dump($result);
</code></pre>
<h1>CreateSubscription Class <a name="CreateSubscription"></a></h1>
<p>Enrolls an existing NETELLER account holder in one of your subscription plans.</p>
<h2>Methods</h2>
<ul>
<li><strong>setPlanId(string $planId)</strong> - Sets the plan ID.</li>
<li><strong>setCustomerId(string $customerId)</strong> - Sets the Customer ID of the customer to be subscribed.</li>
<li><strong>setStartDate(string $startDate)</strong> - Sets the start date for the subscription. The date needs to be in ISO 8601 format (UTC).</li>
<li><strong>setRefreshToken(string $refreshToken)</strong> - Sets the refresh token to be used in order to obtain an access token. You can either use this method or use "setAuthCode".</li>
<li><strong>setAuthCode(string $authCode)</strong> - Sets the authentication code to be used in order to obtain an access token. You can either use this method or use "setRefreshToken".</li>
<li><strong>setRedirectUri(string $redirectUri)</strong> - Sets the redirect URI.</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Examples</h2>
<h3>Using Authorization code</h3>
<pre><code>$subscription = new CreateSubscription();
$subscription->setPlanId("MONTHLYGREENPLAN")
->setAccountProfileEmail("netellertest_USD@neteller.com")
->setStartDate("2015-05-09T00:00:00Z")
->setAuthCode("0.AAAAAU0yjMR5AAAAAAAEk-B1A0yk5HA7RZkwz9zQYRFN.eNw8W12CqB06b2Qc2rvr3vUyc-g")
->setRedirectUri("https://example.com/")
->setExpand("plan,customer");
$result = $subscription->doRequest();
var_dump($result);
</code></pre>
<h3>Using Refresh token</h3>
<pre><code>$subscription = new CreateSubscription();
$subscription->setPlanId("MONTHLYGREENPLAN")
->setAccountProfileEmail("netellertest_USD@neteller.com")
->setStartDate("2015-05-09T00:00:00Z")
->setRefreshToken("0.AgAAAU0yy4sHAAAAB1jwsOC9J7TBAYynTble-g2fdC-d.7xIAyXxQWsDaiLzjY4qimsqfyYU")
->setRedirectUri("https://example.com/")
->setExpand("plan,customer");
$result = $subscription->doRequest();
var_dump($result);
</code></pre>
<h1>LookupSubscription Class <a name="LookupSubscription"></a></h1>
<p>Returns details about a previously created subscription.</p>
<h2>Methods</h2>
<ul>
<li><strong>setSubscriptionId(string $subscriptionId)</strong> - Sets the subscription ID.</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupSubscription();
$lookup->setSubscriptionId("180")
->setExpand("plan,customer");
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>CancelSubscription Class <a name="CancelSubscription"></a></h1>
<p>Cancels a previously created subscription.</p>
<h2>Methods</h2>
<ul>
<li><strong>setSubscriptionId(string $subscriptionId)</strong> - Sets the subscription ID.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$subscription = new CancelSubscription();
$subscription->setSubscriptionId("181");
$result = $subscription->doRequest();
var_dump($result);
</code></pre>
<h1>ListSubscriptions Class <a name="ListSubscriptions"></a></h1>
<p>Lists all previously created subscriptions.</p>
<h2>Methods</h2>
<ul>
<li><strong>setLimit(int $limit)</strong> - Sets the number of records to be returned. </li>
<li><strong>setOffset(int $offset)</strong> - Sets the results offset.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$subscriptions = new ListSubscriptions();
$subscriptions->setLimit(10)
->setOffset(0);
$result = $subscriptions->doRequest();
var_dump($result);
</code></pre>
<h1>LookupSubscriptionInvoice Class <a name="LookupSubscriptionInvoice"></a></h1>
<p>Looks up a subscription invoice.</p>
<h2>Methods</h2>
<ul>
<li><strong>setSubscriptionId(string $subscriptionId)</strong> - Sets the subscription ID.</li>
<li><strong>setInvoiceNumber(int $invoiceNumber)</strong> - Sets the invoice number.</li>
<li><strong>setExpand(string $expandObjects)</strong> - A list of comma-separated names of objects to be expanded in the NETELLER REST API response.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupSubscriptionInvoice();
$lookup->setSubscriptionId(166)
->setInvoiceNumber(42)
->setExpand("customer, subscription");
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>LookupAllSubscriptionInvoices Class <a name="LookupAllSubscriptionInvoices"></a></h1>
<p>Looks up all subscription invoices.</p>
<h2>Methods</h2>
<ul>
<li><strong>setSubscriptionId(string $subscriptionId)</strong> - Sets the subscription ID.</li>
<li><strong>setLimit(int $limit)</strong> - Sets the number of records to be returned. </li>
<li><strong>setOffset(int $offset)</strong> - Sets the results offset.</li>
<li><strong>doRequest()</strong> - Executes the API request. Returns the JSON-decoded object of the NETELLER REST API response, or "(bool)false" if an error has occurred.</li>
<li><strong>getExecutionErrors()</strong> - Returns an array with the error(s) returned by the NETELLER REST API.</li>
</ul>
<h2>Example</h2>
<pre><code>$lookup = new LookupAllSubscriptionInvoices();
$lookup->setSubscriptionId(166)
->setLimit(10)
->setOffset(0);
$result = $lookup->doRequest();
var_dump($result);
</code></pre>
<h1>WebhookHandler Class <a name="WebhookHandler"></a></h1>
<p>Handles incoming webhook requests.</p>
<h2>Methods</h2>
<ul>
<li><strong>handleRequest()</strong> - Receives the webhook request and calls a callback function passing through the webhook data. You need to give the callback function(s) the same name as the webhook(s) you are subscribed to. Please refer to the REST API Guide for a list of all webhook names.</li>
</ul>
<h2>Example</h2>
<pre><code>$webhook = new WebhookHandler();
$webhook->handleRequest();
function payment_succeeded($data){
$api = new NetellerAPI();
$result = $api->getUrl($data->links[0]->url);
//do something with the response here
}
</code></pre>
</body>
</html>
<!-- This document was created with MarkdownPad, the Markdown editor for Windows (http://markdownpad.com) -->