Package androidpublisher provides access to the Google Play Developer API.

For product documentation, see:

Creating a client

Usage example:

import ""
ctx := context.Background()
androidpublisherService, err := androidpublisher.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

androidpublisherService, err := androidpublisher.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
androidpublisherService, err := androidpublisher.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See for details on options.



View Source
const (
	// View and manage your Google Play Developer account
	AndroidpublisherScope = ""

    OAuth2 scopes used by this API.


    This section is empty.


    This section is empty.


    type InappPurchase

    type InappPurchase struct {
    	// ConsumptionState: The consumption state of the inapp product.
    	// Possible values are:
    	// - Yet to be consumed
    	// - Consumed
    	ConsumptionState int64 `json:"consumptionState,omitempty"`
    	// DeveloperPayload: A developer-specified string that contains
    	// supplemental information about an order.
    	DeveloperPayload string `json:"developerPayload,omitempty"`
    	// Kind: This kind represents an inappPurchase object in the
    	// androidpublisher service.
    	Kind string `json:"kind,omitempty"`
    	// OrderId: The order id associated with the purchase of the inapp
    	// product.
    	OrderId string `json:"orderId,omitempty"`
    	// PurchaseState: The purchase state of the order. Possible values are:
    	// - Purchased
    	// - Canceled
    	// - Pending
    	PurchaseState int64 `json:"purchaseState,omitempty"`
    	// PurchaseTime: The time the product was purchased, in milliseconds
    	// since the epoch (Jan 1, 1970).
    	PurchaseTime int64 `json:"purchaseTime,omitempty,string"`
    	// PurchaseType: The type of purchase of the inapp product. This field
    	// is only set if this purchase was not made using the standard in-app
    	// billing flow. Possible values are:
    	// - Test (i.e. purchased from a license testing account)
    	// - Promo (i.e. purchased using a promo code)
    	// - Rewarded (i.e. from watching a video ad instead of paying)
    	PurchaseType *int64 `json:"purchaseType,omitempty"`
    	// ServerResponse contains the HTTP response code and headers from the
    	// server.
    	googleapi.ServerResponse `json:"-"`
    	// ForceSendFields is a list of field names (e.g. "ConsumptionState") to
    	// unconditionally include in API requests. By default, fields with
    	// empty values are omitted from API requests. However, any non-pointer,
    	// non-interface field appearing in ForceSendFields will be sent to the
    	// server regardless of whether the field is empty or not. This may be
    	// used to include empty fields in Patch requests.
    	ForceSendFields []string `json:"-"`
    	// NullFields is a list of field names (e.g. "ConsumptionState") to
    	// include in API requests with the JSON null value. By default, fields
    	// with empty values are omitted from API requests. However, any field
    	// with an empty value appearing in NullFields will be sent to the
    	// server as null. It is an error if a field in this list has a
    	// non-empty value. This may be used to include null fields in Patch
    	// requests.
    	NullFields []string `json:"-"`

      InappPurchase: An InappPurchase resource indicates the status of a user's inapp product purchase.

      func (*InappPurchase) MarshalJSON

      func (s *InappPurchase) MarshalJSON() ([]byte, error)

      type InapppurchasesGetCall

      type InapppurchasesGetCall struct {
      	// contains filtered or unexported fields

      func (*InapppurchasesGetCall) Context

        Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

        func (*InapppurchasesGetCall) Do

          Do executes the "androidpublisher.inapppurchases.get" call. Exactly one of *InappPurchase or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *InappPurchase.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

          func (*InapppurchasesGetCall) Fields

            Fields allows partial responses to be retrieved. See for more information.

            func (*InapppurchasesGetCall) Header

            func (c *InapppurchasesGetCall) Header() http.Header

              Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

              func (*InapppurchasesGetCall) IfNoneMatch

              func (c *InapppurchasesGetCall) IfNoneMatch(entityTag string) *InapppurchasesGetCall

                IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

                type InapppurchasesService

                type InapppurchasesService struct {
                	// contains filtered or unexported fields

                func NewInapppurchasesService

                func NewInapppurchasesService(s *Service) *InapppurchasesService

                func (*InapppurchasesService) Get

                func (r *InapppurchasesService) Get(packageName string, productId string, token string) *InapppurchasesGetCall

                  Get: Checks the purchase and consumption status of an inapp item.

                  type Service

                  type Service struct {
                  	BasePath  string // API endpoint base URL
                  	UserAgent string // optional additional User-Agent fragment
                  	Inapppurchases *InapppurchasesService
                  	// contains filtered or unexported fields

                  func New

                  func New(client *http.Client) (*Service, error)

                    New creates a new Service. It uses the provided http.Client for requests.

                    Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using, use option.WithAPIKey with NewService instead.

                    func NewService

                    func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

                      NewService creates a new Service.