- [HTTP request](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#body.request_body)
  - [JSON representation](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#body.response_body)
  - [JSON representation](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#body.GenerateUserSessionResponse.SCHEMA_REPRESENTATION)
- [IntentPayload](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentPayload)
  - [JSON representation](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentPayload.SCHEMA_REPRESENTATION)
- [CreateSubscriptionIntent](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#CreateSubscriptionIntent)
  - [JSON representation](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#CreateSubscriptionIntent.SCHEMA_REPRESENTATION)
- [EntitleSubscriptionIntent](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#EntitleSubscriptionIntent)
  - [JSON representation](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#EntitleSubscriptionIntent.SCHEMA_REPRESENTATION)
- [IntentOptions](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentOptions)
  - [JSON representation](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentOptions.SCHEMA_REPRESENTATION)

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](https://google.aip.dev/127) 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 (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentPayload`) } } ``` |

| Fields ||
|---|---|
| `intentPayload` | ``object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#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 (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions#UserSession`) } } ``` |

| Fields ||
|---|---|
| `userSession` | ``object (`https://developers.google.com/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. |

## IntentPayload

The payload that describes the user intent.

| JSON representation |
|---|
| ``` { "intentOptions": { object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentOptions`) }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "createIntent": { object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#CreateSubscriptionIntent`) }, "entitleIntent": { object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#EntitleSubscriptionIntent`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `intentOptions` | ``object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#IntentOptions`)`` Optional. The additional features for the intent. |
| The intent types. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `createIntent` | ``object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#CreateSubscriptionIntent`)`` The request to create a subscription. |
| `entitleIntent` | ``object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.userSessions/generate#EntitleSubscriptionIntent`)`` The request to entitle a subscription. |
| End of mutually exclusive fields. ||

## CreateSubscriptionIntent

Intent message for creating a Subscription resource.

| JSON representation |
|---|
| ``` { "parent": string, "subscription": { object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.subscriptions#Subscription`) }, "subscriptionId": string, "cycleOptions": { object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/CycleOptions`) } } ``` |

| Fields ||
|---|---|
| `parent (deprecated)` | `string` > [!WARNING] > This item is deprecated! Optional. Deprecated: Use the `parent` field in `GenerateUserSessionRequest` instead. The parent resource name, which is the identifier of the partner. |
| `subscription` | ``object (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.subscriptions#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 (`https://developers.google.com/payments/reseller/subscription/reference/rest/v1/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}". |

## IntentOptions

The options for the intent.

| JSON representation |
|---|
| ``` { "enableOfferOverride": boolean } ``` |

| Fields ||
|---|---|
| `enableOfferOverride` | `boolean` Optional. If true, Google may use a different product and promotion id from the ones in the `createIntent` based on the user's eligibility. Only applicable for certain YouTube free trial offers. |