Documentation ¶
Index ¶
- func HasErrorPurchaseTokenNoLongerValid(err error) bool
- func IsErrorCode410(err error) bool
- func SetTimeout(t time.Duration)
- type Client
- func (c *Client) AcknowledgeProduct(packageName, productID, token string) error
- func (c *Client) AcknowledgeSubscription(packageName, subscriptionID, token string) error
- func (c *Client) CancelSubscription(packageName, subscriptionID, token string) error
- func (c *Client) GetProduct(packageName, productID, token string) (*androidpublisher.ProductPurchase, error)
- func (c *Client) GetSubscription(packageName, productID, token string) (*androidpublisher.SubscriptionPurchase, error)
- func (c *Client) IsAcknowledgedProduct(packageName, productID, token string) (bool, error)
- func (c *Client) IsAcknowledgedSubscription(packageName, subscriptionID, token string) (bool, error)
- func (c *Client) Verify(packageName, productID, token string) (*IABResponse, error)
- func (c *Client) VerifyProduct(packageName, productID, token string) (*IABResponse, error)
- func (c *Client) VerifySubscription(packageName, productID, token string) (*IABResponse, error)
- type IABClient
- type IABResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasErrorPurchaseTokenNoLongerValid ¶ added in v0.2.1
HasErrorPurchaseTokenNoLongerValid checks if the error contains "purchaseTokenNoLongerValid".
func IsErrorCode410 ¶ added in v0.2.1
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.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
The Client type implements VerifySubscription method
func New ¶
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 (*Client) AcknowledgeProduct ¶ added in v0.3.2
AcknowledgeProduct acknowledges the product.
func (*Client) AcknowledgeSubscription ¶ added in v0.3.2
AcknowledgeSubscription acknowledges the subscription.
func (*Client) CancelSubscription ¶
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
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