جارٍ إنشاء بيانات اعتماد مصادقة REST API في Google Wallet
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توفّر "محفظة Google" واجهة برمجة تطبيقات REST تتيح لك إنشاء البطاقات وإدارتها من خلال
إرسال الطلبات إلى Google Wallet API عبر HTTP. وهذا مفيد لأولئك الذين يريدون إنشاء خدمات من جهة الخادم للعمل على البطاقات آليًا.
لاستخدام Google Wallet REST API، عليك تفعيل واجهة برمجة التطبيقات في Google Cloud Console
وإنشاء حساب على خدمة Google Cloud ثم إنشاء مفتاح لحساب الخدمة.
عند إنشاء بطاقات باستخدام واجهة برمجة تطبيقات REST، يتم استخدام مفتاح حساب الخدمة لتوقيع كائنات البطاقات التي تحمل رمز JSON المميّز على الويب.
بالنسبة إلى العمليات الأخرى، مثل تعديل البطاقات أو حذفها، يتم إرسال مفتاح حساب الخدمة مع طلب المصادقة عليك بصفتك "جهة إصدار البطاقة".
1- تفعيل واجهة برمجة تطبيقات REST في محفظة Google
لتفعيل واجهة برمجة تطبيقات Google Wallet REST، عليك اتّباع الخطوات التالية:
- إذا لم يكن لديك حساب على Google Cloud، انتقِل إلى Google Cloud Console
واتّبِع الخطوات لتسجيل حساب جديد.
- من القائمة المنسدلة للمشروع في أعلى وحدة التحكّم، اختَر مشروع Google Cloud الذي تريد استخدامه أو أنشئ مشروعًا جديدًا.
- انتقِل إلى صفحة تفاصيل منتج Google Wallet API
في Google Cloud Console Marketplace.
- انقر على الزر "تفعيل". بعد بضع لحظات، ستصبح واجهة برمجة تطبيقات Google Wallet REST
متاحة لمشروع Google Cloud المُحدّد.
2. إنشاء مفتاح حساب خدمة Google Cloud
لمصادقة الطلبات لواجهة برمجة تطبيقات Google Wallet REST، عليك إنشاء
حساب خدمة وإنشاء مفتاح حساب خدمة من خلال اتّباع الخطوات التالية:
- انتقِل إلى صفحة "إنشاء حساب خدمة"
في Google Cloud Console.
- املأ تفاصيل حساب الخدمة. دوِّن عنوان البريد الإلكتروني لحساب الخدمة الذي يظهر أسفل حقل "رقم تعريف حساب الخدمة". ستحتاج إلى هذه الطريقة لاحقًا
عند استخدام حساب الخدمة لمصادقة طلباتك لواجهة Google Wallet
REST API.
- انقر على الزر "تم". ليست هناك حاجة لإكمال خطوات إنشاء
حساب الخدمة الأخرى.
- انقر على عنصر القائمة "المفاتيح" في أعلى الصفحة.
- انقر على القائمة المنسدلة "إضافة مفتاح"، ثم انقر على "إنشاء مفتاح جديد".
- اختَر نوع المفتاح "JSON".
- انقر على "إنشاء" لإنشاء مفتاح حساب الخدمة وتنزيله.
3- تفويض حساب الخدمة في وحدة تحكُّم "محفظة Google"
لمصادقة طلباتك المتعلّقة بواجهة Google Wallet REST API باستخدام مفتاح حساب خدمة، عليك إضافة عنوان البريد الإلكتروني لحساب الخدمة كمستخدم إلى حساب جهة الإصدار. لإضافة حساب الخدمة كمستخدم، عليك اتّباع الخطوات التالية:
- انتقِل إلى صفحة "حسابات الخدمة" في Google Cloud Console.
- انسخ عنوان البريد الإلكتروني لحساب الخدمة الذي تريد استخدامه لمصادقة طلباتك للوصول إلى Google Wallet API.
- انتقِل إلى وحدة تحكُّم Google Pay و"محفظة Google".
- في شريط التنقّل الأيمن، انقر على "المستخدمون".
- انقر على "دعوة مستخدم".
- أدخِل عنوان البريد الإلكتروني لحساب الخدمة.
- في القائمة المنسدلة "مستوى الوصول"، اختَر "مطوّر البرامج".
- انقر على الزر "دعوة".
بعد إضافة حساب الخدمة، يمكنك استخدام أي مفاتيح حساب خدمة تم إنشاؤها
من أجل مصادقة الطلبات لواجهة برمجة تطبيقات Google Wallet REST. عند استخدام مفاتيح حساب الخدمة، ضع في اعتبارك أن بيانات الاعتماد هذه شديدة الحساسية ويجب استخدامها فقط في بيئات آمنة من جانب الخادم.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eGoogle Wallet's REST API enables programmatic management of passes through HTTP requests, ideal for server-side integrations.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize the API, you must enable it in the Google Cloud console, create a Google Cloud service account, and generate a key for authentication.\u003c/p\u003e\n"],["\u003cp\u003eThe service account key is crucial for signing JSON Web Token-encoded Passes Objects during pass creation and authenticating other operations like updates or deletions.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, authorize your service account by adding its email address as a Developer user in the Google Pay & Wallet console.\u003c/p\u003e\n"]]],["The Google Wallet REST API allows programmatic pass management via HTTP requests. To use it, enable the API in the Google Cloud console, create a service account, and generate a JSON key. This key is used to sign JSON Web Token-encoded Pass Objects for creation and authenticates requests for updates or deletions. Finally, authorize the service account by adding its email as a 'Developer' user in the Google Pay & Wallet console. This process enables secure, server-side interaction with the Google Wallet.\n"],null,["# Generating Google Wallet REST API authentication credentials\n\nGoogle Wallet offers a REST API that lets you create and manage passes by\nsending requests to the Google Wallet API over HTTP. This is useful for those who\nwant to build server-side services to work with passes programmatically.\n\nTo use the Google Wallet REST API, you must enable the API in the Google Cloud console,\ncreate a Google Cloud service account, then generate a key for the service account.\n\nWhen you create passes with the REST API, the service account key used to sign your\nJSON Web Token-encoded Passes Objects.\n\nFor other operations, such as updating or deleting passes, the service account key\nis sent with the request to authenticate you as the Pass Issuer.\n\n1. Enable the Google Wallet REST API\n------------------------------------\n\nTo enable the Google Wallet REST API, do the following:\n\n1. If you don't already have a Google Cloud account, go to the [Google Cloud console](https://console.cloud.google.com) and follow the steps to register for a new account.\n2. From the project drop-down menu at the top of the console, select the Google Cloud project you want to use, or create a new one.\n3. Go to the [Google Wallet API product details page](https://console.cloud.google.com/apis/library/walletobjects.googleapis.com) in the Google Cloud console Marketplace.\n4. Click the 'Enable' button. In a few moments, the Google Wallet REST API will be available for the selected Google Cloud project.\n\n2. Generate a Google Cloud service account key\n----------------------------------------------\n\nTo authenticate requests to the Google Wallet REST API, you'll need to create a\nservice account, and generate a service account key by doing the following:\n\n1. Go to the ['Create service account' page](https://console.cloud.google.com/iam-admin/serviceaccounts/create) in the Google Cloud console.\n2. Fill in the service account details. Note the email address for the service account that appears below the 'Service account ID' field. You will need this later when you use the service account to authenticate your requests to the Google Wallet REST API.\n3. Click the 'DONE' button. There is no need to complete the other service account creation steps.\n4. Click the 'KEYS' menu item at the top of the page.\n5. Click the 'ADD KEY' drop-down menu, then click 'Create new key'.\n6. Select key type 'JSON'.\n7. Click 'CREATE' to create and download the service account key.\n\n3. Authorize your service account in the Google Wallet console\n--------------------------------------------------------------\n\nTo authenticate your requests to the Google Wallet REST API using a service account\nkey, you must add the email address of your service account as a user to your\nIssuer account. To add your service account as a user, do the following:\n\n1. Go to the ['Service accounts'](https://console.cloud.google.com/iam-admin/serviceaccounts) page in the Google Cloud console.\n2. Copy the email address of the service account you want to use to authenticate your requests to the Google Wallet API.\n3. Go to the [Google Pay \\& Wallet console](https://pay.google.com/business/console/).\n4. In the left nav, click 'Users'.\n5. Click 'Invite a user'.\n6. Input the email address of your service account.\n7. In the 'Access level' drop-down, select 'Developer'.\n8. Click the 'Invite' button.\n\nOnce your service account is added, you can use any service account keys generated\nfor it to authenticate requests to the Google Wallet REST API. When using service\naccount keys, keep in mind that these are highly sensitive credentials that\nshould only be used in secure, server-side environments."]]