-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathexample-quicksale.php
51 lines (41 loc) · 1.68 KB
/
example-quicksale.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
51
<?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 quicksale, which is a new transaction
// against a prior sale or credit. Credit card (or ACH) data is retrieved from
// prior transaction and does not need to be provided. The only required information
// is the transaction reference number (refnum) and the amount.
//
// 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";
$tran=new umTransaction;
$tran->key="897asdfjha98ds6f76324hbmnBZc9769374ybndfs876";
$tran->usesandbox=true;
$tran->pin="1234";
$tran->ip=$REMOTE_ADDR; // This allows fraud blocking on the customers ip address
$tran->testmode=0; // Change this to 0 for the transaction to process
$tran->usesandbox=1;
$tran->amount="10.00"; // charge amount in dollars
$tran->invoice="1234"; // invoice number. must be unique.
$tran->description="Online Order"; // description of charge
$tran->refnum="47100443"; //refnum stored from the $tran->refnum of a previous transaction
echo "<h1>Please wait one moment while we process your card...<br>\n";
flush();
if($tran->ProcessQuickSale())
{
echo "<b>Card Approved</b><br>";
echo "<b>Authcode:</b> " . $tran->authcode . "<br>";
echo "<b>AVS Result:</b> " . $tran->avs . "<br>";
echo "<b>Cvv2 Result:</b> " . $tran->cvv2 . "<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>";
}
?>