playstore

package
v0.0.0-...-3b203a9 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTimeout

func SetTimeout(t time.Duration)

SetTimeout sets dial timeout duration

func VerifySignature

func VerifySignature(base64EncodedPublicKey string, receipt []byte, signature string) (isValid bool, err error)

VerifySignature verifies in app billing signature. You need to prepare a public key for your Android app's in app billing at https://play.google.com/apps/publish/

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 (*Client) CancelSubscription

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

CancelSubscription cancels a user's subscription purchase.

func (*Client) RefundSubscription

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

RefundSubscription refunds a user's subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur.

func (*Client) RevokeSubscription

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

RevokeSubscription refunds and immediately revokes a user's subscription purchase. Access to the subscription will be terminated immediately and it will stop recurring.

func (*Client) VerifyProduct

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

VerifyProduct verifies product status

func (*Client) VerifySubscription

func (c *Client) VerifySubscription(
	packageName string,
	subscriptionID string,
	token string,
) (*androidpublisher.SubscriptionPurchase, error)

VerifySubscription verifies subscription status

type DeveloperNotification

type DeveloperNotification struct {
	Version                  string                   `json:"version"`
	PackageName              string                   `json:"packageName"`
	EventTimeMillis          string                   `json:"eventTimeMillis"`
	SubscriptionNotification SubscriptionNotification `json:"subscriptionNotification,omitempty"`
	TestNotification         SubscriptionNotification `json:"testNotification,omitempty"`
}

DeveloperNotification is sent by a Pub/Sub topic. Detailed description is following. https://developer.android.com/google/play/billing/realtime_developer_notifications.html#json_specification

type IABClient

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

The IABClient type is an interface to verify purchase token

type NotificationType

type NotificationType int
const (
	NotificationTypeRecovered NotificationType = iota + 1
	NotificationTypeRenewed
	NotificationTypeCanceled
	NotificationTypePurchased
	NotificationTypeAccountHold
	NotificationTypeGracePeriod
	NotificationTypeReactivated
)

type SubscriptionNotification

type SubscriptionNotification struct {
	Version          string           `json:"version"`
	NotificationType NotificationType `json:"notificationType,omitempty"`
	PurchaseToken    string           `json:"purchaseToken,omitempty"`
	SubscriptionID   string           `json:"subscriptionId,omitempty"`
}

SubscriptionNotification has subscription status as notificationType, toke and subscription id to confirm status by calling Google Android Publisher API.

Jump to

Keyboard shortcuts

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