我想知道是否有人使用USAePay计费模块?我已经联系了开发人员,他的回答是他没有时间帮助别人。我的问题是这个 -
我编写了以下代码,使用沙盒服务器添加客户的结算信息,但看起来模块默认为生产服务器,因此每次我尝试验证交易时都会得到响应 - < / p>
卡被拒绝:未找到指定的源密钥。
如何告诉它使用沙盒服务器?
use strict;
use warnings;
use Business::OnlinePayment;
use constant {
LOGIN => 'source key', #USAePay source key
PASSWORD => '12345', #USAePay PIN
};
my $tx = new Business::OnlinePayment("USAePay");
$tx->content(
login => LOGIN,
password => PASSWORD,
type => 'CC',
action => 'Recurring Authorization',
description => 'Business::OnlinePayment test',
amount => '49.95',
invoice_number => '100100',
name => 'Tofu Beast',
card_number => '4000100011112224',
expiration => '09/19',
address => '1234 Bean Curd Lane',
city => 'San Francisco',
state => 'CA',
zip => '94102',
);
$tx->submit();
if($tx->is_success()) {
print 'Card processed successfully: '.$tx->authorization.'\n';
} else {
print 'Card was rejected: '.$tx->error_message."\n";
}
答案 0 :(得分:3)
由于Business::OnlinePayment::USAePay是Business::OnlinePayment的处理器,但本身没有很多文档,查看Business :: OnlinePayment的文档可能有所帮助。它揭示了the test_transaction
method。
大多数处理器提供测试模式,其中提交的事务实际上不会被收费或添加到您的批处理中,使用true参数调用此函数将在处理器支持时打开该模式,或者如果处理器生成致命错误不支持测试模式(可能比意外收取实际费用更好)。
一个未经测试的例子:
my $tx = new Business::OnlinePayment("USAePay");
$tx->test_transaction; # here
$tx->content(
login => LOGIN,
password => PASSWORD,
type => 'CC',
action => 'Recurring Authorization',
description => 'Business::OnlinePayment test',
amount => '49.95',
invoice_number => '100100',
name => 'Tofu Beast',
card_number => '4000100011112224',
expiration => '09/19',
address => '1234 Bean Curd Lane',
city => 'San Francisco',
state => 'CA',
zip => '94102',
);
$tx->submit();
在source of Business::OnlinePayment::USAePay shows深入挖掘这个特定的处理器实际上有三种不同的测试模式。
# test_transaction(0): normal mode # 1 : test mode (validates formatting only) # 2 : use sandbox server # 3 : test mode on sandbox server
答案 1 :(得分:1)
它looks like你可以在构造函数中设置服务器细节 - 它需要一个超出处理器名称的可选参数哈希。
你有没有试过像:
my $tx = new Business::OnlinePayment(
"USAePay",
Server => 'https://sandbox.usaepay.com/gate'
);