New to the community and tried searching for teh answer, but I am lost and hoping to get some help.
I am using the sample code so far and got everything working as needed in my project ALTHOUGH I am trying to find out how to display the merchant defined field once hte transaction is submited.
Here is how I setup my merchant defined field:
$merchantDefinedField1 = new AnetAPI\UserFieldType();
$merchantDefinedField1->setName("MerchantID");
$merchantDefinedField1->setValue("$merchid");
Now using the sample code with the php sdk I am able to get the response back and everything works good BUT need to know how to display the merchant defined field.
Here is a snippet of the code where I am getting the response and displaying info. If someone can help me and tell me how to then display the "MerchantID" custom field I woudl be VERY MUCH appreciative.
// Create the controller and get the response $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { // Check to see if the API request was successfully received and acted upon if ($response->getMessages()->getResultCode() == "Ok") { // Since the API request was successful, look for a transaction response // and parse it to display the results of authorizing the card $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getMessages() != null) { echo " Successfully Created Transaction With Transaction ID: " . $tresponse->getTransId() . "<br>"; echo " Transaction Response Code: " . $tresponse->getResponseCode() . "<br>"; echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "<br>"; echo " Authorization Code: " . $tresponse->getAuthCode() . "<br>"; echo " Status: <b>" . $tresponse->getMessages()[0]->getDescription() . "</b><br><br>";
Solved! Go to Solution.
07-27-2017 11:02 AM
Hi @jaybenoit,
This previous thread has a sample of a foreach loop to iterate through the response and pull the merchant fields out. If that's not making sense to you, let me know, and we'll walk through it together.
07-31-2017 10:13 AM
Hi @jaybenoit,
This previous thread has a sample of a foreach loop to iterate through the response and pull the merchant fields out. If that's not making sense to you, let me know, and we'll walk through it together.
07-31-2017 10:13 AM
Thank you VERY MUCH!!!!
That was exactly what I needed.
07-31-2017 01:04 PM