[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-11。"],[],[],null,["# Manage user accounts for your SaaS product\n\nAt a high level, your app must handle the following scenario:\n\n1. A user makes a request or change in Cloud Marketplace, such as signing\n up for your product.\n\n2. Cloud Marketplace sends your app a notification through\n Pub/Sub, containing information about the request in the\n `eventType` field. For example, if a user changes their entitlement,\n the `eventType` is `ENTITLEMENT_PLAN_CHANGED`.\n\n See the\n [full list of possible values for `eventType`](/marketplace/docs/partners/integrated-saas/manage-entitlements#eventtypes).\n3. To approve the request, your app sends an `HTTP POST` request to the\n Partner Procurement API.\n\nThe following sections describe the types of requests that users can make,\nand what your app must do to handle the requests.\n\nFor the API calls described in this section, use this endpoint: \n\n https://cloudcommerceprocurement.googleapis.com/\n\nBefore you begin\n----------------\n\n- Set up access to the Cloud Commerce Partner Procurement API, as described in [Integrate your app](/marketplace/docs/partners/integrated-saas/technical-integration-setup).\n\nCreate an account for a new user\n--------------------------------\n\nWhen a user first purchases your product, Cloud Marketplace creates an account resource that tracks the user's relationship with you. For subsequent purchases against products owned by you, same account resource will be reused. Whenever a user makes their first purchase of any of your products, if you've turned on account notifications for that product, then you're notified through the Pub/Sub topic created for you. The Pub/Sub message is in the following\nformat: \n\n```json\n{\n \"eventId\": \"...\",\n \"providerId\": \"\u003cvar translate=\"no\"\u003eYOUR_PARTNER_ID\u003c/var\u003e\",\n \"account\": {\n \"id\": \"\u003cvar translate=\"no\"\u003eUSER_ACCOUNT_ID\u003c/var\u003e\",\n \"updateTime\": \"...\"\n }\n}\n```\n\nwhere \u003cvar translate=\"no\"\u003eUSER_ACCOUNT_ID\u003c/var\u003e is the account ID created by\nCloud Marketplace and \u003cvar translate=\"no\"\u003eYOUR_PARTNER_ID\u003c/var\u003e is an ID assigned to you when your Partner\nEngineer enables access to the Partner Procurement API.\n\nSimultaneously, the user is directed to your sign-up page, where they create an\naccount in your system. For information on creating the sign-up page, see\n[Integrating your app's frontend](/marketplace/docs/partners/integrated-saas/frontend-integration).\n\nApprove a user's account\n------------------------\n\nAfter the user has successfully signed up, your app must call the\nPartner Procurement API and indicate that the account has been approved.\nAccounts are created in the `ACCOUNT_ACTIVE` state, but they have a `PENDING`\nentry in the `approvals` field called `signup`, which indicates that the user\nhas not yet signed up. To approve the account after the user has signed up, use\nthe following `HTTP POST` request: \n\n```\nPOST v1/providers/YOUR_PARTNER_ID/accounts/USER_ACCOUNT_ID:approve {'approvalName': 'signup'}\n```\n\nCheck the status of a user's account\n------------------------------------\n\nTo check the status of a linked account, use the following `HTTP GET` request: \n\n```\nGET v1/providers/YOUR_PARTNER_ID/accounts/USER_ACCOUNT_ID\n```\n\nThe response is in the following format: \n\n```json\n{\n \"name\": \"providers/\u003cvar translate=\"no\"\u003eYOUR_PARTNER_ID\u003c/var\u003e/accounts/\u003cvar translate=\"no\"\u003eUSER_ACCOUNT_ID\u003c/var\u003e\",\n \"provider\": \"acme-services\",\n \"state\": \"ACCOUNT_ACTIVE\",\n \"approvals\": [{\n \"name\": \"signup\",\n \"state\": \"APPROVED\",\n \"updateTime\": \"...\",\n }],\n \"updateTime\": \"...\",\n \"createTime\": \"...\"\n}\n```\n\nFor a list of possible account states, see the\n[`providers.accounts` API reference](/marketplace/docs/partners/commerce-procurement-api/reference/rest/v1/providers.accounts#state)."]]