تنزيل الإيصال
curl --request GET \
--url https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt"
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/{transactionId}/receipt', 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/{transactionId}/receipt",
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/{transactionId}/receipt"
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/{transactionId}/receipt")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt")
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دفع الفواتير
تنزيل الإيصال
ملف الإيصال الخاص بدفعة ناجحة
GET
/
v3
/
bills
/
transactions
/
{transactionId}
/
receipt
تنزيل الإيصال
curl --request GET \
--url https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt"
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/{transactionId}/receipt', 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/{transactionId}/receipt",
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/{transactionId}/receipt"
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/{transactionId}/receipt")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt")
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تُعيد إيصال معاملة بالحالة
الجسم هو الملف. اختر الامتداد وفق
SUCCESS في صورة ملف. هذه هي نقطة النهاية الوحيدة التي لا تكون استجابة النجاح فيها غلاف JSON؛ أما الأخطاء فتبقى كذلك.قيمة receiptUrl الخاصة بالمعاملة هي عنوان URL هذا.معاملات المسار
string
مطلوب
معاملة تكون قيمة
status الخاصة بها SUCCESS.الاستجابة
| الترويسة | القيمة |
|---|---|
Content-Type | application/pdf أو image/png أو image/jpeg |
Content-Disposition | attachment; filename="…" |
Content-Length | الحجم بالبايت |
Cache-Control | private, max-age=86400 |
Content-Type. إيصالات Sandbox صور PNG.مثال
curl https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt \
-H "X-Access-Token: YOUR_API_KEY" \
--output receipt.pdf
import { writeFile } from "node:fs/promises";
const response = await fetch(
"https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt",
{ headers: { "X-Access-Token": process.env.ONECLICKDZ_API_KEY } },
);
if (!response.ok) {
const body = await response.json();
throw new Error(body.error.code);
}
const ext = response.headers.get("content-type") === "application/pdf" ? "pdf" : "png";
await writeFile(`receipt.${ext}`, Buffer.from(await response.arrayBuffer()));
import os, requests
response = requests.get(
"https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt",
headers={"X-Access-Token": os.environ["ONECLICKDZ_API_KEY"]},
)
if not response.ok:
raise RuntimeError(response.json()["error"]["code"])
ext = "pdf" if response.headers["Content-Type"] == "application/pdf" else "png"
with open(f"receipt.{ext}", "wb") as f:
f.write(response.content)
<?php
$ch = curl_init("https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-Access-Token: " . getenv("ONECLICKDZ_API_KEY")],
]);
$data = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
if ($status !== 200) {
throw new Exception(json_decode($data, true)["error"]["code"]);
}
$ext = $type === "application/pdf" ? "pdf" : "png";
file_put_contents("receipt.$ext", $data);
?>
الأخطاء
| HTTP | الرمز | المعنى |
|---|---|---|
| 401 | MISSING_ACCESS_TOKEN / INVALID_ACCESS_TOKEN | المفتاح مفقود أو مرفوض |
| 404 | NOT_FOUND | معاملة غير معروفة، أو ليست لك، أو ليست بالحالة SUCCESS، أو لا يتوفّر إيصال |
| 500 | INTERNAL_ERROR | تعذّرت قراءة الملف؛ أعد المحاولة لاحقًا |
| 503 | AUTH_UNAVAILABLE | تعذّر التحقّق من المفتاح في الوقت المحدّد؛ أعد المحاولة بعد Retry-After |

