【问题标题】:What is the use of authcode data returned from transaction response in Authorize.netAuthorize.net 中交易响应返回的 authcode 数据有什么用
【发布时间】:2016-10-08 06:30:30
【问题描述】:

Authorize.net 中交易响应返回的 authcode 数据有什么用,我将在哪里使用。我是新手,。我需要帮助,因为如果我知道 $tresponse->getAuthCode() 数据的用途,那么我可以正确使用它来将它集成到我的网站中。

<?php
require 'vendor/autoload.php'; 
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

define("AUTHORIZENET_LOG_FILE","phplog");

// Common setup for API credentials  
 $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();   
  $merchantAuthentication->setName("dummydata");   
  $merchantAuthentication->setTransactionKey("dummydata");   
  $refId = 'ref' . time();

// Create the payment data for a credit card
  $creditCard = new AnetAPI\CreditCardType();
  $creditCard->setCardNumber("4111111111111111" );  
  $creditCard->setExpirationDate( "2038-12");
  $paymentOne = new AnetAPI\PaymentType();
  $paymentOne->setCreditCard($creditCard);

// Create a transaction
  $transactionRequestType = new AnetAPI\TransactionRequestType();
      $transactionRequestType->setTransactionType("authCaptureTransaction");   
  $transactionRequestType->setAmount(151.51);
  $transactionRequestType->setPayment($paymentOne);
  $request = new AnetAPI\CreateTransactionRequest();
  $request->setMerchantAuthentication($merchantAuthentication);
  $request->setRefId( $refId);
  $request->setTransactionRequest($transactionRequestType);
  $controller = new AnetController\CreateTransactionController($request);
  $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);   

if ($response != null) 
{
  $tresponse = $response->getTransactionResponse();
  if (($tresponse != null) && ($tresponse->getResponseCode()=="1"))
  {
    echo "Charge Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
    echo "Charge Credit Card TRANS ID  : " . $tresponse->getTransId() . "\n";
  }
  else
  {
    echo "Charge Credit Card ERROR :  Invalid response\n";
  }
}  
else
{
  echo  "Charge Credit Card Null response returned";
}
?>

【问题讨论】:

    标签: php payment-gateway authorize.net


    【解决方案1】:

    授权码是发卡银行发行的一组数字(有时是字母和数字的组合)。此代码表示已针对您客户的余额冻结了该金额的资金。所有批准的交易都会获得一个授权码。

    https://support.authorize.net/authkb/index?page=content&id=A469

    【讨论】:

    • 我需要知道,我们将来有没有使用它,然后我们需要保存这些数据,以及我们将在哪里使用它
    • 查看 rhldr 提供的链接,您的问题将得到解答。
    猜你喜欢
    • 2012-06-06
    • 2016-08-06
    • 1970-01-01
    • 2016-12-11
    • 2020-02-28
    • 2011-03-29
    • 2012-04-14
    • 2015-03-31
    • 2018-10-12
    相关资源
    最近更新 更多