1

我正在为 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 消息:成功。批准代码:NXD8X7

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

4

1 回答 1

1

如果您使用的是 AuthorizeNet SDK,您可以通过调用 $response->getTransactionResponse 函数将所有响应字段作为对象获取,如下所示。

    $request = new AuthorizeNetCIM();
    $response = $request->createCustomerProfileTransaction('AuthCapture', $transaction);
    $transactionResponse = $response->getTransactionResponse();
    $transactionResponse->transaction_id
于 2013-08-23T19:51:06.587 回答