Not getting transaction data in search transaction api

vinfoakhilesh
Contributor
Contributor

Please can anybody help me ?

I am not getting transaction details using api : curl -v -X GET https://api.sandbox.paypal.com/v1/reporting/transactions?start_date=2014-07-20T00:00:00-0700&end_dat...4R158924KP188932X&fields=all&page_size=100&page=1 \

-H "Content-Type: application/json" \

-H "Authorization: Bearer <Access-Token>"

 

I followed all the rules , and I am also getting response but transaction details array is blank

 

the transaction I tried details are as follows :

merchant mail : my merchant mail,

client key : AeRPxcF9WRbxlEnMB68u3LFJIzDWRaJz7Uph7ytlnt2nq6_EeiNYyWxMjjYgPxySilwrVi3gImz08zjG

secret : EPzZfLujewSmfpRg-wl7fGg4fbAwMccJAuS-n84biuu-jTe-v1TffASXiG04SeZ1XBqFLMYtbuQ_B-eA

token generated dynamically : A21AAHxfbbwn6xXzYE3vKlqbWXS8En_xSkCpsP8c0EYpxBvcIQ85OLmOuK5vNhMxYbzTF2tkM-0FR6j_PIJEH0zU_4pPHkD-w

transaction id : 4R158924KP188932X

amount : 21 USD

 

########################code################

<?php

 

function gen_access_token(){

 

$ch = curl_init();

// $clientId = "AcsJGPVnXTYlQwOBuq_ndF-oDroyBeOauEflfE39ded0DMXeD77WwX0sgS4qSzumf-Oxnt81IuYXqd3I";

// $secret = "EOd0AM-KBG6c-iDtOrHzfZ2d88yZcxmLNMPA8HhRj49S5YyyLRY2CQ-MP0KHfC0cJnAhatp6RxoehR6t";

 

$clientId = "AeRPxcF9WRbxlEnMB68u3LFJIzDWRaJz7Uph7ytlnt2nq6_EeiNYyWxMjjYgPxySilwrVi3gImz08zjG";

$secret = "EPzZfLujewSmfpRg-wl7fGg4fbAwMccJAuS-n84biuu-jTe-v1TffASXiG04SeZ1XBqFLMYtbuQ_B-eA";

 

curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token");

curl_setopt($ch, CURLOPT_HEADER, false);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_SSLVERSION , 6); //NEW ADDITION

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_USERPWD, $clientId.":".$secret);

curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");

$result = curl_exec($ch);

 

if(empty($result))die("Error: No response.");

else

{

//print_r($result);exit;

$json = json_decode($result);

//return $json->access_token;

print_r($json->access_token);

}

 

curl_close($ch); //THIS CODE IS NOW WORKING!

}

 

function check (){

$txnid = "4R158924KP188932X";

$token = gen_access_token();

$headers = array();

$headers[] = "Content-Type:application/json";

//$headers[]='Accept: application/json',

$headers[]="Authorization:Bearer ".$token;

$url ="https://api.sandbox.paypal.com/v1/reporting/transactions?transaction_id=".$txnid."&fields=all&page_s...

//echo "reached"; exit;

$ch = curl_init();

curl_setopt($ch, CURLOPT_SSLVERSION , 6); //NEW ADDITION

curl_setopt($ch, CURLOPT_HEADER, false);

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_TIMEOUT, 30);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

if (curl_errno($ch)) {

echo 'Error: ' . curl_error($ch);

}

print_r($result);exit;

curl_close($ch); //THIS CODE IS NOW WORKING!

}

 

//check();

gen_access_token();

?>

################RESPONSE RECEIVED : IS ###############

 

{"transaction_details":[],"account_number":"K8XQ97WHABRKG","start_date":"2020-03-20T07:00:00+0000","end_date":"2020-04-20T00:59:59+0000","last_refreshed_datetime":"2020-04-20T00:59:59+0000","page":1,"total_items":0,"total_pages":0,"links":[{"href":"https://api.sandbox.paypal.com/v1/reporting/transactions?transaction_id=4R158924KP188932X&fields=all..."}]}

 

##############################################

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.