Reminder: By Aug 31, 2025, all new apps and updates to existing apps must use Billing Library version 7 or newer. If you need more time to update your app, you can request an extension until Nov 1, 2025. Learn about Play Billing Library version deprecation.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
نظام الفوترة في Google Play هو خدمة تتيح لك بيع المنتجات الرقمية
والمحتوى الرقمي في تطبيق Android، سواء كنت تريد تحقيق الربح من خلال عمليات شراء
لمرّة واحدة أو من خلال تقديم اشتراكات لخدماتك. يقدّم Google Play مجموعة كاملة
من واجهات برمجة التطبيقات للدمج مع كلّ من تطبيق Android وواجهة الخادم الخلفية، ما يمنح المستخدمين إمكانية الاستفادة من عمليات الشراء المألوفة والآمنة على Google Play.
بنية الدمج
يقدّم هذا القسم الوحدات الوظيفية المختلفة التي يمكنك إنشاؤها، ويشرح بدوره واجهات برمجة التطبيقات والمكتبات المتاحة لتبسيط العملية.
الشكل 1. رسم بياني لدمج نموذجي لميزة "الفوترة في Google Play"
يمكنك دمج نظام الفوترة في Google Play مع تطبيق Android باستخدام مكتبة
الفوترة في Play. تتيح هذه المكتبة
التواصل مع طبقة "خدمات Google Play" التي تقدّم
عرض المنتجات المترجَمة المتاح لكل مستخدم في تطبيقك، بالإضافة إلى
طُرق معالجة عمليات المستخدم الأخرى الضرورية، مثل بدء عملية الشراء
ومعالجة نتيجتها.
يجب أيضًا دمج نظام الفوترة في Google Play مع الخلفية في الخادم ل
إنشاء مسارات المطوّرين اللازمة. هذا الإجراء ضروري لضمان فعالية وأمان
إدارة عمليات الشراء ومنح الأذونات على جميع المنصات.
يمكنك إنشاء عملية الدمج هذه باستخدام واجهة برمجة التطبيقات لميزة "الاشتراكات وعمليات الشراء داخل التطبيق" التي تقدّمها Google Play Developer API. يستفيد الدمج في الخلفية أيضًا من بعض
أدوات منصة Google Cloud.
الشكل 2. واجهات برمجة التطبيقات والخدمات التي تقدّمها واجهة برمجة التطبيقات
Google Play Developer API
المصطلحات
يسرد هذا القسم ويوضّح التقنيات والمفاهيم العالية المستوى التي
قد تواجهها عند دمج نظام الفوترة في Google Play مع تطبيقك.
يمكنك الرجوع إلى هذه القائمة أثناء الاطّلاع على إرشادات الدمج.
التقنيات
Google Play: متجر على الإنترنت يمكن للمستخدمين فيه
تنزيل التطبيقات والمنتجات الرقمية الأخرى
Google Play Console: منصّة
توفّر واجهة يمكنك من خلالها نشر تطبيقك على Google Play تعرض
Google Play Console أيضًا تفاصيل عن تطبيقك، بما في ذلك أي
منتجات أو محتوى تبيعه على Google Play.
Google Cloud Console: منصّة تدِير واجهات برمجة التطبيقات في الخلفية، مثل Google Play Developer API
Google Play Developer API
واجهة برمجة تطبيقات REST يمكنك استخدامها للتعامل آليًا مع مهام النشر وإدارة التطبيقات.
Cloud Pub/Sub: خدمة مراسلة في الوقت الفعلي مُدارة بالكامل تتيح لك إرسال الرسائل واستلامها بين التطبيقات المستقلة يستخدم Google Play خدمة Cloud Pub/Sub لإرسال
إشعارات المطوّرين في الوقت الفعلي. لاستخدام Cloud
Pub/Sub، يجب أن يكون لديك مشروع على
Google Cloud Platform (GCP) مع تفعيل واجهة برمجة التطبيقات Cloud
Pub/Sub API. إذا لم تكن على دراية بخدمة Google Cloud Platform وCloud Pub/Sub، اطّلِع على دليل البدء السريع.
خادم خلفية آمن: في إطار دمج نظام الفوترة في Google Play
في تطبيقك، ننصحك بشدة باستخدام خادم خلفية آمن للقيام
بالمهام المتعلّقة بالفوترة، مثل التحقّق من عمليات الشراء،
والميزات المتعلّقة بالاشتراكات، ومعالجة إشعارات المطوّرين في الوقت الفعلي.
تطبيق "متجر Google Play": تطبيق يدير جميع العمليات المتعلّقة
بGoogle Play. يعالج تطبيق "متجر Google Play" جميع الطلبات التي يقدّمها تطبيقك.
المفاهيم
Flow: تعرِض العملية الخطوات المعتادة المرتبطة بأحد المهام المتعلّقة بالفوترة. على سبيل المثال، يوضّح مسار الشراء الخطوات
المُتّبعة عندما يشتري أحد المستخدِمين منتجك. قد يوضّح مسار الاشتراك
كيفية انتقال الاشتراك بين الحالات.
إذن الاستخدام: عندما يشتري مستخدم منتجًا داخل التطبيق، يصبح لديه
الحق في استخدام هذا المنتج داخل تطبيقك. بالنسبة إلى المنتجات التي يتم شراؤها لمرة واحدة، يعني ذلك
أنّه يجب أن يحصل المستخدم الآن على إذن بالوصول الدائم إلى المنتج.
بالنسبة إلى الاشتراكات، يعني ذلك أنّه يجب أن يحصل المستخدم على إذن الوصول إليها ما دام الاشتراك نشِطًا.
معرّف المنتج: معرّف نوع منتج معيّن
رمز الشراء المميّز سلسلة تمثّل إذن المشتري بالوصول إلى أحد
المنتجات على Google Play. ويشير ذلك إلى أنّ أحد مستخدمي Google قد دفع ثمن
منتج معيّن.
معرّف الطلب: سلسلة تمثّل معاملة مالية على Google Play
يتم إنشاء معرّف طلب في كل مرة تحدث فيها معاملة مالية. يتم تضمين هذه السلسلة
في الإيصال الذي يتم إرساله بالبريد الإلكتروني إلى المشتري. يمكنك استخدام رقم تعريف الترتيب
لإدارة عمليات ردّ الأموال في قسم إدارة الطلبات في
Google Play Console. تُستخدَم معرّفات الطلبات أيضًا في تقارير المبيعات والعائدات.
الخطوات التالية
لبدء دمج نظام الفوترة في Google Play مع تطبيقك وواجهة خادم الخلفية،
اطّلِع على دليل الإعداد.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Google Play's billing system is a service that enables you to sell digital products\nand content in your Android app, whether you want to monetize through one-time\npurchases or offer subscriptions to your services. Google Play offers a full set\nof APIs for integration with both your Android app and your server backend that\nunlock the familiarity and safety of Google Play purchases for your users.\n| **Note:** Google Play's billing system is only for digital items. For physical goods and services, or other non-digital content, see the [Google Pay SDK](https://developers.google.com/pay/api/android/overview).\n\nIntegration architecture\n------------------------\n\nThis section introduces the different functional modules that you can build and\nthe APIs and libraries available to simplify the process.\n**Figure 1.** Diagram of a typical Google Play billing integration.\n\nYou can integrate Google Play's billing system with your Android app using the [Play\nBilling Library](/reference/com/android/billingclient/classes). This library\nenables communication with the Google Play Services layer that provides the\nlocalized product offering available to each user in your app, as well as\nmethods to handle other necessary user operations, like launching the purchase\nflow and handling its outcome.\n\nYou should also integrate Google Play's billing system with your server backend to\ncreate the necessary developer flows. This is essential to guarantee that your\npurchase management and cross-platform entitlements are efficient and secure.\nYou can create this integration with the [Subscriptions and in-app purchases\nAPI](https://developers.google.com/android-publisher#subscriptions) provided by\nthe Google Play Developer API. The backend integration also leverages some\nGoogle Cloud platform tools.\n**Figure 2.** APIs and services provided by the Google Play Developer API.\n\nTerminology\n-----------\n\nThis section lists and describes the high-level technologies and concepts that\nyou might encounter when integrating Google Play's billing system into your app.\nReference this list as you proceed through the integration guidance.\n\n### Technologies\n\n- [**Google Play**](https://play.google.com). An online store where users can download apps and other digital products.\n- [**Google Play Console**](https://play.google.com/console). A platform that provides an interface where you can publish your app to Google Play. The Google Play Console also shows details about your app, including any products or content that you sell with Google Play.\n- [**Google Cloud Console**](https://console.developers.google.com/). A platform that manages backend APIs, such as the Google Play Developer API.\n- [**Google Play Billing Library**](/google/play/billing/integrate). An API that you can use to integrate Google Play's billing system into your app.\n- [**Google Play Developer API**](https://developers.google.com/android-publisher/). A REST API that you can use to programmatically handle publishing and app management tasks.\n- [**Cloud Pub/Sub**](https://cloud.google.com/pubsub/). A fully managed real-time messaging service that enables you to send and receive messages between independent applications. Google Play uses Cloud Pub/Sub to deliver Real-time developer notifications. To use [Cloud\n Pub/Sub](https://cloud.google.com/pubsub/), you must have a project on the [Google Cloud Platform (GCP)](https://cloud.google.com/) with the Cloud Pub/Sub API enabled. If you aren't familiar with GCP and Cloud Pub/Sub, see the [Quickstart guide](https://cloud.google.com/pubsub/docs/quickstart-console).\n- [**Real-time developer notifications**](/google/play/billing/getting-ready#configure-rtdn). A mechanism that lets you monitor state changes for Google Play-managed subscriptions in real time by leveraging [Cloud\n Pub/Sub](https://cloud.google.com/pubsub).\n- **Secure backend server**. As part of integrating Google Play's billing system into your app, we strongly recommend that you use a secure backend server to implement billing-related tasks such as purchase verification, subscription-specific features, and handling Real-time developer notifications.\n- **Google Play Store app**. An app that manages all operations related to Google Play. All requests made by your app are handled by the Google Play Store app.\n\n### Concepts\n\n- **Flow** . A flow shows the typical steps involved in a billing-related task. For example, a *purchase flow* outlines the steps involved when a user purchases your product. A *subscription flow* might show how a subscription transitions between states.\n- **Entitlement** . When a user purchases an in-app product, they are then *entitled* to that product within your app. For one-time products, this means that the user should now have permanent access to the product. For subscriptions, this means that the user should have access while the subscription is active.\n- **Product ID**. The ID of a specific product type.\n- **Purchase token**. A string that represents a buyer's entitlement to a product on Google Play. It indicates that a Google user has paid for a specific product.\n- **Order ID** . A string that represents a financial transaction on Google Play. An order ID is created every time a financial transaction occurs. This string is included in a receipt that is emailed to the buyer. You can use the order ID to manage refunds in the **Order Management** section of the Google Play Console. Order IDs are also used in sales and payout reports.\n\nNext steps\n----------\n\nTo begin integrating Google Play's billing system with your app and server backend,\nsee the [setup guide](/google/play/billing/getting-ready)."]]