/
How_To_Use_Token.pl
executable file
·52 lines (44 loc) · 1.45 KB
/
How_To_Use_Token.pl
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
##
# BluePay Perl Sample code.
#
# Charges a customer $3.00 using the payment and customer information from a previous transaction.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##
use strict;
use lib '..';
use bluepay;
my $account_id = "Merchant's Account ID Here";
my $secret_key = "Merchant's Secret Key Here";
my $mode = "TEST";
my $token = "Transaction ID here";
my $payment = BluePay->new(
$account_id,
$secret_key,
$mode
);
#$payment->set_customer_information({
# stored_type => 'C', # Optional
# stored_indicator => 'F', # Optional
# stored_id => 'TESTID526957756' # Optional
#});
$payment->sale({
amount => '3.00',
trans_id => $token
});
# Makes the API Request
$payment->process();
# Reads the response from BluePay
if ($payment->is_successful_response()){
print "TRANSACTION STATUS: " . $payment->{Result} . "\n";
print "TRANSACTION MESSAGE: " . $payment->{MESSAGE} . "\n";
print "TRANSACTION ID: " . $payment->{RRNO} . "\n";
print "AVS RESULT: " .$payment->{AVS} . "\n";
print "CVV2 RESULT: " . $payment->{CVV2} . "\n";
print "MASKED PAYMENT ACCOUNT: " . $payment->{PAYMENT_ACCOUNT} . "\n";
print "CARD TYPE: " . $payment->{CARD_TYPE} . "\n";
print "AUTH CODE: " . $payment->{AUTH_CODE} . "\n";
#print "STORED ID: " . $payment->{RESPONSE_STORED_ID} . "\n";
} else {
print $payment->{MESSAGE} . "\n";
}