Order Lookup

Those are the services to be used in the scenarios when the merchant wants to share a separate shopping order in its system as an identifier for the payment. The merchant may trigger an order code generation process in the Payguru Platform for each shopping order in its system or may push its shopping order as an order code by using those services. Those services brings flexibility to the merchant in order to create a smooth shopping and purchasing experience for their customers by providing them a single "code" for both the payment and purchase.

Check

It is the service that queries whether a particular transaction code is registered in Payguru Platform.

>URL
 https://api.payguru.com/phs/orderToReference/check
>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
orderStringPayguru Order
payoutStringFor Market Place
sub_merchant_idStringFor Market Place
feeAmountFor Market Place

>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>Response Examples
{
  "status": "000",
  "message": "Success",
  "order": "123412345678"
}
{
    "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/orderToReference/check?code=XXX&order=ORDER"
<?php

$curl = curl_init();
$url = "https://api.payguru.com/phs/orderToReference/check";
$data = [
    "code" => "XXX",
    "order" => "ORDER",
];
$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)["order"];
}
var client = new RestClient("https://api.payguru.com/phs/orderToReference/check?code=XXX&order=ORDER");
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["order"]);
} else {
    MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/orderToReference/check"
querystring = {"code":"XXX","order":"ORDER"}
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["order"]
    else:
        print o["message"]
else:
    print "Request Error"

Create

It is the web service for the merchant to create an order code into the Payguru Platforms.

>URL
 https://api.payguru.com/phs/orderToReference/create
>HTTP Method
GET or POST
>Headers
FieldTypeDescription
merchantInteger - RequiredMerchant ID
tokenString - RequiredToken
>Parameters
FieldTypeDescription
codeString - RequiredService Code
amountString - RequiredAmount
orderString - RequiredMerchant Order
payoutString - OptionallyRequired For Market Place
sub_merchant_idInteger - OptionallyRequired For Market Place
feeAmount - OptionallyRequired For Market Place
user_idString - OptionallyMax:32

>Success
FieldTypeDescription
statusStringStatus Code: 000
messageStringMessage
orderStringPayguru Order

>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>Respone Examples
{
    "status": "000",
    "message": "Success",
    "order": "123412345678",
}
{
    "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/orderToReference/create?code=XXX&order=ORDER&amount=1.00"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/orderToReference/create";
$data = [
    "code"=>"XXX",
    "order"=>"ORDER",
    "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)["order"];
}
var client = new RestClient("https://api.payguru.com/phs/orderToReference/create?code=XXX&order=ORDER&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["order"]);
} else {
    MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/orderToReference/create"
querystring = {"code":"XXX", "order":"ORDER", "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["order"]
    else:
        print o["message"]
else:
    print "Request Error"

Direct

This is the service to be used by the merchant when all the information related to the payment is being delivered by Payguru Payment Page, not the merchant interface. Merchant calls this service in order to invoke the Payguru Payment Page where the order code is shared with the customer.

>URL
 https://api.payguru.com/phs/orderToReference/direct
>HTTP Method
GET or POST
>Headers
FieldTypeDescription
merchantInteger - RequiredMerchant ID
tokenString - RequiredToken
>Parameters
FieldTypeDescription
codeString - RequiredService Code
amountString - RequiredAmount
orderString - RequiredMerchant Order
payoutString - OptionallyRequired For Market Place
sub_merchant_idInteger - OptionallyRequired For Market Place
feeAmount - OptionallyRequired For Market Place
user_idString - OptionallyMax:32
PaymentNotificationArray[]PaymentNotification Fields
-tc_noStringTCKN
-nameStringName
-emailStringEmail
-phoneStringMobile Phone
-user_ipStringUser IP
-apply_timeDateApply Time Format:YYYY-MM-DD HH:II:SS
-descriptionStringDescription

>Success
FieldTypeDescription
statusStringStatus Code: 000
messageStringMessage
codeStringPayguru Order

Please forward to "https://cp.payguru.com/phs/banks/{CODE}?redirect=SUCCESS_URL&backUrl=BACK_URL" with the code in response.
Redirect parameters are optional


>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>Response Examples
{
    "status": "000",
    "message": "Success",
    "code": "123412345678",
}
{
    "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/orderToReference/direct?code=XXX&order=ORDER&amount=1.00"
<?php
$curl = curl_init();
$url = "https://api.payguru.com/phs/orderToReference/direct";
$data = [
    "code"=>"XXX",
    "order"=>"ORDER",
    "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)["code"];
}
var client = new RestClient("https://api.payguru.com/phs/orderToReference/direct?code=XXX&order=ORDER&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["code"]);
} else {
    MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/orderToReference/direct"
querystring = {"code":"XXX", "order":"ORDER", "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["code"]
    else:
        print o["message"]
else:
    print "Request Error"

Update

>URL
 https://api.payguru.com/phs/orderToReference/update
>HTTP Method
GET or POST
>Headers
FieldTypeDescription
merchantInteger - RequiredMerchant ID
tokenString - RequiredToken
>Parameters
FieldTypeDescription
codeString - RequiredService Code
orderString - RequiredMerchant Order
amountString - RequiredAmount
payoutString - OptionallyRequired For Market Place
sub_merchant_idInteger - OptionallyRequired For Market Place
feeAmount - OptionallyRequired For Market Place

>Success
FieldTypeDescription
statusStringStatus Code: 000
messageStringMessage
orderStringPayguru Order

>Error
FieldTypeDescription
statusStringStatus Code: #See
messageStringMessage

>Response Examples
{
  "status": "000",
  "message": "Success",
  "order": "123412345678"
}
{
    "status": "ERR_005",
    "message": "Invalid Service"
}
{
  "status": "000",
  "message": "Success",
  "order": "123412345678"
}
{
    "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/orderToReference/update?code=XXX&order=ORDER&amount=1.00"
<?php

$curl = curl_init();
$url = "https://api.payguru.com/phs/orderToReference/update";
$data = [
    "code" => "XXX",
    "order" => "ORDER",
    "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)["order"];
}
var client = new RestClient("https://api.payguru.com/phs/orderToReference/update?code=XXX&order=ORDER&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["order"]);
} else {
    MessageBox.Show((string)o["message"]);
}
import requests,json
url = "https://api.payguru.com/phs/orderToReference/update"
querystring = {"code":"XXX","order":"ORDER","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["order"]
    else:
        print o["message"]
else:
    print "Request Error"