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
FieldTypeDescription
merchantInteger - RequiredMerchant ID
tokenString - RequiredToken
>Parameters
FieldTypeDescription
idInteger - RequiredTransaction ID

>Success
FieldTypeDescription
statusStringStatus Code: 000
messageStringMessage
transactionArray[]Transaction Detail
-idStringID
-merchantStringMerchant ID
-merchant_nameStringMerchant Name
-bank_idStringBank ID
-bank_codeStringBank Code
-bank_nameStringBank Name
-service_idStringService ID
-service_nameStringService Name
-service_codeStringService Code
-codeStringCode
-amountStringAmount
-currencyStringCurrency
-user_nameStringUser Name
-order_refnoStringOrder RefNo
-remote_bankStringRemote Bank
-remote_descriptionStringRemote Description
-transaction_dateStringTransaction Time Format:YYYY-MM-DD HH:II:SS
-transaction_typeStringTransaction Type
-create_timeStringCreate Time Format:YYYY-MM-DD HH:II:SS
-statusStringTransaction Status #See

>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>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
FieldTypeDescription
merchantInteger - RequiredMerchant ID
tokenString - RequiredToken
>Parameters
FieldTypeDescription
codeString - RequiredService Code
orderString - RequiredMerchant Order

>Success
FieldTypeDescription
statusStringStatus Code: 000
messageStringMessage

>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>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
FieldTypeDescription
merchantInteger - RequiredMerchant ID
tokenString - RequiredToken
>Parameters
FieldTypeDescription
codeString - RequiredService Code
startInteger - OptionallyDefault:0
lengthInteger - OptionallyDeafult:100
Transaction[startDate]String - OptionallyFormat: YYYY-MM-DD
Transaction[endDate]String - OptionallyFormat: YYYY-MM-DD - startDate +1 Day
Transaction[status]Integer/Array - OptionallyTransaction Status Code: #See
Transaction[bank_id]Integer/Array - OptionallyBank List: #See
Transaction[amount]Decimal/Array - OptionallyFormat: ####.##

con_operator supports <,>,>=,<=


>Success
FieldTypeDescription
statusStringStatus Code: 000
messageStringMessage
recordsTotalStringTotal Count
recordsFilteredStringFiltered Count
startStringStart
lengthStringLength
dataArray[]Transaction List
-idStringTransaction ID
-merchantStringMerchant ID
-merchant_nameStringMerchant Name
-bank_idStringBank ID
-bank_nameStringBank Name
-bank_codeStringBank Code
-service_idStringService ID
-service_nameStringService Name
-service_codeStringService Code
-codeStringReference Code
-amountStringAmount
-currencyStringCurrency: TL
-ref_noStringRefno
-user_nameStringSender Name
-order_refnoStringMerchant Order Refno
-remote_bankStringRemote Bank
-remote_descriptionStringRemote Description
-transaction_dateDateFormat: YYYY-MM-DD H:i:s
-transaction_typeIntegerTransaction Type
-create_timeDateFormat: YYYY-MM-DD H:i:s

>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>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"