Method: partners.userSessions.generate
Stay organized with collections
Save and categorize content based on your preferences.
This API replaces user authorized OAuth consent based APIs (Create, Entitle). Issues a timed session token for the given user intent. You can use the session token to redirect the user to Google to finish the signup flow. You can re-generate new session token repeatedly for the same request if necessary, regardless of the previous tokens being expired or not. By default, the session token is valid for 1 hour.
HTTP request
POST https://paymentsresellersubscription.googleapis.com/v1/{parent=partners/*}/userSessions:generate
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters |
parent |
string
Required. The parent, the partner that can resell. Format: partners/{partner}
|
Request body
The request body contains data with the following structure:
JSON representation |
{
"intentPayload": {
object (IntentPayload )
}
} |
Fields |
intentPayload |
object (IntentPayload )
The user intent to generate the user session.
|
Response body
Response that contains the details for generated user session.
If successful, the response body contains data with the following structure:
JSON representation |
{
"userSession": {
object (UserSession )
}
} |
Fields |
userSession |
object (UserSession )
The generated user session. The token size is proportional to the size of the intent payload.
|
IntentPayload
The payload that describes the user intent.
JSON representation |
{
// Union field request can be only one of the following:
"createIntent": {
object (CreateSubscriptionIntent )
},
"entitleIntent": {
object (EntitleSubscriptionIntent )
}
// End of list of possible types for union field request .
} |
Fields |
Union field request . The intent types. request can be only one of the following: |
createIntent |
object (CreateSubscriptionIntent )
The request to create a subscription.
|
entitleIntent |
object (EntitleSubscriptionIntent )
The request to entitle a subscription.
|
CreateSubscriptionIntent
Intent message for creating a Subscription resource.
JSON representation |
{
"parent": string,
"subscription": {
object (Subscription )
},
"subscriptionId": string,
"cycleOptions": {
object (CycleOptions )
}
} |
Fields |
parent |
string
Required. The parent resource name, which is the identifier of the partner.
|
subscription |
object (Subscription )
Required. The Subscription to be created.
|
subscriptionId |
string
Required. Identifies the subscription resource on the Partner side. The value is restricted to 63 ASCII characters at the maximum. If a subscription was previously created with the same subscriptionId, we will directly return that one.
|
cycleOptions |
object (CycleOptions )
Optional. The cycle options for the subscription.
|
EntitleSubscriptionIntent
Intent for entitling the previously provisioned subscription to an end user.
JSON representation |
{
"name": string
} |
Fields |
name |
string
Required. The name of the subscription resource that is entitled to the current end user. It is in the format of "partners/{partner_id}/subscriptions/{subscriptionId}".
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-13 UTC.
[null,null,["Last updated 2025-08-13 UTC."],[[["\u003cp\u003eThis API generates a short-lived user session token, replacing OAuth consent for subscription creation and entitlement.\u003c/p\u003e\n"],["\u003cp\u003eThe session token allows users to complete the signup flow via Google, and can be regenerated as needed.\u003c/p\u003e\n"],["\u003cp\u003eThe API accepts an intent payload specifying either a subscription creation or entitlement request.\u003c/p\u003e\n"],["\u003cp\u003eThe request body includes details like the parent partner, subscription information, and subscription ID (for creation).\u003c/p\u003e\n"],["\u003cp\u003eA successful response provides a user session object containing the generated token.\u003c/p\u003e\n"]]],["This API uses a `POST` request to `https://paymentsresellersubscription.googleapis.com/v1/{parent=partners/*}/userSessions:generate` to create a user session token. The request requires a `parent` path parameter (partner ID) and a JSON request body containing an `intentPayload`. This payload can specify either a `createIntent` for new subscriptions or an `entitleIntent` for existing ones. The response returns a `userSession` object containing a short-lived token. This token allows redirecting users to Google to complete their subscription signup. The `createIntent` uses the `subscriptionId`, `subscription` and `parent` fields. The `entitleIntent` uses the `name` field.\n"],null,["# Method: partners.userSessions.generate\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.GenerateUserSessionResponse.SCHEMA_REPRESENTATION)\n- [IntentPayload](#IntentPayload)\n - [JSON representation](#IntentPayload.SCHEMA_REPRESENTATION)\n- [CreateSubscriptionIntent](#CreateSubscriptionIntent)\n - [JSON representation](#CreateSubscriptionIntent.SCHEMA_REPRESENTATION)\n- [EntitleSubscriptionIntent](#EntitleSubscriptionIntent)\n - [JSON representation](#EntitleSubscriptionIntent.SCHEMA_REPRESENTATION)\n\nThis API replaces user authorized OAuth consent based APIs (Create, Entitle). Issues a timed session token for the given user intent. You can use the session token to redirect the user to Google to finish the signup flow. You can re-generate new session token repeatedly for the same request if necessary, regardless of the previous tokens being expired or not. By default, the session token is valid for 1 hour.\n\n### HTTP request\n\n`POST https://paymentsresellersubscription.googleapis.com/v1/{parent=partners/*}/userSessions:generate`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|----------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent, the partner that can resell. Format: partners/{partner} |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"intentPayload\": { object (/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentPayload) } } ``` |\n\n| Fields ||\n|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `intentPayload` | `object (`[IntentPayload](/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentPayload)`)` The user intent to generate the user session. |\n\n### Response body\n\nResponse that contains the details for generated user session.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"userSession\": { object (/payments/reseller/subscription/reference/rest/v1/partners.userSessions#UserSession) } } ``` |\n\n| Fields ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `userSession` | `object (`[UserSession](/payments/reseller/subscription/reference/rest/v1/partners.userSessions#UserSession)`)` The generated user session. The token size is proportional to the size of the intent payload. |\n\nIntentPayload\n-------------\n\nThe payload that describes the user intent.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { // Union field `request` can be only one of the following: \"createIntent\": { object (/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#CreateSubscriptionIntent) }, \"entitleIntent\": { object (/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#EntitleSubscriptionIntent) } // End of list of possible types for union field `request`. } ``` |\n\n| Fields ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Union field `request`. The intent types. `request` can be only one of the following: ||\n| `createIntent` | `object (`[CreateSubscriptionIntent](/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#CreateSubscriptionIntent)`)` The request to create a subscription. |\n| `entitleIntent` | `object (`[EntitleSubscriptionIntent](/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#EntitleSubscriptionIntent)`)` The request to entitle a subscription. |\n\nCreateSubscriptionIntent\n------------------------\n\nIntent message for creating a Subscription resource.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"parent\": string, \"subscription\": { object (/payments/reseller/subscription/reference/rest/v1/partners.subscriptions#Subscription) }, \"subscriptionId\": string, \"cycleOptions\": { object (/payments/reseller/subscription/reference/rest/v1/CycleOptions) } } ``` |\n\n| Fields ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent resource name, which is the identifier of the partner. |\n| `subscription` | `object (`[Subscription](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions#Subscription)`)` Required. The Subscription to be created. |\n| `subscriptionId` | `string` Required. Identifies the subscription resource on the Partner side. The value is restricted to 63 ASCII characters at the maximum. If a subscription was previously created with the same subscriptionId, we will directly return that one. |\n| `cycleOptions` | `object (`[CycleOptions](/payments/reseller/subscription/reference/rest/v1/CycleOptions)`)` Optional. The cycle options for the subscription. |\n\nEntitleSubscriptionIntent\n-------------------------\n\nIntent for entitling the previously provisioned subscription to an end user.\n\n| JSON representation |\n|----------------------------|\n| ``` { \"name\": string } ``` |\n\n| Fields ||\n|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The name of the subscription resource that is entitled to the current end user. It is in the format of \"partners/{partner_id}/subscriptions/{subscriptionId}\". |"]]