从Authorize.Net CIM API获取交易ID

时间:2013-07-03 18:15:30

标签: api authorize.net authorize.net-cim

我正在为authorize.net创建一个CIM API。我完全正常工作,但我需要在创建事务时将事务ID返回给我。

现在,这是我在完成交易时返回的内容:

if ($cim->isSuccessful())
    {
        $approval_code = $cim->getAuthCode();


    }


    // Print the results of the request
    echo '<strong>Request Response Summary:</strong> ' .
                               $cim->getResponseSummary() . '';
    echo '<strong>Approval code:</strong> ' . $approval_code;

然后这是我得到的输出:请求响应摘要:响应代码:I00001消息:Successful.Approval代码:NXD8X7

未返回任何交易ID。我想知道如何才能得到这个。我的目标是将其写入我的数据库,但我需要一些方法来获取事务ID。非常感谢你。

1 个答案:

答案 0 :(得分:1)

如果您使用的是AuthorizeNet SDK,则可以将所有响应字段作为对象,并调用$ response-&gt; getTransactionResponse函数,如下所示。

    $request = new AuthorizeNetCIM();
    $response = $request->createCustomerProfileTransaction('AuthCapture', $transaction);
    $transactionResponse = $response->getTransactionResponse();
    $transactionResponse->transaction_id
相关问题