playstore

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasErrorPurchaseTokenNoLongerValid added in v0.2.1

func HasErrorPurchaseTokenNoLongerValid(err error) bool

HasErrorPurchaseTokenNoLongerValid checks if the error contains "purchaseTokenNoLongerValid".

func IsErrorCode410 added in v0.2.1

func IsErrorCode410(err error) bool

IsErrorCode410 checks if the error is 410 or not. Sometimes Google API returns 410 error "purchaseTokenNoLongerValid" when the token is invalid now. This often occurs when the user delete their Google account then their subscription are also deleted.

func SetTimeout

func SetTimeout(t time.Duration)

SetTimeout sets dial timeout duration

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

The Client type implements VerifySubscription method

func New

func New(jsonKey []byte) (Client, error)

New returns http client which includes the credentials to access androidpublisher API. You should create a service account for your project at https://console.developers.google.com and download a JSON key file to set this argument.

func NewWithParams

func NewWithParams(key, email string) Client

func (*Client) AcknowledgeProduct added in v0.3.2

func (c *Client) AcknowledgeProduct(packageName, productID, token string) error

AcknowledgeProduct acknowledges the product.

func (*Client) AcknowledgeSubscription added in v0.3.2

func (c *Client) AcknowledgeSubscription(packageName, subscriptionID, token string) error

AcknowledgeSubscription acknowledges the subscription.

func (*Client) CancelSubscription

func (c *Client) CancelSubscription(packageName, subscriptionID, token string) error

CancelSubscription cancels recurring payment of given subscription

func (*Client) GetProduct added in v0.3.3

func (c *Client) GetProduct(packageName, productID, token string) (*androidpublisher.ProductPurchase, error)

GetProduct gets the product item status.

func (*Client) GetSubscription added in v0.3.3

func (c *Client) GetSubscription(packageName, productID, token string) (*androidpublisher.SubscriptionPurchase, error)

GetSubscription gets the subscription item status.

func (*Client) IsAcknowledgedProduct added in v0.3.2

func (c *Client) IsAcknowledgedProduct(packageName, productID, token string) (bool, error)

IsAcknowledgedProduct checks if the product is acknowledged or not.

func (*Client) IsAcknowledgedSubscription added in v0.3.2

func (c *Client) IsAcknowledgedSubscription(packageName, subscriptionID, token string) (bool, error)

IsAcknowledgedSubscription checks if the subscription is acknowledged or not.

func (*Client) Verify

func (c *Client) Verify(packageName, productID, token string) (*IABResponse, error)

Verify retrieves product and subscription status from GooglePlay API

func (*Client) VerifyProduct

func (c *Client) VerifyProduct(packageName, productID, token string) (*IABResponse, error)

VerifyProduct retrieves product status from GooglePlay API

func (*Client) VerifySubscription

func (c *Client) VerifySubscription(packageName, productID, token string) (*IABResponse, error)

VerifySubscription retrieves product status from GooglePlay API

type IABClient

type IABClient interface {
	VerifySubscription(string, string, string) (*androidpublisher.SubscriptionPurchase, error)
	VerifyProduct(string, string, string) (*androidpublisher.ProductPurchase, error)
}

The IABClient type is an interface to verify purchase token

type IABResponse

type IABResponse struct {
	*androidpublisher.ProductPurchase
	*androidpublisher.SubscriptionPurchase
}

IABResponse is wrapper struct for Product and Subscription response

func (IABResponse) IsActive

func (r IABResponse) IsActive() bool

IsActive checks if the subscription has active recurring status

func (IABResponse) IsExpired

func (r IABResponse) IsExpired() bool

IsExpired checks if the subscription has been already expired

func (IABResponse) IsValidProduct

func (r IABResponse) IsValidProduct() bool

IsValidProduct checks if the purchase token is valid or not for product

func (IABResponse) IsValidReceipt

func (r IABResponse) IsValidReceipt() bool

IsValidReceipt checks if the purchase token is valid or not

func (IABResponse) IsValidSubscription

func (r IABResponse) IsValidSubscription() bool

IsValidSubscription checks if the purchase token is valid or not for subscription

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL