12. Payment Inquiry
Payment Inquiry
Payment Inquiry
GET
{{Base Address}}/api/paywall/private/query
Important: To use the Payment Inquiry service, you need to send the 'apikeyprivate' and 'apiclientprivate' parameters in the 'Header' section. PaymentAPI Address
apikeyprivate
string
Yes
The Public Key obtained from the merchant panel.
apiclientprivate
string
Yes
The Public Client obtained from the merchant panel.
merchantuniquecode
string
Yes
The unique tracking code provided by your side for the payment.
Example codes:
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class Program
{
private static readonly HttpClient client = new HttpClient();
private static async Task Main()
{
client.DefaultRequestHeaders.Add("apikeyprivate", "%PRIVATEKEY%");
client.DefaultRequestHeaders.Add("apiclientprivate", "%PRIVATECLIENT%");
client.DefaultRequestHeaders.Add("merchantuniquecode", "%MerchantUniqueCode%");
var response = await client.GetAsync("{{Private Base Address}}/api/paywall/private/query");
var responseString = await response.Content.ReadAsStringAsync();
var responseObject = JsonConvert.DeserializeObject<Response>(responseString);
Console.WriteLine(responseObject.Body.Paywall.StatusName);
}
public class Response
{
public int ErrorCode { get; set; }
public bool Result { get; set; }
public string Message { get; set; }
public Body Body { get; set; }
}
public class Body
{
public Paywall Paywall { get; set; }
}
public class Paywall
{
public int PaymentId { get; set; }
public int ActivityId { get; set; }
public bool Status { get; set; }
public string StatusName { get; set; }
// Define other properties as needed...
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"encoding/json"
)
type Response struct {
ErrorCode int `json:"ErrorCode"`
Result bool `json:"Result"`
Message string `json:"Message"`
Body struct {
Paywall struct {
PaymentId int `json:"PaymentId"`
// Add the other fields as necessary...
} `json:"Paywall"`
} `json:"Body"`
}
func main() {
url := "{{Private Base Address}}/api/paywall/private/query"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("apikeyprivate", "%PRIVATEKEY%")
req.Header.Set("apiclientprivate", "%PRIVATECLIENT%")
req.Header.Set("merchantuniquecode", "%MerchantUniqueCode%")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var response Response
json.Unmarshal(body, &response)
fmt.Println(response.Body.Paywall.PaymentId)
}
import java.net.http.HttpClient;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.URI;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
class Response {
@SerializedName("ErrorCode")
int errorCode;
@SerializedName("Result")
boolean result;
@SerializedName("Message")
String message;
@SerializedName("Body")
Body body;
}
class Body {
@SerializedName("Paywall")
Paywall paywall;
}
class Paywall {
@SerializedName("PaymentId")
int paymentId;
// Add the other fields as necessary...
}
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("{{Private Base Address}}/api/paywall/private/query"))
.setHeader("apikeyprivate", "%PRIVATEKEY%")
.setHeader("apiclientprivate", "%PRIVATECLIENT%")
.setHeader("merchantuniquecode", "%MerchantUniqueCode%")
.GET()
.build();
var response = client.send(request, BodyHandlers.ofString());
Gson gson = new Gson();
Response responseObject = gson.fromJson(response.body(), Response.class);
System.out.println(responseObject.body.paywall.paymentId);
}
}
<?php
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n" .
"apikeyprivate: %PRIVATEKEY%\r\n" .
"apiclientprivate: %PRIVATECLIENT%\r\n" .
"merchantuniquecode: %MerchantUniqueCode%\r\n",
'method' => 'GET',
),
);
$url = '{{Private Base Address}}/api/paywall/private/query';
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
// Decode
$response = json_decode($result);
// Print PaymentId
echo "PaymentId: " . $response->Body->Paywall->PaymentId . "\n";
?>
import requests
import json
headers = {
'apikeyprivate': '%PRIVATEKEY%',
'apiclientprivate': '%PRIVATECLIENT%',
'merchantuniquecode': '%MerchantUniqueCode%',
'Content-Type': 'application/json',
}
response = requests.get('{{Private Base Address}}/api/paywall/private/query', headers=headers)
response_json = response.json()
# Print PaymentId
print('PaymentId:', response_json['Body']['Paywall']['PaymentId'])
require 'net/http'
require 'json'
uri = URI('{{Private Base Address}}/api/paywall/private/query')
req = Net::HTTP::Get.new(uri)
req['apikeyprivate'] = '%PRIVATEKEY%'
req['apiclientprivate'] = '%PRIVATECLIENT%'
req['merchantuniquecode'] = '%MerchantUniqueCode%'
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') {|http|
http.request(req)
}
# Parse and print PaymentId
response_json = JSON.parse(res.body)
puts "PaymentId: #{response_json['Body']['Paywall']['PaymentId']}"
import axios, { AxiosResponse } from 'axios';
interface Response {
ErrorCode: number;
Result: boolean;
Message: string;
Body: {
Paywall: {
PaymentId: number;
// Add other properties as needed...
}
}
}
const headers = {
'apikeyprivate': '%PRIVATEKEY%',
'apiclientprivate': '%PRIVATECLIENT%',
'merchantuniquecode': '%MerchantUniqueCode%',
};
axios.get<Response>('{{Private Base Address}}/api/paywall/private/query', { headers })
.then((response: AxiosResponse<Response>) => {
console.log(response.data.Body.Paywall.PaymentId);
});
curl -X GET '{{Private Base Address}}/api/paywall/private/query' \
-H 'apikeyprivate: %PRIVATEKEY%' \
-H 'apiclientprivate: %PRIVATECLIENT%' \
-H 'merchantuniquecode: %MerchantUniqueCode%' \
Response From The service:
PaymentId
int
Payment ID
ActivityId
int
Payment Last Transaction ID
Status
boolean
Last Transaction Status, true: successful / false: unsuccessful
StatusName
string
Payment Status
StatusId
int
Payment Status ID
TypeName
string
Payment Last Transaction Type
TypeId
int
Payment Last Transaction Type Identifier
Installment
int
Installment Information
CurrencyId
int
Payment Currency Identifier
CurrencyName
string
Payment Currency
PaymentMethodId
int
Payment Method Identifier
PaymentMethod
string
Payment Method
PaymentChannelId
int
Payment Channel Identifie
PaymentChannelName
string
Payment Channel
PaymentTagId
int
Payment Tag Identifier
PaymentTagName
string
Payment tag
{
"ErrorCode": 0,
"Result": true,
"Message": "",
"Body": {
"Paywall": {
"PaymentId": 329659,
"ActivityId": 355097,
"Status": true,
"StatusName": "BaΕarΔ±lΔ±",
"StatusId": 4,
"TypeName": "Δ°ade",
"TypeId": 2,
"Installment": 1,
"CurrencyId": 1,
"CurrencyName": "TRY",
"PaymentMethodId": 1,
"PaymentMethodName": null,
"PaymentChannelId": 6,
"PaymentChannelName": "Checkout",
"PaymentTagId": 0,
"PaymentTagName": null,
"CardNumber": "552879******0008",
"CardOwnerName": "tes test",
"CardBankName": "T.HALK BANKASI A.Ε.",
"CardBrandName": "Master Card",
"CardTypeName": "Credit",
"CardFamilyName": "Paraf",
"LastActivityDateTime": "2023-04-10T04:05:10.8722766",
"PaymentAmount": 1.00,
"ActivityAmount": 1.00,
"IP": "3.94.21.171"
}
}
}
Last updated