Documentation
¶
Index ¶
Constants ¶
View Source
const ( APPLE_ENV_PRODUCTION = "https://buy.itunes.apple.com/verifyReceipt" APPLE_ENV_SANDBOX = "https://sandbox.itunes.apple.com/verifyReceipt" )
View Source
const ( APPLE_VALID = 0 APPLE_UNREADABLE_JSON = 21000 APPLE_MALFORMED_DATA = 21002 APPLE_AUTHENTICATION_ERROR = 21003 APPLE_UNMATCHED_SECRET = 21004 APPLE_SERVER_UNAVAILABLE = 21005 APPLE_SUBSCRIPTION_EXPIRED = 21006 APPLE_SANDBOX_RECEIPT_ON_PROD = 21007 APPLE_PROD_RECEIPT_ON_SANDBOX = 21008 )
View Source
const ( GOOGLE_IAP_SCOPE = "https://www.googleapis.com/auth/androidpublisher" GOOGLE_IAP_URL = "https://www.googleapis.com/androidpublisher/v2/applications/%s/purchases/%s/%s/tokens/%s" )
View Source
const (
CONTENT_TYPE_APP_JSON = "application/json"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppleClient ¶
type AppleClient struct {
// contains filtered or unexported fields
}
func NewAppleClient ¶
func NewAppleClient(password string, production bool, timeout int) (*AppleClient, error)
func NewAppleClientWithHTTP ¶
func (*AppleClient) Verify ¶
func (ac *AppleClient) Verify(p *ApplePurchase) (*PurchaseVerifyResponse, *AppleReceipt)
type AppleInAppReceipt ¶
type AppleInAppReceipt struct {
Quantity string `json:"quantity"`
ProductID string `json:"product_id"`
TransactionID string `json:"transaction_id"`
OriginalTransactionID string `json:"original_transaction_id"`
PurchaseDate string `json:"purchase_date"`
OriginalPurchaseDate string `json:"original_purchase_date"`
ExpiresDate string `json:"expires_date"`
AppItemID string `json:"app_item_id"`
VersionExternalIdentifier string `json:"version_external_identifier"`
WebOrderLineItemID string `json:"web_order_line_item_id"`
CancellationDate string `json:"cancellation_date"`
}
type ApplePurchase ¶
type AppleReceipt ¶
type AppleReceipt struct {
BundleID string `json:"bundle_id"`
ApplicationVersion string `json:"application_version"`
InApp []*AppleInAppReceipt `json:"in_app"`
OriginalApplicationVersion string `json:"original_application_version"`
CreationDate string `json:"creation_date"`
ExpirationDate string `json:"expiration_date"`
}
type AppleRequest ¶
type AppleResponse ¶
type AppleResponse struct {
//Either 0 if the receipt is valid, or one of the error codes
Status int `json:"status"`
// A JSON representation of the receipt that was sent for verification
Receipt *AppleReceipt `json:"receipt"`
// Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions. The base-64 encoded transaction receipt for the most recent renewal.
LatestReceipt string `json:"latest_receipt"`
// Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions. The JSON representation of the receipt for the most recent renewal.
LatestReceiptInfo map[string]interface{} `json:"latest_receipt_info"`
}
type GoogleClient ¶
type GoogleClient struct {
// contains filtered or unexported fields
}
func NewGoogleClient ¶
func NewGoogleClient(packageName string, serviceKeyFilePath string, timeout int) (*GoogleClient, error)
func NewGoogleClientWithHTTP ¶
func NewGoogleClientWithHTTP(packageName string, httpClient *http.Client) (*GoogleClient, error)
func (*GoogleClient) VerifyProduct ¶
func (gc *GoogleClient) VerifyProduct(p *GooglePurchase) (*PurchaseVerifyResponse, *GoogleProductReceipt)
func (*GoogleClient) VerifySubscription ¶
func (gc *GoogleClient) VerifySubscription(p *GooglePurchase) (*PurchaseVerifyResponse, *GoogleSubscriptionReceipt)
type GoogleProductReceipt ¶
type GooglePurchase ¶
type GooglePurchase struct {
// The identifier of the product or subscription being purchased.
ProductId string `json:"ProductId"`
// Whether the purchase is for a single product or a subscription.
ProductType string `json:"ProductType"`
// The token returned in the purchase operation response, acts as a transaction identifier.
PurchaseToken string `json:"PurchaseToken"`
}
type GoogleSubscriptionReceipt ¶
type GoogleSubscriptionReceipt struct {
Kind string `json:"kind"`
StartTimeMillis int64 `json:"startTimeMillis"`
ExpiryTimeMillis int64 `json:"expiryTimeMillis"`
AutoRenewing bool `json:"autoRenewing"`
PriceCurrencyCode string `json:"priceCurrencyCode"`
PriceAmountMicros int64 `json:"priceAmountMicros"`
CountryCode string `json:"countryCode"`
DeveloperPayload string `json:"developerPayload"`
PaymentState int `json:"paymentState"`
CancelReason int `json:"cancelReason"`
UserCancellationTimeMillis int64 `json:"userCancellationTimeMillis"`
}
type PurchaseVerifyResponse ¶
type PurchaseVerifyResponse struct {
// Whether or not the transaction is valid and all the information matches.
Success bool
// If this is a new transaction or if Nakama has a log of it.
SeenBefore bool
// Indicates whether or not Nakama was able to reach the remote purchase service.
PurchaseProviderReachable bool
// A string indicating why the purchase verification failed, if appropriate.
Message error
// The complete response Nakama received from the remote service.
Data string
}
Click to show internal directories.
Click to hide internal directories.