سجّل كل مدفوعات Paymob في Google Sheets
كل معاملة Paymob، ناجحة أو فاشلة، تصبح صفًا في جدولك.
كيف تعمل
المشغّل: Webhook — إشعار معالجة المعاملة من Paymob
- استقبل إشعار المعاملة من Paymob.
- استخرج التاريخ والطلب والمبلغ ووسيلة الدفع والعميل والنتيجة.
- أضف صفًا إلى ورقة Payments.
المخطط
مشغّل تطبيق كود
الكود
كود JavaScript المستخدم في خطوات Code، وهو مضمَّن بالفعل في القالب بالأسفل.
// Mode: Run Once for Each Item
// Paymob "transaction processed" callback → clean, easy-to-use fields.
const obj = $json.body?.obj || {};
const billing = obj.order?.shipping_data || obj.payment_key_claims?.billing_data || {};
return {
json: {
success: obj.success === true,
transaction_id: obj.id,
order_id: obj.order?.merchant_order_id || obj.order?.id,
amount: (obj.amount_cents || 0) / 100,
currency: obj.currency,
method: obj.source_data?.sub_type || obj.source_data?.type || "",
customer_name: [billing.first_name, billing.last_name].filter(Boolean).join(" "),
phone: String(billing.phone_number || "").replace(/[^0-9]/g, ""),
email: billing.email || "",
error: obj.data?.message || "",
date: obj.created_at,
},
};ابنِها بأداتك
اختر أداتك — نفس الأتمتة، خطوة بخطوة.
انسخه والصقه مباشرة في مساحة عمل n8n (Ctrl+V)، أو حمّله واستخدم Import from File. بعد ذلك اربط حساباتك واستبدل كل قيمة تبدأ بـ YOUR_.
عرض الكود (119 سطر)
{
"name": "سجّل كل مدفوعات Paymob في Google Sheets (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## سجّل كل مدفوعات Paymob في Google Sheets\nكل معاملة Paymob، ناجحة أو فاشلة، تصبح صفًا في جدولك.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "paymob-log",
"options": {}
},
"id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
"name": "Paymob callback",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
0,
0
],
"webhookId": "43ef56f7-3e64-497c-a29d-9f8e76873bd0"
},
{
"parameters": {
"jsCode": "// Mode: Run Once for Each Item\n// Paymob \"transaction processed\" callback → clean, easy-to-use fields.\nconst obj = $json.body?.obj || {};\nconst billing = obj.order?.shipping_data || obj.payment_key_claims?.billing_data || {};\n\nreturn {\n json: {\n success: obj.success === true,\n transaction_id: obj.id,\n order_id: obj.order?.merchant_order_id || obj.order?.id,\n amount: (obj.amount_cents || 0) / 100,\n currency: obj.currency,\n method: obj.source_data?.sub_type || obj.source_data?.type || \"\",\n customer_name: [billing.first_name, billing.last_name].filter(Boolean).join(\" \"),\n phone: String(billing.phone_number || \"\").replace(/[^0-9]/g, \"\"),\n email: billing.email || \"\",\n error: obj.data?.message || \"\",\n date: obj.created_at,\n },\n};",
"mode": "runOnceForEachItem"
},
"id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
"name": "Read payment",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
0
]
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "YOUR_SPREADSHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "Payments",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"date": "={{ $json.date }}",
"order_id": "={{ $json.order_id }}",
"transaction_id": "={{ $json.transaction_id }}",
"amount": "={{ $json.amount }}",
"currency": "={{ $json.currency }}",
"method": "={{ $json.method }}",
"customer": "={{ $json.customer_name }}",
"result": "={{ $json.success ? 'paid' : 'failed' }}"
}
},
"options": {}
},
"id": "43ef56f7-3e64-497c-a29d-9f8e76873bd0",
"name": "Add to Payments",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
600,
0
]
}
],
"connections": {
"Paymob callback": {
"main": [
[
{
"node": "Read payment",
"type": "main",
"index": 0
}
]
]
},
"Read payment": {
"main": [
[
{
"node": "Add to Payments",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}في Make، أنشئ سيناريو جديدًا وأضف هذه الوحدات بالترتيب:
- Webhooks › Custom webhook
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Google Sheets › Add a Row
- كل تشغيل لوحدة يستهلك عمليات (operations) في Make — والباقة المجانية تتضمن حصة شهرية.
- دوال Make المدمجة (map و sum و formatDate…) تغني عن معظم خطوات Code؛ وللمنطق المعقد استخدم وحدة كود.
- قد تختلف أسماء الوحدات والخطوات قليلًا مع تحديث Make و Zapier لتطبيقاتهما.
في Zapier، أنشئ Zap جديدًا وأضف هذه الخطوات بالترتيب:
- Webhooks by Zapier — Catch Hook
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Google Sheets — Create Spreadsheet Row
- الـ Zaps التي فيها أكثر من خطوتين تحتاج باقة Zapier مدفوعة.
- الـ Webhooks والفلاتر/المسارات و Code by Zapier ميزات مدفوعة في بعض باقات Zapier.
- Code by Zapier يشغّل JavaScript: أعد استخدام الكود بالأعلى، مع قراءة المدخلات من inputData بدلًا من $json.
- قد تختلف أسماء الوحدات والخطوات قليلًا مع تحديث Make و Zapier لتطبيقاتهما.
نصائح
- المبالغ تصل بالقروش (amount_cents) — خطوة Code تقسمها على 100.
أتمتات مشابهة
تطبيقات المنطقةمتوسط
إيصال واتساب لمدفوعات Paymob
عند نجاح دفعة عبر Paymob، يصل العميل إيصال على واتساب فورًا.
Paymob → WhatsApp5 س/شهر
تطبيقات المنطقةسهل
تنبيه تيليجرام لمدفوعات Paymob الفاشلة
اعرف فورًا عندما تفشل دفعة عميل، لتتصل به وتنقذ البيعة.
Paymob → Telegram2 س/شهر
تطبيقات المنطقةمتقدم
تحقق من إشعارات Paymob باستخدام HMAC
افحص توقيع Paymob في كل إشعار حتى تُرفض رسائل الدفع المزيفة.
Paymob → Telegram1 س/شهر