Commit | Line | Data |
---|---|---|
d667da5b IK |
1 | <?php |
2 | // The ugly bit of code below loads the TCLink extension if it is not | |
3 | // already. You can skip all of this if "extension=tclink.so" is in | |
4 | // your php.ini, or you can make a single call to dl("tclink") if | |
5 | // tclink.so is in your PHP extensions path ("extension_dir"). | |
6 | if (!extension_loaded("tclink")) | |
7 | { | |
8 | echo "TCLink not loaded. Try running as `php -d extension=modules/tclink.so tctest.php`\n"; | |
9 | exit(1); | |
10 | } | |
11 | ||
12 | print "\nTCLink version " . tclink_getversion() . "\n"; | |
13 | print "Sending transaction..."; | |
14 | ||
15 | // Build a hash containing our parameters | |
16 | $params['custid'] = 'XXXX'; | |
17 | $params['password'] = 'PPPP'; | |
c235c6ac | 18 | $params['action'] = 'preauth'; |
d667da5b IK |
19 | $params['media'] = 'cc'; |
20 | $params['cc'] = '4111111111111111'; | |
c235c6ac | 21 | $params['exp'] = '0429'; |
d667da5b IK |
22 | $params['amount'] = '100'; |
23 | $params['name'] = 'Joe PHP'; | |
24 | ||
25 | // Send the hash to TrustCommerce for processing | |
26 | $result = tclink_send($params); | |
27 | ||
28 | print "done!\n\nTransaction results:\n"; | |
29 | ||
30 | // Print out all parameters returned | |
31 | while (list($key, $val) = each($result)) | |
32 | print "\t$key=$val\n"; | |
33 | ?> |