الحصول على معاملة بالمرجع
curl --request GET \
--url https://api.oneclickdz.com/v3/bills/transactions/by-ref \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/bills/transactions/by-ref"
headers = {"X-Access-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/bills/transactions/by-ref', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.oneclickdz.com/v3/bills/transactions/by-ref",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Access-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.oneclickdz.com/v3/bills/transactions/by-ref"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.oneclickdz.com/v3/bills/transactions/by-ref")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/bills/transactions/by-ref")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyدفع الفواتير
الحصول على معاملة بالمرجع
العثور على معاملة انطلاقًا من ref الاكتشاف الخاص بك
GET
/
v3
/
bills
/
transactions
/
by-ref
الحصول على معاملة بالمرجع
curl --request GET \
--url https://api.oneclickdz.com/v3/bills/transactions/by-ref \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/bills/transactions/by-ref"
headers = {"X-Access-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/bills/transactions/by-ref', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.oneclickdz.com/v3/bills/transactions/by-ref",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Access-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.oneclickdz.com/v3/bills/transactions/by-ref"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.oneclickdz.com/v3/bills/transactions/by-ref")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/bills/transactions/by-ref")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyتُعيد المعاملة التي يطابق
ref الاكتشاف الخاص بها. استخدمها عندما تنتهي مهلة استدعاء discover ولا تعرف ما إذا كانت المعاملة قد أُنشئت: يعني الرمز 404 أنها لم تُنشأ، وأي نتيجة أخرى تمنحك المعاملة لتتابع انطلاقًا منها.جسم الاستجابة مطابق لـ الحصول على المعاملة بالمعرّف.لا يمكن البحث إلا بقيمة
ref الاكتشاف. قيمة ref المرسلة إلى pay لا تُخزَّن في المعاملة.معاملات الاستعلام
string
مطلوب
قيمة
ref التي أرسلتها إلى discover.string
يحصر البحث في شريك واحد. مفيد إذا كنت تعيد استخدام قيم
ref لدى عدة شركاء.مثال
curl "https://api.oneclickdz.com/v3/bills/transactions/by-ref?ref=disc-20260920-0003" \
-H "X-Access-Token: YOUR_API_KEY"
const url = new URL("https://api.oneclickdz.com/v3/bills/transactions/by-ref");
url.searchParams.set("ref", "disc-20260920-0003");
const response = await fetch(url, {
headers: { "X-Access-Token": process.env.ONECLICKDZ_API_KEY },
});
const body = await response.json();
if (response.status === 404) {
// the discovery was never created — safe to send it again with the same ref
} else if (!body.success) {
throw new Error(body.error.code);
} else {
const txn = body.data; // continue from txn.status
}
import os, requests
response = requests.get(
"https://api.oneclickdz.com/v3/bills/transactions/by-ref",
params={"ref": "disc-20260920-0003"},
headers={"X-Access-Token": os.environ["ONECLICKDZ_API_KEY"]},
)
body = response.json()
if response.status_code == 404:
pass # the discovery was never created — safe to send it again with the same ref
elif not body["success"]:
raise RuntimeError(body["error"]["code"])
else:
txn = body["data"] # continue from txn["status"]
<?php
$url = "https://api.oneclickdz.com/v3/bills/transactions/by-ref?" . http_build_query(["ref" => "disc-20260920-0003"]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-Access-Token: " . getenv("ONECLICKDZ_API_KEY")],
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$body = json_decode($raw, true);
if ($status === 404) {
// the discovery was never created — safe to send it again with the same ref
} elseif (!$body["success"]) {
throw new Exception($body["error"]["code"]);
} else {
$txn = $body["data"]; // continue from $txn["status"]
}
?>
الأخطاء
| HTTP | الرمز | المعنى |
|---|---|---|
| 400 | ERR_VALIDATION | ref مفقود أو أطول من 100 حرف؛ partner غير معروف |
| 401 | MISSING_ACCESS_TOKEN / INVALID_ACCESS_TOKEN | المفتاح مفقود أو مرفوض |
| 404 | NOT_FOUND | لا توجد معاملة بقيمة ref هذه لمفتاحك في هذه البيئة |
| 503 | AUTH_UNAVAILABLE | تعذّر التحقّق من المفتاح في الوقت المحدّد؛ أعد المحاولة بعد Retry-After |

