יוצר פרטי כניסה לאימות API ל-REST של Google Wallet
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ב-Google Wallet יש ממשק API ל-REST שמאפשר ליצור ולנהל כרטיסים על ידי שליחת בקשות ל-Google Wallet API באמצעות HTTP. זו אפשרות שימושית למי שרוצה ליצור באופן פרוגרמטי שירותים בצד השרת כדי שיעבדו עם כרטיסים באופן פרוגרמטי.
כדי להשתמש ב-Google Wallet REST API, צריך להפעיל את ה-API במסוף Google Cloud, ליצור חשבון שירות ב-Google Cloud ואז ליצור מפתח לחשבון השירות.
כשיוצרים כרטיסים באמצעות API ל-REST, המפתח של חשבון השירות שמשמש לחתימה על אובייקטים מסוג Passes שמקודדים ב-JSON Web Token.
בפעולות אחרות, כמו עדכון או מחיקה של כרטיסים, המפתח של חשבון השירות נשלח עם הבקשה לאימות הזהות שלכם כמנפיקי הכרטיסים.
1. הפעלת ה-API ל-REST של Google Wallet
כדי להפעיל את Google Wallet REST API, יש לבצע את הפעולות הבאות:
- אם אין לכם עדיין חשבון ב-Google Cloud, תוכלו להיכנס למסוף Google Cloud ולפעול לפי השלבים כדי להירשם לחשבון חדש.
- בוחרים את הפרויקט ב-Google Cloud שבו רוצים להשתמש או יוצרים פרויקט חדש בתפריט הנפתח שבחלק העליון של המסוף.
- עבור אל דף פרטי המוצר של Google Wallet API ב-Marketplace של מסוף Google Cloud.
- לוחצים על הלחצן 'הפעלה'. בעוד כמה דקות, ה-API ל-REST של Google Wallet יהיה זמין לפרויקט הנבחר ב-Google Cloud.
2. יצירת מפתח לחשבון שירות ב-Google Cloud
כדי לאמת בקשות ל-API ל-REST של Google Wallet, עליכם ליצור חשבון שירות וליצור מפתח לחשבון שירות. לשם כך:
- נכנסים לדף Create service account במסוף Google Cloud.
- ממלאים את פרטי חשבון השירות. שימו לב לכתובת האימייל של חשבון השירות שמופיעה מתחת לשדה Service account ID. תצטרכו אותה מאוחר יותר כשמשתמשים בחשבון השירות כדי לאמת את הבקשות שלכם ל-API ל-REST של Google Wallet.
- לוחצים על הלחצן 'סיום'. אין צורך להשלים את השלבים האחרים ליצירת חשבון שירות.
- לוחצים על האפשרות 'מפתחות' בחלק העליון של הדף.
- לוחצים על התפריט הנפתח 'הוספת מפתח' ואז לוחצים על 'יצירת מפתח חדש'.
- בוחרים את סוג המפתח 'JSON'.
- כדי ליצור ולהוריד את המפתח לחשבון השירות, צריך ללחוץ על 'CREATE'.
3. אשר את חשבון השירות שלך במסוף Google Wallet
כדי לאמת את הבקשות שלך ל-API ל-REST של Google Wallet באמצעות מפתח לחשבון שירות, עליך להוסיף את כתובת האימייל של חשבון השירות שלך כמשתמש לחשבון המנפיק. כדי להוסיף את חשבון השירות כמשתמש:
- עוברים לדף Service accounts במסוף Google Cloud.
- העתק את כתובת האימייל של חשבון השירות שבו אתה רוצה להשתמש כדי לאמת את הבקשות שלך לממשק ה-API של Google Wallet.
- נכנסים למסוף Google Pay ו-Wallet.
- בתפריט הניווט הימני, לוחצים על 'משתמשים'.
- לוחצים על 'הזמנת משתמש'.
- מזינים את כתובת האימייל של חשבון השירות.
- בתפריט הנפתח 'רמת גישה', בוחרים באפשרות 'מפתח'.
- לחץ על הלחצן 'הזמנה'.
אחרי שמוסיפים את חשבון השירות, אפשר להשתמש בכל מפתחות של חשבונות השירות שנוצרו עבורו כדי לאמת בקשות ל-API ל-REST של Google Wallet. כשמשתמשים במפתחות של חשבונות שירות, חשוב לזכור שאלו פרטי כניסה רגישים מאוד שצריך להשתמש בהם רק בסביבות מאובטחות בצד השרת.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-29 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-29 (שעון UTC)."],[[["\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 service account, and generate a key for authentication.\u003c/p\u003e\n"],["\u003cp\u003eThis service account key is crucial for signing Pass Objects during creation and authenticating other pass operations like updates and deletions.\u003c/p\u003e\n"],["\u003cp\u003eYou must add your service account email as a user in the Google Pay & Wallet console to grant API access.\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."]]