Payguru Platformuna yapılmış olan ödemelerin yine Payguru Platformu aracılığı ile iade ve geri ödemelerini gerçekleştiren servislerdir. Payguru platformundaki tüm iade süreçleri, aşağıdaki API bileşenleri kullanılarak üye işyeri tarafından başlatılır ve tüm entegrasyonda İşlem Kodu ana taşıyıcı bilgi parçası olarak kullanılır.
Pazaryeri uygulamalarında gerekli olacak "parçalı iade" yapısı temel olarak aynı bileşenleri içerse de gerekli olan ekstra parametreler ve bigliler entagrasyon sürecinde Payguru tarafından üye iş yeri ile paylaşılacaktır
Payguru tarafından iade sürecinde her bir iade işlemi için ayrı ayrı yaratılmış ve üye iş yeri ile paylaşılmış olan iade kodu (refund id) kullanılarak söz konusu iade işlemi ile ilgili detay bilgilerin üye iş yeri tarafından sorgulanmasını sağlayan servistir.
https://api.payguru.com/phs/refund/get
GET yada POST
Field | Type | Description |
---|---|---|
merchant | Integer - Required | Merchant ID |
token | String - Required | Token |
Field | Type | Description |
---|---|---|
id | Integer - Required | Refund ID |
Field | Type | Description |
---|---|---|
status | String | Status Code: 000 |
message | String | Message |
data | Array[] | Refund Detail |
-id | String | ID |
-merchant | String | Merchant ID |
-service | String | Service ID |
-service_code | String | Service ID |
-transaction_id | String | Transaction ID |
-status | String | Refund Status #See |
-create_time | String | Create Time |
-update_time | String | Update Time |
-refund_time | String | Refund Time |
-amount | String | Amount |
-refund_contact | String | Contact Name |
-refund_iban | String | Contact IBAN |
-bank_id | String | Bank ID |
-bank_name | String | Bank ID |
-bank_no | String | Bank ID |
-bank_receipt_no | String | Bank Receipt No |
Field | Type | Description |
---|---|---|
status | String | Status Code: #See |
message | String | Message |
{
"status": "000",
"message": "Success",
"data": {
"id": 13,
"merchant_name": "PAYGURU DEMO",
"merchant_id": 1,
"service_name": "DEMO",
"service_id": 4,
"transaction_id": 28120,
"status": 1,
"create_time": "2018-01-18 13:48:39",
"update_time": null,
"refund_time": null,
"amount": "0.50",
"update_userid": null,
"requested_by": null,
"description": null,
"note": null,
"refund_contact": "Erdinç Karaman",
"refund_iban": "TR800011100000000036888459",
"bank_id": null,
"bank_name": null,
"bank_code": null,
"bank_receipt_no": null
}
}
{
"status": "ERR_005",
"message": "Invalid Service"
}
curl -X GET -H "token: {3E53E639-5173-D1B6-9368-68FCBCF72342}" -H "merchant: 123" --globoff "https://api.payguru.com/phs/refund/get?id=12345"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/refund/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/refund/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["data"]["id"]);
} else {
MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/refund/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["data"]["id"]
else:
print o["message"]
else:
print "Request Error"
Payguru tarafından iade sürecine sokulmuş tüm sipariş ve işlemlerin işlem kodu (order) aracılığı ile üye iş yeri tarafından sorgulanmasına imkan veren servistir. Pazar yeri uygulamalarında aynı işlem kodu birden fazla alt üye iş yerinin birden fazla siparişini içerebileceğinden sorgulama sonucu birden fazla iade işlemi olabilir.
https://api.payguru.com/phs/refund/getByOrder
GET yada POST
Field | Type | Description |
---|---|---|
merchant | Integer - Required | Merchant ID |
token | String - Required | Token |
Field | Type | Description |
---|---|---|
order | String - Required | Merchant Order |
Field | Type | Description |
---|---|---|
status | String | Status Code: 000 |
message | String | Message |
data | Array[] | Refunds Detail |
-id | String | ID |
-merchant | String | Merchant ID |
-service | String | Service ID |
-service_code | String | Service ID |
-transaction_id | String | Transaction ID |
-status | String | Refund Status #See |
-create_time | String | Create Time |
-update_time | String | Update Time |
-refund_time | String | Refund Time |
-amount | String | Amount |
-refund_contact | String | Contact Name |
-refund_iban | String | Contact IBAN |
-bank_id | String | Bank ID |
-bank_name | String | Bank ID |
-bank_no | String | Bank ID |
-bank_receipt_no | String | Bank Receipt No |
Field | Type | Description |
---|---|---|
status | String | Status Code: #See |
message | String | Message |
{
"status": "000",
"message": "Success",
"data": [
{
"id": 13,
"merchant_name": "PAYGURU DEMO",
"merchant_id": 1,
"service_name": "DEMO",
"service_id": 4,
"transaction_id": 28120,
"status": 1,
"create_time": "2018-01-18 13:48:39",
"update_time": null,
"refund_time": null,
"amount": "0.50",
"requested_by": null,
"description": null,
"note": null,
"refund_contact": "Payguru Test",
"refund_iban": "TR12345678",
"bank_id": null,
"bank_name": null,
"bank_code": null,
"bank_receipt_no": null
},
{
"id": 14,
"merchant_name": "PAYGURU DEMO",
"merchant_id": 1,
"service_name": "DEMO",
"service_id": 4,
"transaction_id": 28120,
"status": 2,
"create_time": "2018-01-18 15:09:08",
"update_time": "2018-01-19 15:09:08",
"refund_time": null,
"amount": "0.40",
"requested_by": null,
"description": null,
"note": null,
"refund_contact": "Payguru Test",
"refund_iban": "TR12345678",
"bank_id": null,
"bank_name": null,
"bank_code": null,
"bank_receipt_no": null
},
{
"id": 15,
"merchant_name": "PAYGURU DEMO",
"merchant_id": 1,
"service_name": "DEMO",
"service_id": 4,
"transaction_id": 28120,
"status": 3,
"create_time": "2018-01-18 15:09:08",
"update_time": "2018-01-19 15:09:08",
"refund_time": "2018-01-19 09:00:00",
"amount": "5",
"requested_by": null,
"description": "Complated at 09:00",
"note": null,
"refund_contact": "Payguru Test",
"refund_iban": "TR12345678",
"bank_id": 1,
"bank_name": "Ziraat",
"bank_code": "ziraatbank",
"bank_receipt_no": "DEKONT1234"
}
]
}
{
"status": "ERR_005",
"message": "Invalid Service"
}
curl -X GET -H "token: {3E53E639-5173-D1B6-9368-68FCBCF72342}" -H "merchant: 123" --globoff "https://api.payguru.com/phs/refund/getByOrder?order=12345"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/refund/getByOrder";
$data = [
"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/refund/getByOrder?order=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/refund/getByOrder"
querystring = {"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["data"][0]["id"]
else:
print o["message"]
else:
print "Request Error"
Üye iş yeri tarafından Payguru platformunda gerçekleşmiş ve "henüz kapatılmamış veya ilgili tedarik süreci henüz finalize olmamış" ödeme işlemlerinin iade süreçlerini başlatan web servisidir.
https://api.payguru.com/phs/refund/create
GET yada POST
Field | Type | Description |
---|---|---|
merchant | Integer - Required | Merchant ID |
token | String - Required | Token |
Field | Type | Description |
---|---|---|
code | String - Required | Service Code |
amount | String - Required | Amount |
order | String - Required | Merchant Order |
contact | Array[] - Required | Contact Fields |
-name | String - Required | Name |
-iban | String - Required | IBAN |
Field | Type | Description |
---|---|---|
status | String | Status Code: 000 |
message | String | Message |
refund_id | Integer | Payguru Refund ID |
Field | Type | Description |
---|---|---|
status | String | Status Code: #See |
message | String | Message |
{
"status": "000",
"message": "Success",
"refund_id": "123412345678",
}
{
"status": "ERR_005",
"message": "Invalid Service"
}
curl -X GET -H "token: {3E53E639-5173-D1B6-9368-68FCBCF72342}" -H "merchant: 123" --globoff "https://api.payguru.com/phs/refund/create?code=XXX&order=ORDER&contact[name]=Qwe ASD&contact[iban]=TR12345671234567&amount=1.00"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/refund/create";
$data = [
"code"=>"XXX",
"order"=>"ORDER",
"contact"=>["name"=>"Qwe ASD","iban"=>"TR12345671234567"],
"amount"=>1.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 json_decode($response,true)["refund_id"];
}
var client = new RestClient("https://api.payguru.com/phs/refund/create?code=XXX&order=ORDER&contact[name]=QweASD&contact[iban]=TR12345671234567&amount=1.00");
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["refund_id"]);
} else {
MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/refund/create"
querystring = {"code":"XXX","order":"ORDER","contact[name]":"Qwe ASD","contact[iban]":"TR12345671234567","amount":"1.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"][0]["id"]
else:
print o["message"]
else:
print "Request Error"
Gün sonunda her bir iade talebinin sonucunu toplu olarak üye iş yerine ileten bildirim servisidir. Banka aracılığıyla Payguru platformundan yapılan iadelerin tamamının durumunu üye iş yerine bildirir.
http://yoursite.com/PhsRefundNotifyService
GET yada POST/JSON
Notify Key: md5( Service code + Merchant ID + Refund ID + Payguru Reference Code(Code In Request) + Order RefNo + Amount + Bank Code + Merchant Private Key + Service Private Key)
Field | Type | Description |
---|---|---|
refund_id | Integer | Refund ID |
code | String | Payguru Order |
order | String | Merchant Order |
status | Integer | Refund Status #See |
amount | Float | Refund Amount |
refund_contact | String | Refund Contact Name |
refund_iban | String | Refund Contact IBAN |
refund_date | Date | Refund Date |
create_time | Date | Refund Request Date |
bank_no | Integer | Bank No |
bank_id | Integer | Bank ID |
bank_name | String | Bank Name |
bank_code | String | Bank Code |
bank_receipt_no | String - Required | Bank Receipt No |
key | String - Required | Refund Notify Key #See |
<?
$data = $_GET;
//$data["refund_id"] = Refund ID
//$data["code"] = Transaction Code
//$data["order"] = Order Refno
//$data["status"] = Refund Status
//$data["amount"] = Refund Amount
//$data["refund_contact"] = Refund Contact Name
//$data["refund_iban"] = Refund Contact IBAN
//$data["refund_date"] = Refund Date
//$data["create_time"] = Refund Request Date
//$data["bank_no"] = Bank No
//$data["bank_id"] = Bank ID
//$data["bank_name"] = Bank Name
//$data["bank_code"] = Bank Code
//$data["bank_receipt_no"] = Bank Receipt No
//$data["key"] = Notify Key
$localKey = md5("Service Code"."Merchant ID".$data["refund_id"].$data["code"].$data["order"].$data["amount"].$data["bank_code"]."Merchant Private Key"."Service Private Key");
if($localKey = $data["key"]){
echo "OK";//If you accept this request, you must response with "OK"
//find transaction with order
}else{
echo "Wrong Data";
}
<?
$data = json_decode(file_get_contents("php://input"),true);
//$data["refund_id"] = Refund ID
//$data["code"] = Transaction Code
//$data["order"] = Order Refno
//$data["status"] = Refund Status
//$data["amount"] = Refund Amount
//$data["refund_contact"] = Refund Contact Name
//$data["refund_iban"] = Refund Contact IBAN
//$data["refund_date"] = Refund Date
//$data["create_time"] = Refund Request Date
//$data["bank_no"] = Bank No
//$data["bank_id"] = Bank ID
//$data["bank_name"] = Bank Name
//$data["bank_code"] = Bank Code
//$data["bank_receipt_no"] = Bank Receipt No
//$data["key"] = Notify Key
$localKey = md5("Service Code"."Merchant ID".$data["refund_id"].$data["code"].$data["order"].$data["amount"].$data["bank_code"]."Merchant Private Key"."Service Private Key");
if($localKey = $data["key"]){
echo "OK";//If you accept this request, you must response with "OK"
//find transaction with order
}else{
echo "Wrong Data";
}