Documentation
¶
Index ¶
- Constants
- func IsExpired(timestamp int64) bool
- func JsonUnmarshal(v, s any) error
- func PathQuery(path string, query map[string]string) string
- func WebHookWithCallback(r *http.Request, callbacks ...WebHookCallback) error
- type Amazon
- type AppStore
- type AppsItem
- type Attributes
- type AttributesKeyName
- type Client
- func (c *Client) CallKeyVersion(keyVersion, method, path string, reqBody any, platform string, respBody any) error
- func (c *Client) CreateAPurchase(req *CreateAPurchaseRequest, platforms ...string) (resp *SubscriberResponse, err error)
- func (c *Client) DeleteSubscriber(appUserId string) (resp *SubscriberDeleteResponse, err error)
- func (c *Client) Do(req *http.Request, d any) (resp *http.Response, err error)
- func (c *Client) GetAListOfApps(nextPageOrProjectId string) (resp *GetAlistOfAppsResponse, err error)
- func (c *Client) GetAListOfProjects(nextPage string) (resp *GetAListOfProjectsResponse, err error)
- func (c *Client) GetAnApp(projectId, appId string) (resp *GetAnAppResponse, err error)
- func (c *Client) GetOfferings(appUserId string, platforms ...string) (resp *GetOfferingsResponse, err error)
- func (c *Client) GetOrCreateSubscriber(appUserId string, platforms ...string) (resp *SubscriberResponse, err error)
- func (c *Client) GooglePlayCancelASubscription(appUserId, storeTransactionIdentifier string) (resp *SubscriberResponse, err error)
- func (c *Client) GooglePlayDeferASubscription(appUserId, productIdentifier string, req *GooglePlayDeferASubscriptionRequest) (resp *SubscriberResponse, err error)
- func (c *Client) GooglePlayRefundAndRevokePurchase(appUserId, storeTransactionIdentifier string) (resp *SubscriberResponse, err error)
- func (c *Client) GooglePlayRefundAndRevokeSubscription(appUserId, productIdentifier string) (resp *SubscriberResponse, err error)
- func (c *Client) GrantAPromotionalEntitlement(appUserId, entitlementIdentifier string, ...) (resp *SubscriberResponse, err error)
- func (c *Client) NewRequest(apiKey, method, urlStr, platform string, reqBody any) (*http.Request, error)
- func (c *Client) OverrideACustomerSCurrentOffering(appUserId, offeringUuid string) (resp *SubscriberResponse, err error)
- func (c *Client) RemoveACustomerSCurrentOfferingOverride(appUserId string) (resp *SubscriberResponse, err error)
- func (c *Client) RevokePromotionalEntitlements(appUserId, entitlementIdentifier string) (resp *SubscriberResponse, err error)
- type CreateAPurchaseRequest
- type DurationValue
- type Entitlements
- type GetAListOfProjectsItem
- type GetAListOfProjectsResponse
- type GetAlistOfAppsResponse
- type GetAnAppResponse
- type GetOfferingsResponse
- type GooglePlayDeferASubscriptionRequest
- type GrantAPromotionalEntitlementRequest
- type KeyName
- type MacAppStore
- type NonSubscriptions
- type OfferingPackage
- type OfferingResponse
- type PlayStore
- type RespError
- type Subscriber
- type SubscriberDeleteResponse
- type SubscriberResponse
- type Subscriptions
- type WebHookCallback
- type WebHookEvent
- type WebHookResponse
- type WebHookSubscriberAttributes
Constants ¶
const ( PlatformIOS = "ios" PlatformAndroid = "android" PlatformAmazon = "amazon" PlatformMacos = "macos" PlatformUikitformac = "uikitformac" )
const ( ApiKeyV1 = "v1" ApiKeyV2 = "v2" )
Variables ¶
This section is empty.
Functions ¶
func JsonUnmarshal ¶
func WebHookWithCallback ¶
func WebHookWithCallback(r *http.Request, callbacks ...WebHookCallback) error
Types ¶
type Attributes ¶
type Attributes struct { ProductId string `json:"product_id,omitempty"` Price float64 `json:"price,omitempty"` Currency string `json:"currency,omitempty"` IsRestore string `json:"is_restore,omitempty"` Attributes *AttributesKeyName `json:"attributes,omitempty"` AppUserId string `json:"app_user_id,omitempty"` FetchToken string `json:"fetch_token,omitempty"` }
type AttributesKeyName ¶
type AttributesKeyName struct {
KeyName *KeyName `json:"key_name,omitempty"`
}
type Client ¶
type Client struct { //https://www.revenuecat.com/reference/revenuecat-rest-api ApiKeyV1 string //https://www.revenuecat.com/reference/revenuecat-rest-api ApiKeyV2 string //https://app.revenuecat.com/projects/{ProjectID}/apps/{RevenueCatAppID} PublicAPIKey string BaseURL *url.URL Client *http.Client }
func (*Client) CallKeyVersion ¶
func (*Client) CreateAPurchase ¶
func (c *Client) CreateAPurchase(req *CreateAPurchaseRequest, platforms ...string) (resp *SubscriberResponse, err error)
CreateAPurchase https://www.revenuecat.com/reference/receipts
func (*Client) DeleteSubscriber ¶
func (c *Client) DeleteSubscriber(appUserId string) (resp *SubscriberDeleteResponse, err error)
DeleteSubscriber https://www.revenuecat.com/reference/delete-subscriber
func (*Client) GetAListOfApps ¶
func (c *Client) GetAListOfApps(nextPageOrProjectId string) (resp *GetAlistOfAppsResponse, err error)
GetAListOfApps https://www.revenuecat.com/reference/list-apps
func (*Client) GetAListOfProjects ¶
func (c *Client) GetAListOfProjects(nextPage string) (resp *GetAListOfProjectsResponse, err error)
GetAListOfProjects nextPage case: "" case: https://api.revnuecat.com/v2/projects?starting_after=proj82bc1db5&limit=1 https://www.revenuecat.com/reference/list-projects
func (*Client) GetAnApp ¶
func (c *Client) GetAnApp(projectId, appId string) (resp *GetAnAppResponse, err error)
func (*Client) GetOfferings ¶
func (c *Client) GetOfferings(appUserId string, platforms ...string) (resp *GetOfferingsResponse, err error)
GetOfferings https://www.revenuecat.com/reference/get-offerings
func (*Client) GetOrCreateSubscriber ¶
func (c *Client) GetOrCreateSubscriber(appUserId string, platforms ...string) (resp *SubscriberResponse, err error)
GetOrCreateSubscriber https://www.revenuecat.com/reference/subscribers
func (*Client) GooglePlayCancelASubscription ¶
func (c *Client) GooglePlayCancelASubscription(appUserId, storeTransactionIdentifier string) (resp *SubscriberResponse, err error)
GooglePlayCancelASubscription https://www.revenuecat.com/reference/cancel-a-google-subscription
func (*Client) GooglePlayDeferASubscription ¶
func (c *Client) GooglePlayDeferASubscription(appUserId, productIdentifier string, req *GooglePlayDeferASubscriptionRequest) (resp *SubscriberResponse, err error)
GooglePlayDeferASubscription https://www.revenuecat.com/reference/defer-a-google-subscription
func (*Client) GooglePlayRefundAndRevokePurchase ¶
func (c *Client) GooglePlayRefundAndRevokePurchase(appUserId, storeTransactionIdentifier string) (resp *SubscriberResponse, err error)
GooglePlayRefundAndRevokePurchase https://www.revenuecat.com/reference/refund-a-google-purchase
func (*Client) GooglePlayRefundAndRevokeSubscription ¶
func (c *Client) GooglePlayRefundAndRevokeSubscription(appUserId, productIdentifier string) (resp *SubscriberResponse, err error)
GooglePlayRefundAndRevokeSubscription https://www.revenuecat.com/reference/revoke-a-google-subscription
func (*Client) GrantAPromotionalEntitlement ¶
func (c *Client) GrantAPromotionalEntitlement(appUserId, entitlementIdentifier string, req *GrantAPromotionalEntitlementRequest) (resp *SubscriberResponse, err error)
GrantAPromotionalEntitlement https://www.revenuecat.com/reference/grant-a-promotional-entitlement
func (*Client) NewRequest ¶
func (*Client) OverrideACustomerSCurrentOffering ¶
func (c *Client) OverrideACustomerSCurrentOffering(appUserId, offeringUuid string) (resp *SubscriberResponse, err error)
OverrideACustomerSCurrentOffering https://www.revenuecat.com/reference/override-offering
func (*Client) RemoveACustomerSCurrentOfferingOverride ¶
func (c *Client) RemoveACustomerSCurrentOfferingOverride(appUserId string) (resp *SubscriberResponse, err error)
RemoveACustomerSCurrentOfferingOverride https://www.revenuecat.com/reference/delete-offering-override
func (*Client) RevokePromotionalEntitlements ¶
func (c *Client) RevokePromotionalEntitlements(appUserId, entitlementIdentifier string) (resp *SubscriberResponse, err error)
RevokePromotionalEntitlements https://www.revenuecat.com/reference/revoke-promotional-entitlements
type CreateAPurchaseRequest ¶
type CreateAPurchaseRequest struct { AppUserId string `json:"app_user_id"` FetchToken string `json:"fetch_token"` ProductId string `json:"product_id,omitempty"` Price float64 `json:"price,omitempty"` Currency string `json:"currency,omitempty"` IsRestore bool `json:"is_restore,omitempty"` PaymentMode int `json:"payment_mode,omitempty"` CreateEvents bool `json:"create_events,omitempty"` ShouldUpdateLastSeenFields bool `json:"should_update_last_seen_fields,omitempty"` SubscriptionGroupId string `json:"subscription_group_id,omitempty"` StoreUserId string `json:"store_user_id,omitempty"` PresentedOfferingIdentifier string `json:"presented_offering_identifier,omitempty"` ObserverMode bool `json:"observer_mode,omitempty"` IntroductoryPrice float64 `json:"introductory_price,omitempty"` NormalDuration string `json:"normal_duration,omitempty"` IntroDuration string `json:"intro_duration,omitempty"` TrialDuration string `json:"trial_duration,omitempty"` StoreCountry string `json:"store_country,omitempty"` IpAddress string `json:"ip_address,omitempty"` Attributes *Attributes `json:"attributes,omitempty"` }
type DurationValue ¶
type DurationValue string
const ( // DurationValueDaily //24 hour access DurationValueDaily DurationValue = "daily" // DurationValueThreeDay //72 hour access DurationValueThreeDay DurationValue = "three_day" // DurationValueWeekly //7 day access DurationValueWeekly DurationValue = "weekly" // DurationValueMonthly //1 month (31-day) access DurationValueMonthly DurationValue = "monthly" // DurationValueTwoMonth //2 month (61-day) access DurationValueTwoMonth DurationValue = "two_month" // DurationValueThreeMonth //3 month (92-day) access DurationValueThreeMonth DurationValue = "three_month" // DurationValueSixMonth //6 month (183-day) access DurationValueSixMonth DurationValue = "six_month" // DurationValueYearly //1 year (365-day) access DurationValueYearly DurationValue = "yearly" // DurationValueLifetime //200 year access DurationValueLifetime DurationValue = "lifetime" )
type Entitlements ¶
type GetAListOfProjectsItem ¶
type GetAListOfProjectsResponse ¶
type GetAListOfProjectsResponse struct { Items []*GetAListOfProjectsItem `json:"items,omitempty"` //https://api.revnuecat.com/v2/projects?starting_after=proj82bc1db5&limit=1 NextPage string `json:"next_page,omitempty"` Object string `json:"object,omitempty"` Url string `json:"url,omitempty"` }
type GetAlistOfAppsResponse ¶
type GetAnAppResponse ¶
type GetOfferingsResponse ¶
type GetOfferingsResponse struct { CurrentOfferingId string `json:"current_offering_id,omitempty"` Offerings []*OfferingResponse `json:"offerings,omitempty"` }
type GooglePlayDeferASubscriptionRequest ¶
type GooglePlayDeferASubscriptionRequest struct {
ExpiryTimeMs int64 `json:"expiry_time_msm"`
}
type GrantAPromotionalEntitlementRequest ¶
type GrantAPromotionalEntitlementRequest struct { Duration DurationValue `json:"duration,omitempty"` StartTimeMs int64 `json:"start_time_ms,omitempty"` }
type MacAppStore ¶
type MacAppStore struct {
BundleID string `json:"bundle_id,omitempty"`
}
type NonSubscriptions ¶
type OfferingPackage ¶
type OfferingResponse ¶
type OfferingResponse struct { Description string `json:"description,omitempty"` Identifier string `json:"identifier,omitempty"` Packages []*OfferingPackage `json:"packages,omitempty"` }
type RespError ¶
type Subscriber ¶
type Subscriber struct { FirstSeen *time.Time `json:"first_seen"` LastSeen *time.Time `json:"last_seen"` ManagementUrl string `json:"management_url"` NonSubscriptions *NonSubscriptions `json:"non_subscriptions"` OriginalAppUserId string `json:"original_app_user_id"` OriginalApplicationVersion string `json:"original_application_version"` OriginalPurchaseDate *time.Time `json:"original_purchase_date"` OtherPurchases *NonSubscriptions `json:"other_purchases"` Subscriptions map[string]any `json:"subscriptions"` Entitlements map[string]any `json:"entitlements"` }
func (*Subscriber) EntitlementsMap ¶
func (s *Subscriber) EntitlementsMap() map[string]*Entitlements
func (*Subscriber) SubscriptionsMap ¶
func (s *Subscriber) SubscriptionsMap() map[string]*Subscriptions
type SubscriberResponse ¶
type SubscriberResponse struct { RequestDate *time.Time `json:"request_date,omitempty"` RequestDateMs int64 `json:"request_date_ms,omitempty"` Subscriber *Subscriber `json:"subscriber,omitempty"` }
func (*SubscriberResponse) IsExpiredEntitlement ¶
func (s *SubscriberResponse) IsExpiredEntitlement(entitlement string) bool
type Subscriptions ¶
type Subscriptions struct { ExpiresDate *time.Time `json:"expires_date,omitempty"` PurchaseDate *time.Time `json:"purchase_date,omitempty"` OriginalPurchaseDate *time.Time `json:"original_purchase_date,omitempty"` OwnershipType string `json:"ownership_type,omitempty"` PeriodType string `json:"period_type,omitempty"` Store string `json:"store,omitempty"` IsSandbox string `json:"is_sandbox,omitempty"` UnsubscribeDetectedAt *time.Time `json:"unsubscribe_detected_at,omitempty"` BillingIssuesDetectedAt *time.Time `json:"billing_issues_detected_at,omitempty"` GracePeriodExpiresDate *time.Time `json:"grace_period_expires_date,omitempty"` RefundedAt *time.Time `json:"refunded_at,omitempty"` AutoResumeDate *time.Time `json:"auto_resume_date,omitempty"` StoreTransactionId *time.Time `json:"store_transaction_id,omitempty"` }
type WebHookCallback ¶
type WebHookCallback func(resp *WebHookResponse) error
type WebHookEvent ¶
type WebHookEvent struct { //Initial Purchase Id string `json:"id,omitempty"` Type string `json:"type,omitempty"` Store string `json:"store,omitempty"` Environment string `json:"environment,omitempty"` EventTimestampMs int64 `json:"event_timestamp_ms,omitempty"` ProductId string `json:"product_id,omitempty"` PeriodType string `json:"period_type,omitempty"` PurchasedAtMs int64 `json:"purchased_at_ms,omitempty"` ExpirationAtMs int64 `json:"expiration_at_ms,omitempty"` EntitlementId string `json:"entitlement_id,omitempty"` EntitlementIds []string `json:"entitlement_ids,omitempty"` PresentedOfferingId string `json:"presented_offering_id,omitempty"` TransactionId string `json:"transaction_id,omitempty"` OriginalTransactionId string `json:"original_transaction_id,omitempty"` CountryCode string `json:"country_code,omitempty"` AppUserId string `json:"app_user_id,omitempty"` Aliases []string `json:"aliases,omitempty"` OriginalAppUserId string `json:"original_app_user_id,omitempty"` Currency string `json:"currency,omitempty"` Price float64 `json:"price,omitempty"` PriceInPurchasedCurrency float64 `json:"price_in_purchased_currency,omitempty"` SubscriberAttributes map[string]any `json:"subscriber_attributes,omitempty"` TakehomePercentage float64 `json:"takehome_percentage,omitempty"` OfferCode string `json:"offer_code,omitempty"` AppId string `json:"app_id,omitempty,omitempty"` //Renewal IsTrialConversion bool `json:"is_trial_conversion,omitempty"` //Cancellation && Trial Cancelled CancelReason string `json:"cancel_reason,omitempty"` //Uncancellation && Subscription extended TaxPercentage float64 `json:"tax_percentage,omitempty"` //Refund && Uncancellation && Subscription extended CommissionPercentage float64 `json:"commission_percentage,omitempty"` //Subscription Paused AutoResumeAtMs int64 `json:"auto_resume_at_ms,omitempty"` //Expiration ExpirationReason string `json:"expiration_reason,omitempty"` //Transfer TransferredFrom []string `json:"transferred_from,omitempty"` TransferredTo []string `json:"transferred_to,omitempty"` //Product Change NewProductId string `json:"new_product_id,omitempty"` }
func (*WebHookEvent) SubscriberAttributesMap ¶
func (w *WebHookEvent) SubscriberAttributesMap() map[string]*WebHookSubscriberAttributes
type WebHookResponse ¶
type WebHookResponse struct { Event *WebHookEvent `json:"event"` ApiVersion string `json:"api_version"` }