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"