كل الاستجابات أدناه ناتجة عن طلبات حقيقية للواجهة على مقهى تجريبي في تونس.
معلومات المفتاح
GET/api/ext/v1/me
الصلاحية: أي مفتاح صالح
اسم المفتاح وبادئته وصلاحياته، والأنشطة التجارية التي يصل إليها، وحد الطلبات. مفيد لاختبار إعداداتك.
curl "https://app.dawwerni.com/api/ext/v1/me" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"apiVersion": "v1",
"key": {
"id": 7,
"name": "POS bridge - Tunis",
"prefix": "dw_live_a1b2c3d4",
"scopes": [
"customers:read",
"customers:write",
"points:write",
"redemptions:write",
"rewards:read",
"webhooks:manage",
"winnings:verify"
],
"businessScope": null
},
"businesses": [
{
"id": 186,
"name": "Café Amira"
}
],
"rateLimitPerMinute": 120
}
البحث عن العملاء
GET/api/ext/v1/customers
الصلاحية: customers:read
قائمة مقسّمة لحسابات الولاء. صفِّ حسب الهاتف أو البريد؛ دون تصفية: كل عملاء الأنشطة التجارية للمفتاح.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
phone | query | string | هاتف العميل (رمّز + بـ %2B) (اختياري) |
email | query | string | بريد العميل (اختياري) |
businessId | query | integer | حصر النتائج في نشاط تجاري واحد (اختياري) |
page | query | integer ≥ 0 | رقم الصفحة من 0 (اختياري) |
size | query | integer 1–100 (20) | حجم الصفحة (اختياري) |
curl "https://app.dawwerni.com/api/ext/v1/customers?phone=%2B21698123456" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"data": [
{
"id": 313,
"businessId": 186,
"name": "Amira B.",
"email": "[email protected]",
"phone": "+21698123456",
"points": {
"spendable": 0,
"locked": 0,
"lifetimeEarned": 0
},
"createdAt": "2026-10-13T21:36:40.087382",
"updatedAt": "2026-10-13T21:36:40.121926"
}
],
"page": {
"number": 0,
"size": 20,
"totalElements": 1,
"totalPages": 1,
"hasNext": false
}
}
حساب ولاء واحد بمعرّفه في دورني.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
id* | path | integer | معرّف العميل في دورني (إلزامي) |
curl "https://app.dawwerni.com/api/ext/v1/customers/313" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"id": 313,
"businessId": 186,
"name": "Amira B.",
"email": "[email protected]",
"phone": "+21698123456",
"points": {
"spendable": 0,
"locked": 0,
"lifetimeEarned": 0
},
"createdAt": "2026-10-13T21:36:40.087382",
"updatedAt": "2026-10-13T21:36:40.121926"
}
404 Not Found الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "CUSTOMER_NOT_FOUND",
"message": "Customer not found"
}
}
يبحث عن العميل بالبريد ثم بالهاتف؛ ينشئه إن لم يوجد (201) أو يكمل بياناته (200).
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
phone | body | string (E.164) | الهاتف؛ الهاتف أو البريد إلزامي (اختياري) |
email | body | string | البريد؛ الهاتف أو البريد إلزامي (اختياري) |
name | body | string ≤ 120 | الاسم المعروض (اختياري) |
businessId | body | integer | إلزامي إذا كان المفتاح يغطي عدة أنشطة (اختياري) |
Idempotency-Key | header | string ≤ 255 | إعادة آمنة لمدة 24 ساعة (اختياري) |
curl -X POST "https://app.dawwerni.com/api/ext/v1/customers" \
-H "Authorization: Bearer $DAWWERNI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Amira Ben Salah", "phone": "+21698123456", "email": "[email protected]" }'
201 Created الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"id": 313,
"businessId": 186,
"name": "Amira Ben Salah",
"email": "[email protected]",
"phone": "+21698123456",
"points": {
"spendable": 0,
"locked": 0,
"lifetimeEarned": 0
},
"createdAt": "2026-10-13T21:36:40.0873817",
"updatedAt": "2026-10-13T21:36:40.0873817"
}
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"id": 313,
"businessId": 186,
"name": "Amira B.",
"email": "[email protected]",
"phone": "+21698123456",
"points": {
"spendable": 0,
"locked": 0,
"lifetimeEarned": 0
},
"createdAt": "2026-10-13T21:36:40.087382",
"updatedAt": "2026-10-13T21:36:40.1219263"
}
400 Bad Request الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "CUSTOMER_IDENTIFIER_REQUIRED",
"message": "Provide a phone or an email"
}
}
النقاط المتاحة والمجمّدة والمكتسبة إجمالاً، مقسّمة حسب البرنامج (الألعاب / الولاء) وبطاقة الأختام.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
id* | path | integer | معرّف العميل في دورني (إلزامي) |
curl "https://app.dawwerni.com/api/ext/v1/customers/313/points" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"customerId": 313,
"businessId": 186,
"total": 192,
"spendable": 192,
"locked": 0,
"lifetimeEarned": 192,
"byProgram": {
"GAMES": 0,
"LOYALTY": 192
},
"balanceMode": "COMBINED",
"loyaltyMode": "POINTS",
"stampCount": 0,
"stampsRequired": 10,
"stampRewardsAvailable": 0
}
يسجّل إيصال الكاشير ويضيف النقاط حسب قواعد برنامج الولاء. يتم إنشاء العميل إن لم يكن موجوداً.
- externalId يعرّف الإيصال: إعادة إرسال نفس externalId تعيد النتيجة الأولى مع "duplicate": true دون منح أي نقاط.
- دون "points" يتم تحويل المبلغ حسب قاعدة بطاقة الولاء (نقاط لكل وحدة مدفوعة). فعّل بطاقة الولاء من قسم الولاء؛ وإلا تكون pointsAwarded صفراً.
- المرتجعات لا تسحب نقاطاً: أرسل عمليات البيع فقط.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
externalId* | body | string ≤ 120 | معرّف فريد للإيصال في الكاشير (إلزامي) |
amount* | body | number ≥ 0 | المبلغ المدفوع (إلزامي) |
customer* | body | { id | phone | email, name } | العميل: معرّف دورني، أو الهاتف / البريد (+ الاسم) (إلزامي) |
currency | body | ISO 4217 (TND, EGP, SAR…) | رمز العملة ISO (TND وEGP وSAR وUSD…) (اختياري) |
points | body | integer 0–1 000 000 | نقاط محددة (وإلا تُحسب بقاعدتك) (اختياري) |
items | body | [{ sku, name, quantity, unitPrice }] | بنود الإيصال (يُحفظ عددها فقط) (اختياري) |
businessId | body | integer | إلزامي إذا كان المفتاح يغطي عدة أنشطة (اختياري) |
Idempotency-Key | header | string ≤ 255 | إعادة آمنة لمدة 24 ساعة (اختياري) |
curl -X POST "https://app.dawwerni.com/api/ext/v1/purchases" \
-H "Authorization: Bearer $DAWWERNI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: f3b0c442-98fc-4c1c-9a3a-6b0e5a1d2c01" \
-d '{ "customer": { "phone": "+21698123456", "name": "Amira Ben Salah" }, "amount": 42.5, "currency": "TND", "externalId": "R-2026-000123", "items": [ { "sku": "LATTE", "name": "Latte", "quantity": 2, "unitPrice": 7.5 } ] }'
201 Created الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"purchaseId": 9,
"externalId": "R-2026-000123",
"duplicate": false,
"businessId": 186,
"amount": 42.5,
"currency": "TND",
"itemsCount": 1,
"pointsRequested": null,
"pointsAwarded": 42,
"customer": {
"id": 313,
"businessId": 186,
"name": "Amira Ben Salah",
"email": "[email protected]",
"phone": "+21698123456",
"points": {
"spendable": 42,
"locked": 0,
"lifetimeEarned": 42
},
"createdAt": "2026-10-13T21:36:40.087382",
"updatedAt": "2026-10-13T21:36:40.2972964"
},
"balance": {
"customerId": 313,
"businessId": 186,
"total": 42,
"spendable": 42,
"locked": 0,
"lifetimeEarned": 42,
"byProgram": {
"GAMES": 0,
"LOYALTY": 42
},
"balanceMode": "COMBINED",
"loyaltyMode": "POINTS",
"stampCount": 0,
"stampsRequired": 10,
"stampRewardsAvailable": 0,
"program": "LOYALTY",
"outcome": "OK"
},
"source": "api"
}
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"purchaseId": 9,
"externalId": "R-2026-000123",
"duplicate": true,
"businessId": 186,
"amount": 42.5,
"currency": "TND",
"itemsCount": 1,
"pointsRequested": null,
"pointsAwarded": 0,
"customer": {
"id": 313,
"businessId": 186,
"name": "Amira Ben Salah",
"email": "[email protected]",
"phone": "+21698123456",
"points": {
"spendable": 42,
"locked": 0,
"lifetimeEarned": 42
},
"createdAt": "2026-10-13T21:36:40.087382",
"updatedAt": "2026-10-13T21:36:40.2972964"
},
"balance": {
"customerId": 313,
"businessId": 186,
"total": 42,
"spendable": 42,
"locked": 0,
"lifetimeEarned": 42,
"byProgram": {
"GAMES": 0,
"LOYALTY": 42
},
"balanceMode": "COMBINED",
"loyaltyMode": "POINTS",
"stampCount": 0,
"stampsRequired": 10,
"stampRewardsAvailable": 0,
"program": "LOYALTY",
"outcome": "OK"
},
"source": "api"
}
400 Bad Request الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "EXTERNAL_ID_REQUIRED",
"message": "externalId (POS receipt id, max 120 chars) is required"
}
}
عرض المكافآت
GET/api/ext/v1/rewards
الصلاحية: rewards:read
المكافآت النشطة لأنشطتك: تكلفتها بالنقاط والمخزون والبرنامج الذي يمكن الدفع به.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
businessId | query | integer | حصر النتائج في نشاط تجاري واحد (اختياري) |
page | query | integer ≥ 0 | رقم الصفحة من 0 (اختياري) |
size | query | integer 1–100 (20) | حجم الصفحة (اختياري) |
curl "https://app.dawwerni.com/api/ext/v1/rewards" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"data": [
{
"id": 34,
"businessId": 186,
"name": "Free cappuccino",
"description": "One cappuccino, any size",
"pointsCost": 100,
"stock": 50,
"program": "BOTH"
}
],
"page": {
"number": 0,
"size": 20,
"totalElements": 1,
"totalPages": 1,
"hasNext": false
}
}
يخصم النقاط ويُنقص المخزون وينشئ عملية استبدال «قيد الانتظار» تظهر في صفحات الولاء.
- يجب أن تكون للعميل مشاركة واحدة على الأقل في لعبة (وإلا 422 NO_PARTICIPATION_FOR_CUSTOMER).
- مع externalId، إعادة إرسال نفس الاستبدال لا تكرره ("duplicate": true).
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
customerId* | body | integer | معرّف العميل في دورني (إلزامي) |
rewardId* | body | integer | معرّف المكافأة (GET /rewards) (إلزامي) |
externalId | body | string ≤ 120 | مرجعك، يمنع التكرار (اختياري) |
notes | body | string ≤ 250 | ملاحظة داخلية (اختياري) |
Idempotency-Key | header | string ≤ 255 | إعادة آمنة لمدة 24 ساعة (اختياري) |
curl -X POST "https://app.dawwerni.com/api/ext/v1/redemptions" \
-H "Authorization: Bearer $DAWWERNI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "customerId": 313, "rewardId": 33, "externalId": "RD-1001", "notes": "Counter 1" }'
201 Created الاستجابةمثال مبني من كود الواجهة (يتطلب مشاركة حقيقية في لعبة)
{
"redemptionId": 57,
"businessId": 186,
"rewardId": 33,
"rewardName": "Free cappuccino",
"pointsUsed": 100,
"status": "PENDING",
"requestedAt": "2026-10-13T21:40:12.418302",
"program": "LOYALTY",
"customerId": 313,
"externalId": "RD-1001",
"duplicate": false
}
422 Unprocessable Entity الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "NO_PARTICIPATION_FOR_CUSTOMER",
"message": "This customer has no participation yet; redemptions through the API need at least one"
}
}
مثل مسح رمز QR في التطبيق: يتحقق من الرمز، ويسجّل الهدية كمسلّمة ويعيد بيانات الفائز.
- code يقبل رمز QR، أو الرابط الكامل /verify-winning/…، أو المرجع من 8 أحرف الموجود في بريد الفائز.
- هدية سبق تسليمها تعيد 200 مع "verified": false و"alreadyClaimed": true.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
code* | body | string | رمز QR أو رابط التحقق أو المرجع من 8 أحرف (إلزامي) |
curl -X POST "https://app.dawwerni.com/api/ext/v1/winnings/verify" \
-H "Authorization: Bearer $DAWWERNI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "code": "a1b2c3d4" }'
200 OK الاستجابةمثال مبني من كود الواجهة (يتطلب مشاركة حقيقية في لعبة)
{
"verified": true,
"alreadyClaimed": false,
"message": "Winning verified successfully",
"winning": {
"id": 9120,
"ref": "a1b2c3d4",
"businessId": 186,
"gameId": 412,
"prize": "Free croissant",
"fullName": "Amira Ben Salah",
"email": "[email protected]",
"phone": "+21698123456",
"status": "taked",
"createdAt": "2026-10-12T17:05:44.120931"
}
}
404 Not Found الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "WINNING_NOT_FOUND",
"message": "No gift matches this code"
}
}
400 Bad Request الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "INVALID_CODE",
"message": "The code is not a valid Dawwerni gift code"
}
}
عناوينك وأحداثها وحالة التسليم.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
page | query | integer ≥ 0 | رقم الصفحة من 0 (اختياري) |
size | query | integer 1–100 (20) | حجم الصفحة (اختياري) |
curl "https://app.dawwerni.com/api/ext/v1/webhooks" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
200 OK الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"data": [
{
"id": 2,
"url": "https://example.com/webhooks/dawwerni",
"description": "CRM sync",
"events": [
"winning.created",
"points.earned"
],
"active": false,
"failureCount": 0,
"lastSuccessAt": null,
"lastFailureAt": null,
"disabledAt": null,
"disabledReason": null,
"secretHint": "whsec_...9fQe",
"createdAt": "2026-10-13T20:36:40.854516Z"
}
],
"page": {
"number": 0,
"size": 20,
"totalElements": 1,
"totalPages": 1,
"hasNext": false
}
}
يسجّل عنوان HTTPS عاماً والأحداث المطلوبة. الاستجابة تحتوي على مفتاح التوقيع (ويظهر لاحقاً في التطبيق أيضاً).
- HTTPS فقط؛ العناوين الخاصة أو المحلية مرفوضة. حتى 10 عناوين لكل حساب.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
url* | body | https URL | عنوان HTTPS عام لخادمك (إلزامي) |
events* | body | string[] | الأحداث المطلوبة (انظر Webhooks) (إلزامي) |
description | body | string ≤ 255 | وصف حر (اختياري) |
active | body | boolean (true) | false لإنشائه متوقفاً (اختياري) |
curl -X POST "https://app.dawwerni.com/api/ext/v1/webhooks" \
-H "Authorization: Bearer $DAWWERNI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://crm.example.com/webhooks/dawwerni", "events": [ "points.earned", "winning.created" ], "description": "CRM sync" }'
201 Created الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"id": 2,
"url": "https://example.com/webhooks/dawwerni",
"description": "CRM sync",
"events": [
"winning.created",
"points.earned"
],
"active": false,
"failureCount": 0,
"lastSuccessAt": null,
"lastFailureAt": null,
"disabledAt": null,
"disabledReason": null,
"secretHint": "whsec_...9fQe",
"createdAt": "2026-10-13T20:36:40.854516100Z",
"secret": "whsec_<shown once: store it in your server config>"
}
400 Bad Request الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "INVALID_WEBHOOK_URL",
"message": "Only https:// URLs are allowed"
}
}
400 Bad Request الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)
{
"error": {
"code": "UNKNOWN_EVENT",
"message": "Unknown event: order.paid"
}
}
يحذف العنوان ويلغي عمليات التسليم المعلّقة.
المعاملات| الاسم | المكان | النوع | الوصف |
|---|
id* | path | integer | معرّف العنوان (إلزامي) |
curl -X DELETE "https://app.dawwerni.com/api/ext/v1/webhooks/2" \
-H "Authorization: Bearer $DAWWERNI_API_KEY"
204 No Content الاستجابةاستجابة حقيقية من الواجهة (بيانات تجريبية)