-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathexample.php
50 lines (42 loc) · 1.47 KB
/
example.php
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
<?php
// USA ePay PHP Library.
// v1.6
//
// Copyright (c) 2002-2008 USA ePay
// For support please contact [email protected]
//
// The following is an example of running a transaction using the php library.
// Please see the README file for more information on usage.
//
// Change this path to the location you have save usaepay.php to
include "./usaepay.php";
// Instantiate USAePay client object
$tran=new umTransaction;
// Merchants Source key must be generated within the console
$tran->key="897asdfjha98ds6f76324hbmnBZc9769374ybndfs876";
// Send request to sandbox server not production. Make sure to comment or remove this line before
// putting your code into production
$tran->usesandbox=true;
$tran->card="4005562233445564";
$tran->exp="0312";
$tran->amount="1.00";
$tran->invoice="1234";
$tran->cardholder="Test T Jones";
$tran->street="1234 Main Street";
$tran->zip="90036";
$tran->description="Online Order";
$tran->cvv2="435";
echo "<h1>Please Wait One Moment While We process your card.<br>\n";
flush();
if($tran->Process())
{
echo "<b>Card approved</b><br>";
echo "<b>Authcode:</b> " . $tran->authcode . "<br>";
echo "<b>AVS Result:</b> " . $tran->avs_result . "<br>";
echo "<b>Cvv2 Result:</b> " . $tran->cvv2_result . "<br>";
} else {
echo "<b>Card Declined</b> (" . $tran->result . ")<br>";
echo "<b>Reason:</b> " . $tran->error . "<br>";
if($tran->curlerror) echo "<b>Curl Error:</b> " . $tran->curlerror . "<br>";
}
?>