AI-generated Key Takeaways
- 
          The batchUpdateStatesmethod activates or deactivates purchase options for one or multiple one-time products using a POST request.
- 
          The request requires path parameters for packageNameandproductId, whereproductIdcan be "-" for batch updates across multiple products.
- 
          The request body contains a list of up to 100 UpdatePurchaseOptionStateRequestobjects, each specifying whether to activate or deactivate a purchase option.
- 
          A successful response body includes a list of updated one-time products. 
- 
          Authorization requires the https://www.googleapis.com/auth/androidpublisherOAuth scope.
- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- UpdatePurchaseOptionStateRequest
- ActivatePurchaseOptionRequest
- DeactivatePurchaseOptionRequest
- 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 syntax.
Path parameters
| Parameters | |
|---|---|
| packageName | 
 Required. The parent app (package name) of the updated purchase options. | 
| productId | 
 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 ( | 
| Fields | |
|---|---|
| requests[] | 
 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 ( | 
| Fields | |
|---|---|
| oneTimeProducts[] | 
 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 | 
| Fields | |
|---|---|
| Union field state_transition_type. The type of state transition to apply, exactly one must be set.state_transition_typecan be only one of the following: | |
| activatePurchaseOptionRequest | 
 Activates a purchase option. Once activated, the purchase option will be available. | 
| 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 ( | 
| Fields | |
|---|---|
| packageName | 
 Required. The parent app (package name) of the purchase option to activate. | 
| productId | 
 Required. The parent one-time product (ID) of the purchase option to activate. | 
| purchaseOptionId | 
 Required. The purchase option ID of the purchase option to activate. | 
| latencyTolerance | 
 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 ( | 
| Fields | |
|---|---|
| packageName | 
 Required. The parent app (package name) of the purchase option to deactivate. | 
| productId | 
 Required. The parent one-time product (ID) of the purchase option to deactivate. | 
| purchaseOptionId | 
 Required. The purchase option ID of the purchase option to deactivate. | 
| latencyTolerance | 
 Optional. The latency tolerance for the propagation of this product update. Defaults to latency-sensitive. |