我正在使用 authorize.net 定期交易。我想做的是,如果他们希望在接下来的 12 个月内重复捐赠,可以选择核对捐赠。
所以在 ARB 之前 - 我想验证卡,但 0.00 不是有效金额。所以如果我的金额为 0.01 - 我如何在卡验证后取消交易?
另外 - 订阅时,我没有收到来自 authorize.net 的电子邮件,告诉我进行了交易,就像处理常规交易时一样。
我的代码:
$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;
}
}