Getting Transaction ID from Authorize.Net CIM API - api

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.

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

Related

Google Sheet API batchUpdateByDataFilter PHP Function

https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdateByDataFilter
We have used above function in our code, while we are passing the more than 50 or 100 records within the array records then given 400 bad request array in response.
Can anyone describe the limit of the total values that we are going to pass within the above function?
Here is my code:
$batchupdate = array("valueInputOption" => "RAW", "data" => $dataarray);
try {
$requestBody = new Google_Service_Sheets_BatchUpdateValuesByDataFilterRequest($batchupdate);
$response = $service->spreadsheets_values->BatchUpdateByDataFilter($spreadsheetId, $requestBody);
}
catch(Exception $e) {
echo 'Message: ' . $e->getMessage();
}
Troubleshooting:
Problems with the Request
Until you attach a sanitized version of your Request body we cannot be sure about the root-cause of the problem you are facing.
However, an error 400 means that the request you did is invalid. So, most likely, the problem is in that.
Check if your request object is formatted as detailed on the documentation.
Problems with the Client
If you are able to use the Try this API sidebar with the same Request Body then it could be related to the PHP client.
Note: This is language independent. Create a JSON Object that has the same structure as your request body.
If that's the case, we will need to see more of your code to verify that you are not using your valid Request body in an invalid way (eg. sending it encapsulated in another object).
By referencing the PHP Library documentation you can see the properties of the objects you can use.

Checkout API get email of buyer on redirect

So using the square checkout api, after the user uses the square checkout, I get a transaction id and checkout id, but it seems theres no way to get the information the buyer entered at checkout. How can I get the email and name of said buyer?
Tried getting the info through the checkout id but it seems its not possible
// pull out the transaction ID returned by Square Checkout
$returnedTransactionId = $_GET["transactionId"];
// Create a new API object to verify the transaction
$transactionClient = new \SquareConnect\Api\TransactionsApi($defaultApiClient);
// Ping the Transactions API endpoint for transaction details
try {
// Get transaction details for this order from the Transactions API endpoint
$apiResponse = $transactionClient->retrieveTransaction(
$locationId,
$returnedTransactionId
);
} catch (Exception $e) {
echo "The SquareConnect\Configuration object threw an exception while " .
"calling TransactionsApi->retrieveTransaction: ",
$e->getMessage(), PHP_EOL;
exit;
}
Once you retrieve the transaction like you're already doing, the response will have a field called tenders, and in this array field you'll find a field called customer_id. Using this customer_id, you can call RetrieveCustomer and get the customer's information, including their name and email.

karate | xml post method exeuction

I’m having issue with xml post request where post method is not executed. When I try to post same request body in post man it worked.My test is success with 200 but actual request is not executed.
Please let me know if I’m missing
To pass the request body,I’m calling through java object and payload is correctly constructed and printed.In execution test is success and doesn’t print response.But actually test is not executed.
Only headers are printed.
***************** create-user.feature*****************
Feature: create ims user for provided country
Requires country code,
Background:
# load secrets from json
* def createuser = Java.type('com.user.JavaTestData')
* def create = createuser.createUser("US")
Scenario: get service token
Given url imscreateuserurl
And request create
When method post
Then status 200
* print response
***************** create-user.feature*****************
Here is java class
public class JavaTestData {
private static final Logger logger = LoggerFactory.getLogger(JavaTestData.class);
public static String createUser(String countryCodeInput) {
logger.debug("create user for country code input", countryCodeInput);
Unless you post a full working example, no one can help you. Pretty clear that the value of create is null or empty.
Also I personally think you are wasting your time using Java. The whole point of Karate is to avoid using Java as far as possible.
Look at these examples for ideas: https://github.com/intuit/karate/blob/master/karate-junit4/src/test/java/com/intuit/karate/junit4/xml/xml.feature
Edit: also refer to the doc on type-conversion: https://github.com/intuit/karate#type-conversion
#Peter, here is my feature file
Feature: create ims user for provided country
Requires country code,
Background:
# load secrets from json
* def createuser = Java.type('com.adobe.imscreateuser.JavaTestData')
* def create = createuser.createUser("US")
Scenario: get service token
Given url imscreateuserurl
And header Content-Type = 'application/xml; charset=utf-8'
And request create
When method post
Then status 200
* print response
I have performed print for create and showing complete payload.At when method post -> statement its going as null or empty...
Not sure where it is missing

PayPal API: get Topic/Message of Transaction

How do i get the name of the Transaction in the PayPal-Transaction? For Example: the Messagefield in PayPal when you send Money or the Name of the Ebay Title if you buy something
Current request works, iam getting all fields accept a title/message for each transaction
My current CODE
<?php
$info = 'USER=pp2_api1.fdd.com'
.'&PWD=s8LW9QSdsdQ'fdgfQ49BGnB2EtG7ZgE.-sgUqA1s-RyHsMfsFrssUOnsREbod1'
.'&METHOD=TransactionSearch'
.'&TRANSACTIONCLASS=RECEIVED'
.'&STARTDATE=2013-01-08T05:38:48Z'
.'&ENDDATE=2013-07-14T05:38:48Z'
.'&VERSION=94';
$curl = curl_init('https://api-3t.paypal.com/nvp');
?>
Ok works just with "GetTransactionDetails"

processing application response from apply with linkedin

I am trying to get the response returned by the Apply with LinkedIn plugin. I am using Zend Framework. I have tried using the sample code from linkedIn
<?php
// access raw HTTP POST data
$post_body = file_get_contents('php://input');
$application = json_decode($post_body);
// confirm success by writing applicant name to the error log
error_log($application->person->firstName . " " . $application->person->lastName);
// now parse $application and insert data into a DB
// or perform another action
?>
pasted this in my controller and then my view but no success.
my data-url is the url of the current page...
Could anyone show me how this is suppose to be done PHP or javascript (need to get the response into the database).
Thanks.
Try replacing
$post_body = file_get_contents('php://input');
With:
$post_body = $this->getRequest()->getRawBody();
Where $this refers to the current request. I'm not positive if you get this for free..., but I'm hoping you can take this from here. I'm not a ZF expert.