I want to use WePay reports API for reporting purpose to show WePay transaction and withdrawal information in my custom application . When I call Wepayreports api I have faced some issues in passing JSON Data using PHP CURL.
My Code like below:
<?php
$data = array(
"type" => "merchant_transactions",
"resource" => array(
"object_type" => "account",
"object_id" => 634303761
)
);
$ch = curl_init('https://stage.wepayapi.com/v2/report/create'); // URL of the call
CURL_SETOPT($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1a2pre) Gecko/2008073000 Shredder/3.0a2pre ThunderBrowse/3.2.1.8');
// execute the api call
$result = curl_exec($ch);
// display the json response
echo '<pre>';
print_r(json_decode($result, true));
echo '</pre>';
?>
When i am trying to call this in API Calls receive data like below
{"{\"type\":\"merchant_transactions\",\"resource\":{\"object_type\":\"account\",\"object_id\":\"1776251645\"}}":""}
But i need to send data like below:
{"type":"merchant_transactions","resource":{"object_type":"account","object_id":"1776251645"}}
For you kind reference here is the link of WePay API Documantation.WePay Reports API
If you have any other alternative solution for solving this issue please let me know.
Can anyone help me on this regards?Any kind of help appreciated. Thanks in advance.