Transactions
Those are the services that can be used by the merchant in order to "query" the Payguru Platform for a single transaction or for a group of transaction with a certain criteria. The same service group is used by the merchant in order to send the "order completed" notification to Payguru Platforms.
All the transaction records in Payguru Platform are created once the notification for the corresponding payment is received by Payguru through its integration with the banks.
Get
>URL
https://api.payguru.com/phs/transaction/get
>HTTP Method
GET or POST
>Headers
Field | Type | Description |
---|
merchant | Integer - Required | Merchant ID |
token | String - Required | Token |
>Parameters
Field | Type | Description |
---|
id | Integer - Required | Transaction ID |
>Success
Field | Type | Description |
---|
status | String | Status Code: 000 |
message | String | Message |
transaction | Array[] | Transaction Detail |
-id | String | ID |
-merchant | String | Merchant ID |
-merchant_name | String | Merchant Name |
-bank_id | String | Bank ID |
-bank_code | String | Bank Code |
-bank_name | String | Bank Name |
-service_id | String | Service ID |
-service_name | String | Service Name |
-service_code | String | Service Code |
-code | String | Code |
-amount | String | Amount |
-currency | String | Currency |
-user_name | String | User Name |
-order_refno | String | Order RefNo |
-remote_bank | String | Remote Bank |
-remote_description | String | Remote Description |
-transaction_date | String | Transaction Time Format:YYYY-MM-DD HH:II:SS |
-transaction_type | String | Transaction Type |
-create_time | String | Create Time Format:YYYY-MM-DD HH:II:SS |
-status | String | Transaction Status #See |
>Error
Field | Type | Description |
---|
status | String | Status Code: #See |
message | String | Message |
>Response Examples
{
"status": "000",
"message": "Success",
"transaction": {
"id": 12345,
"merchant": 123,
"merchant_name": "XXXX",
"bank_id": 4,
"bank_code": "isbank",
"bank_name": "İş Bankası",
"service_id": 1,
"service_name": "XXXXX",
"service_code": "xxxx",
"code": "XXXX01234567",
"amount": "1.00",
"currency": "TL",
"user_name": null,
"order_refno": "01234567",
"remote_bank": null,
"remote_description": "TEST İCİN REF NO XXXX01234567",
"transaction_date": "2017-03-06 16:37:09",
"transaction_type": null,
"create_time": "2017-03-06 16:37:09",
"status": 5
}
}
{
"status": "ERR_005",
"message": "Invalid Service"
}
>Sample Codes
curl -X GET -H "token: {3E53E639-5173-D1B6-9368-68FCBCF72342}" -H "merchant: 123" --globoff "https://api.payguru.com/phs/transaction/get?id=12345"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/transaction/get";
$data = [
"id"=>"12345",
];
$headers = [
"token: {3E53E639-5173-D1B6-9368-68FCBCF72342}",
"merchant: 123"
];
curl_setopt_array($curl, array(
CURLOPT_URL => $url."?".http_build_query($data),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://api.payguru.com/phs/transaction/get?id=12345");
var request = new RestRequest(Method.GET);
request.AddHeader("merchant", "123");
request.AddHeader("token", "{3E53E639-5173-D1B6-9368-68FCBCF72342}");
IRestResponse response = client.Execute(request);
var o = JObject.Parse(response);
if (o["status"] == "000") {
MessageBox.Show((string)o["transaction"]["id"]);
} else {
MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/transaction/get"
querystring = {"id":"12345"}
headers = {
"token": "{3E53E639-5173-D1B6-9368-68FCBCF72342}",
"merchant": "123"
}
response = requests.request("GET", url, headers=headers, params=querystring)
if response.status_code == 200:
o = json.loads(response.text)
if o["status"] == "000":
print o["transaction"]["id"]
else:
print o["message"]
else:
print "Request Error"
Order Complete
>URL
https://api.payguru.com/phs/transaction/order-complete
>HTTP Method
GET or POST
>Headers
Field | Type | Description |
---|
merchant | Integer - Required | Merchant ID |
token | String - Required | Token |
>Parameters
Field | Type | Description |
---|
code | String - Required | Service Code |
order | String - Required | Merchant Order |
>Success
Field | Type | Description |
---|
status | String | Status Code: 000 |
message | String | Message |
>Error
Field | Type | Description |
---|
status | String | Status Code: #See |
message | String | Message |
>Response Examples
{
"status": "000",
"message": "Success",
}
{
"status": "ERR_005",
"message": "Invalid Service"
}
>Örnek Kodlar
curl -X GET -H "token: {3E53E639-5173-D1B6-9368-68FCBCF72342}" -H "merchant: 123" --globoff "https://api.payguru.com/phs/transaction/order-complate?code=XXX&order=12345"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/transaction/order-complete";
$data = [
"code"=>"XXX",
"order"=>"12345",
];
$headers = [
"token: {3E53E639-5173-D1B6-9368-68FCBCF72342}",
"merchant: 123"
];
curl_setopt_array($curl, array(
CURLOPT_URL => $url."?".http_build_query($data),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://api.payguru.com/phs/transaction/order-complete?code=XXXorder=12345");
var request = new RestRequest(Method.GET);
request.AddHeader("merchant", "123");
request.AddHeader("token", "{3E53E639-5173-D1B6-9368-68FCBCF72342}");
IRestResponse response = client.Execute(request);
var o = JObject.Parse(response);
if (o["status"] == "000") {
MessageBox.Show((string)o["message"]);
} else {
MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/transaction/order-complete"
querystring = {"code":"XXX","order":"12345"}
headers = {
"token": "{3E53E639-5173-D1B6-9368-68FCBCF72342}",
"merchant": "123"
}
response = requests.request("GET", url, headers=headers, params=querystring)
if response.status_code == 200:
o = json.loads(response.text)
if o["status"] == "000":
print o["transaction"]["id"]
else:
print o["message"]
else:
print "Request Error"
Search
>URL
https://api.payguru.com/phs/transaction/search
>HTTP Method
GET or POST
>Headers
Field | Type | Description |
---|
merchant | Integer - Required | Merchant ID |
token | String - Required | Token |
>Parameters
Field | Type | Description |
---|
code | String - Required | Service Code |
start | Integer - Optionally | Default:0 |
length | Integer - Optionally | Deafult:100 |
Transaction[startDate] | String - Optionally | Format: YYYY-MM-DD |
Transaction[endDate] | String - Optionally | Format: YYYY-MM-DD - startDate +1 Day |
Transaction[status] | Integer/Array - Optionally | Transaction Status Code: #See |
Transaction[bank_id] | Integer/Array - Optionally | Bank List: #See |
Transaction[amount] | Decimal/Array - Optionally | Format: ####.## |
con_operator supports <,>,>=,<=
>Success
Field | Type | Description |
---|
status | String | Status Code: 000 |
message | String | Message |
recordsTotal | String | Total Count |
recordsFiltered | String | Filtered Count |
start | String | Start |
length | String | Length |
data | Array[] | Transaction List |
-id | String | Transaction ID |
-merchant | String | Merchant ID |
-merchant_name | String | Merchant Name |
-bank_id | String | Bank ID |
-bank_name | String | Bank Name |
-bank_code | String | Bank Code |
-service_id | String | Service ID |
-service_name | String | Service Name |
-service_code | String | Service Code |
-code | String | Reference Code |
-amount | String | Amount |
-currency | String | Currency: TL |
-ref_no | String | Refno |
-user_name | String | Sender Name |
-order_refno | String | Merchant Order Refno |
-remote_bank | String | Remote Bank |
-remote_description | String | Remote Description |
-transaction_date | Date | Format: YYYY-MM-DD H:i:s |
-transaction_type | Integer | Transaction Type |
-create_time | Date | Format: YYYY-MM-DD H:i:s |
>Error
Field | Type | Description |
---|
status | String | Status Code: #See |
message | String | Message |
>Response Examples
{
"status": "000",
"message": "Success",
"recordsTotal": 1,
"recordsFiltered": 1,
"start": 0,
"length": 100,
"data": [
{
"id": 1,
"merchant": 1,
"merchant_name": "Payguru",
"bank_id": 1,
"bank_name": "Ziraat",
"bank_code": "ziraatbank",
"service_id": 1,
"service_name": "Demo",
"service_code": "Demo",
"code": "1212121212",
"amount": "1.00",
"currency": "TL",
"ref_no": null,
"user_name": "Payguru Demo",
"order_refno": "demo1234",
"remote_bank": null,
"remote_description": "1212121212",
"transaction_date": "2020-01-20 10:07:09+03",
"transaction_type": 8,
"create_time": "2020-01-20 10:08:02+03"
}
]
}
{
"status": "ERR_005",
"message": "Invalid Service"
}
>Örnek Kodlar
curl -X GET -H "token: {3E53E639-5173-D1B6-9368-68FCBCF72342}" -H "merchant: 123" --globoff "https://api.payguru.com/phs/transaction/search?code=demo&Transaction%5BstartDate%5D=2020-01-20&Transaction%5BendDate%5D=2020-01-21&Transaction%5Bstatus%5D=3&Transaction%5Bbank_id%5D=1&Transaction%5Bamount%5D%5Bcon_operator%5D=%3D&Transaction%5Bamount%5D%5Bvalue%5D=21.00&Transaction%5Btransaction_date%5D%5Bcon_operator%5D=%3E%3D&Transaction%5Btransaction_date%5D%5Bvalue%5D=2020-01-20%2009%3A00%3A00"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/transaction/search";
$data = [
"code"=>"XXX",
"Transaction" => [
"startDate" => "2020-01-20",
"endDate" => "2020-01-21",
"status" => "",
"bank_id" => [1,6,8],
"amount" => [
"con_operator"=>">=",
"value"=>21.00
],
"transaction_date" => [
"con_operator"=>">=",
"value"=>"2020-01-20 09:00:00"
],
]
];
$headers = [
"token: {3E53E639-5173-D1B6-9368-68FCBCF72342}",
"merchant: 123"
];
curl_setopt_array($curl, array(
CURLOPT_URL => $url."?".http_build_query($data),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response["data"];
}
var client = new RestClient("https://api.payguru.com/phs/transaction/search?code=demo&Transaction%5BstartDate%5D=2020-01-20&Transaction%5BendDate%5D=2020-01-21&Transaction%5Bstatus%5D=3&Transaction%5Bbank_id%5D=1&Transaction%5Bamount%5D%5Bcon_operator%5D=%3D&Transaction%5Bamount%5D%5Bvalue%5D=21.00&Transaction%5Btransaction_date%5D%5Bcon_operator%5D=%3E%3D&Transaction%5Btransaction_date%5D%5Bvalue%5D=2020-01-20%2009%3A00%3A00");
var request = new RestRequest(Method.GET);
request.AddHeader("merchant", "123");
request.AddHeader("token", "{3E53E639-5173-D1B6-9368-68FCBCF72342}");
IRestResponse response = client.Execute(request);
var o = JObject.Parse(response);
if (o["status"] == "000") {
MessageBox.Show((string)o["message"]);
} else {
MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/transaction/search"
querystring = {"code":"XXX","Transaction[startDate]":"2020-01-20","Transaction[endDate]":"2020-01-21","Transaction[status]":"3","Transaction[bank_id]":"1","Transaction[amount][con_operator]":"=","Transaction[amount][value]":"21.00","Transaction[transaction_date][con_operator]":">=","Transaction[transaction_date][value]":"2020-01-20 09:00:00"}
headers = {
"token": "{3E53E639-5173-D1B6-9368-68FCBCF72342}",
"merchant": "123"
}
response = requests.request("GET", url, headers=headers, params=querystring)
if response.status_code == 200:
o = json.loads(response.text)
if o["status"] == "000":
print o["data"]
else:
print o["message"]
else:
print "Request Error"