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.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
في السابق، كان يتم استخدام الحمولة البرمجية للمطوّر لأغراض مختلفة، بما في ذلك
الوقاية من الاحتيال وتحديد المستخدم الصحيح الذي أجرى عمليات الشراء. مع الإصدارات
2.2 والإصدارات الأحدث من Google Play Billing Library، أصبحت حالات الاستخدام المقصودة التي كانت تعتمد سابقًا على الحمولة البرمجية للمطوّر متاحة بالكامل في أجزاء أخرى
من المكتبة.
بعد توفير هذا الإصدار، أوقفنا نهائيًا استخدام الحمولة المخصّصة للمطوّر، بدءًا من
الإصدار 2.2 من Google Play Billing Library. تم إيقاف الطرق المرتبطة
بحمولة المطوّر نهائيًا في الإصدار 2.2 وتمّت إزالتها في
الإصدار 3.0. يُرجى العِلم أنّه يمكن لتطبيقك مواصلة استرداد حمولة المطوِّر
لعمليات الشراء التي تم إجراؤها باستخدام الإصدارات السابقة من المكتبة أو
AIDL.
لضمان أنّ عمليات الشراء أصلية وغير مزورة أو مُعاد تشغيلها، تنصح Google باستخدام رمز تنشيط الشراء (الذي يتم الحصول عليه من الإجراء
getPurchaseToken()
في العنصر
Purchase) مع واجهات برمجة التطبيقات Google Play Developer API للتحقّق من أنّ عمليات الشراء أصلية.
لمزيد من المعلومات، يُرجى الاطّلاع على مقالة مكافحة الاحتيال وإساءة الاستخدام.
تحديد مصدر الشراء
يجب أن تضمن العديد من التطبيقات، لا سيما الألعاب، أنّه يتم تحديد مصدر عملية الشراء بشكلٍ صحيح
للشخصية أو الصورة الرمزية داخل اللعبة أو الملف الشخصي للمستخدم داخل التطبيق الذي بدأ
الشراء. اعتبارًا من الإصدار 2.2 من Google Play Billing Library،
يمكن لتطبيقك تمرير معرّفات الحسابات والملفات الشخصية المشفّرة إلى Google
عند فتح مربّع حوار الشراء وإعادتها عند استرداد
عملية شراء.
تنصح Google بتخزين البيانات الوصفية عن عملية شراء على خادم خلفي
آمن تديره بنفسك. يجب ربط البيانات الوصفية لعملية الشراء برمز إشتراك الشراء الذي تم الحصول عليه باستخدام الأسلوب
getPurchaseToken
في العنصر Purchase. يمكن الاحتفاظ بهذه البيانات من خلال تمرير رمز الشراء والبيانات الوصفية
إلى الخلفية عند استدعاء PurchasesUpdatedListener
بعد إتمام عملية شراء ناجحة.
لضمان ربط البيانات الوصفية في حال حدوث انقطاعات في عملية الشراء، توصیه Google بتخزين البيانات الوصفية على خادم الخلفية قبل
بدء مربّع حوار الشراء وربطه بمعرّف حساب المستخدم،
ورمز التخزين التعريفي الذي يتم شراؤه، والطابع الزمني الحالي.
إذا انقطعت عملية الشراء قبل استدعاء PurchasesUpdatedListener
، سيرصد تطبيقك عملية الشراء بعد استئناف نشاطه واستدعاء BillingClient.queryPurchasesAsync().
يمكنك بعد ذلك إرسال القيم التي تم استرجاعها من PurchasegetPurchaseTime()،
getSku()،
وgetPurchaseToken()
الإجراءات إلى خادم الخلفية للبحث عن البيانات الوصفية وربط البيانات الوصفية
برمز الشراء ومواصلة معالجة عملية الشراء. يُرجى العِلم أنّه لن يتطابق
الطابع الزمني الذي حفظته في البداية تمامًا مع القيمة الواردة من PurchasegetPurchaseTime()،
لذلك عليك مقارنتهما بطريقة تقريبية. على سبيل المثال، يمكنك التحقّق مما إذا كانت القيم ضمن فترة زمنية معيّنة من بعضها.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# Developer payload has historically been used for various purposes, including\nfraud prevention and attributing purchases to the correct user. With versions\n2.2 and higher of the Google Play Billing Library, intended use cases that\npreviously relied on developer payload are now fully supported in other parts\nof the library.\n\nWith this support in place, we have deprecated developer payload, starting with\nversion 2.2 of the Google Play Billing Library. Methods associated with\ndeveloper payload have been deprecated in version 2.2 and were removed in\nversion 3.0. Note that your app can continue to retrieve developer\npayload for purchases made using either previous versions of the library or\nAIDL.\n\nFor a detailed list of changes, see the\n[Google Play Billing Library 2.2 release notes](/google/play/billing/release-notes#2-2).\nand [Google Play Billing Library 3.0 release notes](/google/play/billing/release-notes#3-0).\n\nPurchase verification\n---------------------\n\nTo ensure purchases are authentic and not forged or replayed, Google recommends\nusing the purchase token (obtained from the\n[`getPurchaseToken()`](/reference/com/android/billingclient/api/Purchase#getpurchasetoken)\nmethod in the\n[`Purchase`](/reference/com/android/billingclient/api/Purchase) object) along\nwith the Google Play Developer APIs to verify purchases are authentic.\nFor more information, see\n[Fight fraud and abuse](/google/play/billing/security).\n\nPurchase attribution\n--------------------\n\nMany apps, particularly games, need to ensure that a purchase is correctly\nattributed to the in-game character/avatar or in-app user profile that initiated\nthe purchase. Starting with Google Play Billing Library 2.2,\nyour app can pass obfuscated account and profile identifiers to Google\nwhen launching the purchase dialog and have them returned when retrieving a\npurchase.\n\nUse the\n[`setObfuscatedAccountId()`](/reference/com/android/billingclient/api/BillingFlowParams.Builder#setObfuscatedAccountId(java.lang.String))\nand\n[`setObfuscatedProfileId()`](/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid)\nparameters in\n[`BillingFlowParams`](/reference/com/android/billingclient/api/BillingFlowParams)\nand retrieve them using the\n[`getAccountIdentifiers()`](/reference/com/android/billingclient/api/Purchase#getAccountIdentifiers())\nmethod in the\n[`Purchase`](/reference/com/android/billingclient/api/Purchase) object.\n| **Note:** Purchases made using previous versions of the library using [`setAccountId()`](/reference/com/android/billingclient/api/BillingFlowParams.Builder#setAccountId(java.lang.String)) (renamed to `setObfuscatedAccountId()`) are not returned by `getAccountIdentifiers()`.\n\nAssociate metadata with a purchase\n----------------------------------\n\nGoogle recommends storing metadata about a purchase on a secure backend\nserver that you maintain. This purchase metadata should be associated with the\npurchase token obtained using the\n[`getPurchaseToken`](/reference/com/android/billingclient/api/Purchase#getPurchaseToken())\nmethod in the [`Purchase`](/reference/com/android/billingclient/api/Purchase)\nobject. This data can be persisted by passing the purchase token and metadata\nto your backend when your\n[`PurchasesUpdatedListener`](/reference/com/android/billingclient/api/PurchasesUpdatedListener)\nis called after a successful purchase.\n\nTo ensure metadata is associated in the case of purchase flow interruptions,\nGoogle recommends storing the metadata on your backend server prior to\nlaunching the purchase dialog and associating it with your user's account ID,\nthe SKU being purchased, and the current timestamp.\n\nIf the purchase flow is interrupted before your\n[`PurchasesUpdatedListener`](/reference/com/android/billingclient/api/PurchasesUpdatedListener)\nis called, your app will discover the purchase once your app resumes and calls\n[`BillingClient.queryPurchasesAsync()`](/reference/com/android/billingclient/api/BillingClient#queryPurchasesAsync(java.lang.String,%20com.android.billingclient.api.PurchasesResponseListener)).\nYou can then send the values retrieved from the `Purchase` object's\n[`getPurchaseTime()`](/reference/com/android/billingclient/api/Purchase#getPurchaseTime()),\n[`getSku()`](/reference/com/android/billingclient/api/Purchase#getsku),\nand [`getPurchaseToken()`](/reference/com/android/billingclient/api/Purchase#getpurchasetoken)\nmethods to your backend server to look up metadata, associate the metadata\nwith the purchase token, and continue processing the purchase. Note that the\ntimestamp you initially stored won't exactly match the value from the `Purchase` object's\n[`getPurchaseTime()`](/reference/com/android/billingclient/api/Purchase#getPurchaseTime()),\nso you would need to compare them in an approximate way. For example, you can check\nif the values are within a certain time period of each other."]]