amazon

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationTypeSubscription = "SUBSCRIPTION_PURCHASED"
	NotificationTypeConsumable   = "CONSUMABLE_PURCHASED"
	NotificationTypeEntitlement  = "ENTITLEMENT_PURCHASED"
)
View Source
const (
	// SandboxURL is the endpoint for amazon appstore RVS Cloud Sandbox environment.
	SandboxURL string = "https://appstore-sdk.amazon.com/sandbox"
	// 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
	// contains filtered or unexported fields
}

Client implements IAPClient

func New

func New(secret string) *Client

New creates a client object

func NewWithClient

func NewWithClient(secret string, cli *http.Client) *Client

NewWithClient creates a client with a custom client.

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, userID string, receiptID string) (IAPResponse, error)

Verify sends receipts and gets validation result

type IAPClient

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

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

type IAPResponse

type IAPResponse struct {
	ReceiptID          string      `json:"receiptId"`
	ProductType        string      `json:"productType"`
	ProductID          string      `json:"productId"`
	PurchaseDate       int64       `json:"purchaseDate"`
	RenewalDate        int64       `json:"renewalDate"`
	CancelDate         int64       `json:"cancelDate"`
	TestTransaction    bool        `json:"testTransaction"`
	BetaProduct        bool        `json:"betaProduct"`
	ParentProductID    string      `json:"parentProductId"`
	Quantity           int64       `json:"quantity"`
	Term               string      `json:"term"`
	TermSku            string      `json:"termSku"`
	FreeTrialEndDate   int64       `json:"freeTrialEndDate"`
	AutoRenewing       bool        `json:"autoRenewing"`
	CancelReason       *int8       `json:"cancelReason"`
	GracePeriodEndDate int64       `json:"gracePeriodEndDate"`
	Promotions         []Promotion `json:"promotions"`
}

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.

type Notification added in v1.9.0

type Notification struct {
	Type             string `json:"Type"`
	MessageId        string `json:"MessageId"`
	TopicArn         string `json:"TopicArn"`
	Message          string `json:"Message"`
	Timestamp        string `json:"Timestamp"`
	SignatureVersion string `json:"SignatureVersion"`
	Signature        string `json:"Signature"`
	SigningCertURL   string `json:"SigningCertURL"`
	UnsubscribeURL   string `json:"UnsubscribeURL"`
}

Notification is struct for amazon notification

type NotificationMessage added in v1.9.0

type NotificationMessage struct {
	AppPackageName         string           `json:"appPackageName"`
	NotificationType       NotificationType `json:"notificationType"`
	AppUserId              string           `json:"appUserId"`
	ReceiptId              string           `json:"receiptId"`
	RelatedReceipts        struct{}         `json:"relatedReceipts"`
	Timestamp              int64            `json:"timestamp"`
	BetaProductTransaction bool             `json:"betaProductTransaction"`
}

NotificationMessage is struct for Message field of Notification

type NotificationType added in v1.9.0

type NotificationType string

NotificationType is type https://developer.amazon.com/docs/in-app-purchasing/rtn-example.html

type Promotion added in v1.3.25

type Promotion struct {
	PromotionType   PromotionType   `json:"promotionType"`
	PromotionStatus PromotionStatus `json:"promotionStatus"`
}

type PromotionStatus added in v1.3.25

type PromotionStatus string
const (
	Queued     PromotionStatus = "Queued"
	InProgress PromotionStatus = "InProgress"
	Completed  PromotionStatus = "Completed"
)

type PromotionType added in v1.3.25

type PromotionType string
const (
	IntroductoryPrice PromotionType = "Introductory Price - All customers"
	PromotionalPrice  PromotionType = "Promotional Price - Lapsed customers"
)

Jump to

Keyboard shortcuts

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