amazon

package
v0.0.0-...-00cb573 Latest Latest
Warning

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

Go to latest
Published: May 8, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SandboxURL is the endpoint for local environment.
	SandboxURL string = "http://localhost:8080/RVSSandbox"
	// ProductionURL is the endpoint for production environment.
	ProductionURL string = "https://appstore-sdk.amazon.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL     string
	Secret  string
	TimeOut time.Duration
}

Client implements IAPClient

func NewWithConfig

func NewWithConfig(config Config) Client

NewWithConfig creates a client with configuration

func (Client) Verify

func (c Client) Verify(userID string, receiptID string) (IAPResponse, error)

Verify sends receipts and gets validation result

type Config

type Config struct {
	IsProduction bool
	Secret       string
	TimeOut      time.Duration
}

Config is a configuration to initialize client

type IAPClient

type IAPClient interface {
	Verify(string, string) (IAPResponse, error)
}

IAPClient is an interface to call validation API in Amazon App Store

func New

func New(secret string) IAPClient

New creates a client object

type IAPResponse

type IAPResponse struct {
	ReceiptID       string `json:"receiptId"`
	ProductType     string `json:"productType"`
	ProductID       string `json:"productId"`
	PurchaseDate    int64  `json:"purchaseDate"`
	CancelDate      int64  `json:"cancelDate"`
	TestTransaction bool   `json:"testTransaction"`
}

The IAPResponse type has the response properties

type IAPResponseError

type IAPResponseError struct {
	Message string `json:"message"`
	Status  bool   `json:"status"`
}

The IAPResponseError typs has error message and status.

Jump to

Keyboard shortcuts

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