cafebazaar

package
v0.0.0-...-7deac6a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	OAuth  *oauth2.Config
	Client *http.Client
}

Client provides Cafebazaar in-app billing API.

func NewClient

func NewClient(clientID, clientSecret, redirectUrl string) *Client

NewClient creates a new Cafebazaar client.

func (*Client) AuthCodeURL

func (c *Client) AuthCodeURL() string

AuthCodeURL returns URL to which user must be redirected to be asked for permission.

func (*Client) CancelSubscription

func (c *Client) CancelSubscription(pkg, prod, token string) error

CancelSubscription cancels a subscription purchase.

func (*Client) Setup

func (c *Client) Setup(authCode string) (*oauth2.Token, error)

Setup initializes the client by providing authorization code.

func (*Client) SetupWithToken

func (c *Client) SetupWithToken(tok *oauth2.Token)

func (*Client) ValidateProduct

func (c *Client) ValidateProduct(pkg, prod, token string) (*Product, error)

ValidateProduct checks the purchase and consumption status of an in-app product.

func (*Client) ValidateSubscription

func (c *Client) ValidateSubscription(pkg, prod, token string) (*Subscription, error)

ValidateSubscription checks the purchase and consumption status of a subscription.

type ConsumptionState

type ConsumptionState int

ConsumptionState is the data type for consumption states.

const (
	Consumed    ConsumptionState = 0
	NotConsumed ConsumptionState = 1
)

List of consumption states.

type Product

type Product struct {
	Kind               string           `json:"kind"`
	PurchaseTimeMillis int64            `json:"purchaseTime"`
	PurchaseState      PurchaseState    `json:"purchaseState"`
	ConsumptionState   ConsumptionState `json:"consumptionState"`
	DeveloperPayload   string           `json:"developerPayload"`
}

Product indicates the status of an in-app product purchase.

type PurchaseState

type PurchaseState int

PurchaseState is the data type for purchase states.

const (
	PurchaseDone     PurchaseState = 0
	PurchaseRefunded PurchaseState = 1
)

List of purchase states.

type Subscription

type Subscription struct {
	Kind                 string `json:"kind"`
	InitiationTimeMillis int64  `json:"initiationTimestampMsec"`
	ValidUntilTimeMillis int64  `json:"validUntilTimestampMsec"`
	AutoRenewing         bool   `json:"autoRenewing"`
}

Subscription indicates the status of a subscription purchase.

Jump to

Keyboard shortcuts

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