Documentation ¶
Index ¶
- func VerifySignature(base64EncodedPublicKey string, receipt []byte, signature string) (isValid bool, err error)
- type Client
- func (c *Client) AcknowledgeProduct(ctx context.Context, packageName, productID, token, developerPayload string) error
- func (c *Client) AcknowledgeSubscription(ctx context.Context, packageName string, subscriptionID string, token string, ...) error
- func (c *Client) CancelSubscription(ctx context.Context, packageName string, subscriptionID string, token string) error
- func (c *Client) RefundSubscription(ctx context.Context, packageName string, subscriptionID string, token string) error
- func (c *Client) RevokeSubscription(ctx context.Context, packageName string, subscriptionID string, token string) error
- func (c *Client) VerifyProduct(ctx context.Context, packageName string, productID string, token string) (*androidpublisher.ProductPurchase, error)
- func (c *Client) VerifySubscription(ctx context.Context, packageName string, subscriptionID string, token string) (*androidpublisher.SubscriptionPurchase, error)
- type DeveloperNotification
- type IABProduct
- type IABSubscription
- type OneTimeProductNotification
- type OneTimeProductNotificationType
- type SubscriptionNotification
- type SubscriptionNotificationType
- type TestNotification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 NewWithClient ¶
NewWithClient returns http client which includes the custom http client.
func (*Client) AcknowledgeProduct ¶ added in v1.3.0
func (*Client) AcknowledgeSubscription ¶ added in v1.1.0
func (c *Client) AcknowledgeSubscription( ctx context.Context, packageName string, subscriptionID string, token string, req *androidpublisher.SubscriptionPurchasesAcknowledgeRequest, ) error
AcknowledgeSubscription acknowledges a subscription purchase.
func (*Client) CancelSubscription ¶
func (c *Client) CancelSubscription(ctx context.Context, packageName string, subscriptionID string, token string) error
CancelSubscription cancels a user's subscription purchase.
func (*Client) RefundSubscription ¶
func (c *Client) RefundSubscription(ctx context.Context, 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(ctx context.Context, 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( ctx context.Context, packageName string, productID string, token string, ) (*androidpublisher.ProductPurchase, error)
VerifyProduct verifies product status
func (*Client) VerifySubscription ¶
func (c *Client) VerifySubscription( ctx context.Context, 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"` OneTimeProductNotification OneTimeProductNotification `json:"oneTimeProductNotification,omitempty"` TestNotification TestNotification `json:"testNotification,omitempty"` }
DeveloperNotification is sent by a Pub/Sub topic. Detailed description is following. https://developer.android.com/google/play/billing/rtdn-reference#json_specification
type IABProduct ¶ added in v1.1.0
type IABProduct interface { VerifyProduct(context.Context, string, string, string) (*androidpublisher.ProductPurchase, error) AcknowledgeProduct(context.Context, string, string, string, string) error }
The IABProduct type is an interface for product service
type IABSubscription ¶ added in v1.1.0
type IABSubscription interface { AcknowledgeSubscription(context.Context, string, string, string, *androidpublisher.SubscriptionPurchasesAcknowledgeRequest) error VerifySubscription(context.Context, string, string, string) (*androidpublisher.SubscriptionPurchase, error) CancelSubscription(context.Context, string, string, string) error RefundSubscription(context.Context, string, string, string) error RevokeSubscription(context.Context, string, string, string) error }
The IABSubscription type is an interface for subscription service
type OneTimeProductNotification ¶ added in v1.3.3
type OneTimeProductNotification struct { Version string `json:"version"` NotificationType OneTimeProductNotificationType `json:"notificationType,omitempty"` PurchaseToken string `json:"purchaseToken,omitempty"` SKU string `json:"sku,omitempty"` }
OneTimeProductNotification has one-time product status as notificationType, token and sku (product id) to confirm status by calling Google Android Publisher API.
type OneTimeProductNotificationType ¶ added in v1.3.3
type OneTimeProductNotificationType int
https://developer.android.com/google/play/billing/rtdn-reference#one-time
const ( OneTimeProductNotificationTypePurchased OneTimeProductNotificationType = iota + 1 OneTimeProductNotificationTypeCanceled )
type SubscriptionNotification ¶
type SubscriptionNotification struct { Version string `json:"version"` NotificationType SubscriptionNotificationType `json:"notificationType,omitempty"` PurchaseToken string `json:"purchaseToken,omitempty"` SubscriptionID string `json:"subscriptionId,omitempty"` }
SubscriptionNotification has subscription status as notificationType, token and subscription id to confirm status by calling Google Android Publisher API.
type SubscriptionNotificationType ¶ added in v1.3.3
type SubscriptionNotificationType int
https://developer.android.com/google/play/billing/rtdn-reference#sub
const ( SubscriptionNotificationTypeRecovered SubscriptionNotificationType = iota + 1 SubscriptionNotificationTypeRenewed SubscriptionNotificationTypeCanceled SubscriptionNotificationTypePurchased SubscriptionNotificationTypeAccountHold SubscriptionNotificationTypeGracePeriod SubscriptionNotificationTypeRestarted SubscriptionNotificationTypePriceChangeConfirmed SubscriptionNotificationTypeDeferred SubscriptionNotificationTypePaused SubscriptionNotificationTypePauseScheduleChanged SubscriptionNotificationTypeRevoked SubscriptionNotificationTypeExpired )
type TestNotification ¶ added in v1.3.3
type TestNotification struct {
Version string `json:"version"`
}
TestNotification is the test publish that are sent only through the Google Play Developer Console