Authorize.Net 验证信用卡 AIM 和 ARB [英] Authorize.Net verify credit card AIM and ARB

查看:25
本文介绍了Authorize.Net 验证信用卡 AIM 和 ARB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 authorize.net 重复交易.如果他们希望在接下来的 12 个月内重复捐赠,我想要做的是提供一个选项来检查捐赠.

Im using the authorize.net recurring transaction. What Im trying to do is give the an option to check off a donation if they want it recurring for the next 12 months.

所以在 ARB 之前 - 我想验证卡,但 0.00 不是有效金额.因此,如果我的金额为 0.01 - 如何在验证卡后取消交易?

So before the ARB - I want to verify the card but 0.00 isn't a valid amount. so if i made the amount 0.01 - how can I void the transaction after the card is verified?

此外 - 订阅后,我没有收到来自 authorize.net 的电子邮件,告诉我交易已完成,就像处理常规交易一样.

Also - when a subscription is made I dont get an email from authorize.net telling me a transaction was made like when a regular transaction is processed.

我的代码:

$authorization = new AuthnetAIM($apilogin, $apitranskey, true);
$authorization->setTransaction($creditcard, $expiration, '0.01');
$authorization->setTransactionType('AUTH_ONLY');
$authorization->process();
if ($authorization->isApproved())
{
$subscription = new AuthnetARB($apilogin, $apitranskey, AuthnetARB::USE_DEVELOPMENT_SERVER);
    // Set subscription information
    $subscription->setParameter('amount', $amount);
    $subscription->setParameter('cardNumber', $creditcard);
    $subscription->setParameter('expirationDate', $expiration);
    $subscription->setParameter('firstName', $business_firstname);
    $subscription->setParameter('lastName', $business_lastname);
    $subscription->setParameter('address', $business_address);
    $subscription->setParameter('city', $business_city);
    $subscription->setParameter('state', $business_state);
    $subscription->setParameter('zip', $business_zipcode);
    $subscription->setParameter('email', $email);

    // Set the billing cycle for every three months
    $subscription->setParameter('interval_length', 1);
    $subscription->setParameter('startDate', date("Y-m-d", strtotime("+ 1 months")));

    // Create the subscription
    $subscription->createAccount();

    // Check the results of our API call
    if ($subscription->isSuccessful())
    {
        // Get the subscription ID
        $subscription_id = $subscription->getSubscriberID();
        Send_email();
    }
    else
    {
        $transError = 'your subscription was not created';
        $hasError = true;

    }
}
else if ($authorization->isDeclined())
{
    $transError = 'This card is not valid';
        $hasError = true;
}

}
catch (AuthnetARBException $e)
{
    $transError =  'There was an error processing the transaction. Here is the error message:<br/> ';
    echo $e->__toString();
    $hasError = true;
}
}

推荐答案

不仅 0.00 是有效金额,而且如果您只是想验证信用卡是否合法,Visa 和 Mastercard 会要求您使用该金额.几年前,出于这个原因,他们停止允许进行任何实际价值的预认证.我认为商家不这样做会被罚款.

Not only is 0.00 a valid amount, but if you're just trying to verify a credit card is legitimate you are required by Visa and Mastercard to use that amount. A few years ago they stopped allowing pre-auths of any real value to be done for this reason. I think there are fines for merchants who fail to do so.

话虽如此,如果您要采取收取 $.01 然后取消交易"路线,以下代码应该可以工作:

Having said that, if you're going to take the "charge $.01 and then void the transaction" route, the following code should work:

$transaction_id = $authorization->getTransactionID();
$void = new AuthnetAIM($apilogin, $apitranskey, true);
$void->setTransactionType("VOID");
$void->setParameter('x_trans_id', $transaction_id);
$void->process();

这篇关于Authorize.Net 验证信用卡 AIM 和 ARB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆