forked from tpay-com/tpay-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDac.php
More file actions
68 lines (54 loc) · 1.73 KB
/
Dac.php
File metadata and controls
68 lines (54 loc) · 1.73 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
<?php
/*
* Created by tpay.com
*/
namespace tpayLibs\examples;
use tpayLibs\src\_class_tpay\PaymentDac;
include_once 'config.php';
include_once 'loader.php';
class DacExample extends PaymentDac
{
public function __construct()
{
$this->merchantSecret = 'demo';
$this->merchantId = 1010;
$this->trApiKey = '';
$this->trApiPass = '';
parent::__construct();
}
public function processDacTransaction()
{
$config = array(
'kwota' => 200.99,
'opis' => 'Transaction description',
'crc' => '100020003006',
'wyn_url' => 'http://example.pl/examples/paymentBasic.php?transaction_confirmation',
'email' => 'customer34@example.com',
'imie' => 'John',
'nazwisko' => 'Wayn',
);
/*
* This method return HTML form
*/
$staticFilesURL = 'http://example.pl/src/';
$merchantData = 'Sklep ze zdrową żywnością<br>ul. Świdnicka 26, 50-345 Wrocław';
$data = $this->registerTransaction($config, $staticFilesURL, $merchantData);
/**
* $data['transaction']
* array(7) {
* ["result"]=> string(1) "1"
* ["title"]=> string(13) "TR-C7K-9A8AAX"
* ["amount"]=> float(200.99)
* ["account_number"]=> string(26) "12194010763052712000000000"
* ["online"]=> string(1) "0"
* ["url"]=> string(0) ""
* ["desc"]=> string(0) ""
* ["crc"]=> string(0) "100020003006"
* }
*
* Save in your database transaction crc to handle payment confirmation in future
*/
echo $data['html'];
}
}
(new DacExample())->processDacTransaction();