# Method: monetization.onetimeproducts.purchaseOptions.batchUpdateStates

- [HTTP request](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.request_body)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.response_body)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.BatchUpdatePurchaseOptionStatesResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#body.aspect)
- [UpdatePurchaseOptionStateRequest](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#UpdatePurchaseOptionStateRequest)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#UpdatePurchaseOptionStateRequest.SCHEMA_REPRESENTATION)
- [ActivatePurchaseOptionRequest](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#ActivatePurchaseOptionRequest)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#ActivatePurchaseOptionRequest.SCHEMA_REPRESENTATION)
- [DeactivatePurchaseOptionRequest](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#DeactivatePurchaseOptionRequest)
  - [JSON representation](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#DeactivatePurchaseOptionRequest.SCHEMA_REPRESENTATION)
- [Try it!](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#try-it)

Activates or deactivates purchase options across one or multiple one-time products.

### HTTP request

`POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions:batchUpdateStates`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `packageName` | `string` Required. The parent app (package name) of the updated purchase options. |
| `productId` | `string` Required. The product ID of the parent one-time product, if all updated purchase options belong to the same one-time product. If this batch update spans multiple one-time products, set this field to "-". |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requests": [ { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#UpdatePurchaseOptionStateRequest`) } ] } ``` |

| Fields ||
|---|---|
| `requests[]` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#UpdatePurchaseOptionStateRequest`)`` Required. The update request list of up to 100 elements. All requests must update different purchase options. |

### Response body

Response message for purchaseOptions.batchUpdateStates.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "oneTimeProducts": [ { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts#OneTimeProduct`) } ] } ``` |

| Fields ||
|---|---|
| `oneTimeProducts[]` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts#OneTimeProduct`)`` The list of updated one-time products. This list will match the requests one to one, in the same order. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/androidpublisher`

## UpdatePurchaseOptionStateRequest

Request message to update the state of a one-time product purchase option.

| JSON representation |
|---|
| ``` { // Union field `state_transition_type` can be only one of the following: "activatePurchaseOptionRequest": { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#ActivatePurchaseOptionRequest`) }, "deactivatePurchaseOptionRequest": { object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#DeactivatePurchaseOptionRequest`) } // End of list of possible types for union field `state_transition_type`. } ``` |

| Fields ||
|---|---|
| Union field `state_transition_type`. The type of state transition to apply, exactly one must be set. `state_transition_type` can be only one of the following: ||
| `activatePurchaseOptionRequest` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#ActivatePurchaseOptionRequest`)`` Activates a purchase option. Once activated, the purchase option will be available. |
| `deactivatePurchaseOptionRequest` | ``object (`https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.onetimeproducts.purchaseOptions/batchUpdateStates#DeactivatePurchaseOptionRequest`)`` Deactivates a purchase option. Once deactivated, the purchase option will become unavailable. |

## ActivatePurchaseOptionRequest

Request message for UpdatePurchaseOptionState.

| JSON representation |
|---|
| ``` { "packageName": string, "productId": string, "purchaseOptionId": string, "latencyTolerance": enum (`https://developers.google.com/android-publisher/api-ref/rest/v3/ProductUpdateLatencyTolerance`) } ``` |

| Fields ||
|---|---|
| `packageName` | `string` Required. The parent app (package name) of the purchase option to activate. |
| `productId` | `string` Required. The parent one-time product (ID) of the purchase option to activate. |
| `purchaseOptionId` | `string` Required. The purchase option ID of the purchase option to activate. |
| `latencyTolerance` | ``enum (`https://developers.google.com/android-publisher/api-ref/rest/v3/ProductUpdateLatencyTolerance`)`` Optional. The latency tolerance for the propagation of this product update. Defaults to latency-sensitive. |

## DeactivatePurchaseOptionRequest

Request message for UpdatePurchaseOptionState.

| JSON representation |
|---|
| ``` { "packageName": string, "productId": string, "purchaseOptionId": string, "latencyTolerance": enum (`https://developers.google.com/android-publisher/api-ref/rest/v3/ProductUpdateLatencyTolerance`) } ``` |

| Fields ||
|---|---|
| `packageName` | `string` Required. The parent app (package name) of the purchase option to deactivate. |
| `productId` | `string` Required. The parent one-time product (ID) of the purchase option to deactivate. |
| `purchaseOptionId` | `string` Required. The purchase option ID of the purchase option to deactivate. |
| `latencyTolerance` | ``enum (`https://developers.google.com/android-publisher/api-ref/rest/v3/ProductUpdateLatencyTolerance`)`` Optional. The latency tolerance for the propagation of this product update. Defaults to latency-sensitive. |