تقديم طلب
curl --request POST \
--url https://api.oneclickdz.com/v3/gift-cards/placeOrder \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/gift-cards/placeOrder"
headers = {"X-Access-Token": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/gift-cards/placeOrder', 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/gift-cards/placeOrder",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/gift-cards/placeOrder"
req, _ := http.NewRequest("POST", 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.post("https://api.oneclickdz.com/v3/gift-cards/placeOrder")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/gift-cards/placeOrder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyبطاقات الهدايا
تقديم طلب
اشترِ بطاقات هدايا أو منتجات رقمية
POST
/
v3
/
gift-cards
/
placeOrder
تقديم طلب
curl --request POST \
--url https://api.oneclickdz.com/v3/gift-cards/placeOrder \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/gift-cards/placeOrder"
headers = {"X-Access-Token": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/gift-cards/placeOrder', 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/gift-cards/placeOrder",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/gift-cards/placeOrder"
req, _ := http.NewRequest("POST", 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.post("https://api.oneclickdz.com/v3/gift-cards/placeOrder")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/gift-cards/placeOrder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyنظرة عامة
أنشئ طلبات لبطاقات الهدايا والمنتجات الرقمية. تُسلَّم البطاقات رقمياً عبر endpoint الـ/checkOrder.قبل الطلب: تحقق من المخزون عبر
/checkProduct وتحقق من رصيد الحساب.جسم الطلب
string
مطلوب
معرف المنتج من
/catalogstring
مطلوب
معرف النوع من
/checkProductinteger
مطلوب
عدد البطاقات للطلب (الحد الأدنى: 1)
أمثلة
curl https://api.oneclickdz.com/v3/gift-cards/placeOrder \
-X POST \
-H "Content-Type: application/json" \
-H "X-Access-Token: YOUR_API_KEY" \
-d '{
"productId": "507f1f77bcf86cd799439011",
"typeId": "type_001",
"quantity": 2
}'
const response = await fetch(
"https://api.oneclickdz.com/v3/gift-cards/placeOrder",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Access-Token": "YOUR_API_KEY",
},
body: JSON.stringify({
productId: "507f1f77bcf86cd799439011",
typeId: "type_001",
quantity: 2,
}),
}
);
const { data } = await response.json();
console.log("Order ID:", data.orderId);
response = requests.post(
'https://api.oneclickdz.com/v3/gift-cards/placeOrder',
headers={
'Content-Type': 'application/json',
'X-Access-Token': 'YOUR_API_KEY'
},
json={
'productId': '507f1f77bcf86cd799439011',
'typeId': 'type_001',
'quantity': 2
}
)
order_id = response.json()['data']['orderId']
<?php
$data = [
'productId' => '507f1f77bcf86cd799439011',
'typeId' => 'type_001',
'quantity' => 2
];
$ch = curl_init('https://api.oneclickdz.com/v3/gift-cards/placeOrder');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-Access-Token: YOUR_API_KEY'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = json_decode(curl_exec($ch), true);
$orderId = $response['data']['orderId'];
?>
استجابة النجاح
{
"success": true,
"data": {
"orderId": "6901616fe9e88196b4eb64b3"
},
"meta": {
"timestamp": "2025-10-29T01:00:00.000Z"
},
"requestId": "req_1730163600_abc123"
}
قائمة التحقق قبل الطلب
1
التحقق من المخزون
const product = await checkProduct(productId);
const type = product.types.find(t => t.id === typeId);
if (!type || type.quantity < quantity) {
throw new Error('Insufficient stock');
}
2
التحقق من الرصيد
const balance = await getBalance();
const totalCost = type.price * quantity;
if (balance < totalCost) {
throw new Error('Insufficient balance');
}
3
تقديم الطلب
const order = await placeOrder({ productId, typeId, quantity });
4
الاستعلام عن البطاقات
const result = await pollOrder(order.orderId);
ردود الخطأ
ERR_VALIDATION
ERR_VALIDATION
معاملات طلب غير صالحة
ERR_STOCK
ERR_STOCK
المنتج نفد من المخزون
INSUFFICIENT_BALANCE
INSUFFICIENT_BALANCE
رصيد غير كافٍ
المعالجة
الطلبات نهائية بمجرد تقديمها. احفظ
orderId فوراً./checkOrder/:orderId كل 5 إلى 10 ثوانٍ حتى تصبح الحالة FULFILLED أو REFUNDED.روابط ذات صلة
التحقق من الطلب
الحصول على البطاقات عند الاكتمال
التحقق من المنتج
التحقق من المخزون أولاً
⌘I

