Reputation: 547
I am creating a CIM API for authorize.net. I have it all working perfectly, but I need the transaction id to be returned to me when a transaction is created.
Right now, this what I have being returned when I complete a transaction:
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;
Then this is the output I get: Request Response Summary: Response code: I00001 Message: Successful.Approval code: NXD8X7
No transaction ID is returned. I want to know how I can go about getting this. My goal is to write this to my database, but I need some way to get the transaction id. Thank you very much.
Upvotes: 1
Views: 1599
Reputation: 377
If you are using AuthorizeNet SDK you can get all response fields as an object with calling $response->getTransactionResponse function like following.
$request = new AuthorizeNetCIM();
$response = $request->createCustomerProfileTransaction('AuthCapture', $transaction);
$transactionResponse = $response->getTransactionResponse();
$transactionResponse->transaction_id
Upvotes: 1