Warning
These plugin is for Capacitor 5. For Capacitor 4, use the 2.x version.
CapacitorJS Glassfy Plugin
Glassfy is a subscription revenue optimisation infrastructure for mobile applications.
Getting Started
Check the documentation at docs.glassfy.io to learn details on implementing and using Glassfy SDK.
Plugin Install
npm install capacitor-plugin-glassfy-ryland
npx cap sync
Build plugin and example
be sure to have ionic cli installed following instructions here
npm install
npm run build
cd example
npm install
ionic capacitor sync ios
ionic capacitor open ios
API
sdkVersion()
sdkVersion() => Promise<GlassfyVersion>
Returns: Promise<GlassfyVersion>
initialize(...)
initialize(options: { apiKey: string; watcherMode: boolean; }) => Promise<void>
For more details, follow instruction at https://docs.glassfy.io/get-started/configuration
Param | Type |
---|
options | { apiKey: string; watcherMode: boolean; } |
setLogLevel(...)
setLogLevel(options: { logLevel: GLASSFY_LOGLEVEL; }) => Promise<void>
Param | Type |
---|
options | { logLevel: GLASSFY_LOGLEVEL; } |
offerings()
offerings() => Promise<GlassfyOfferings>
For more details, check the documentation https://docs.glassfy.io/dashboard/configure-offerings
Returns: Promise<GlassfyOfferings>
purchaseHistory()
purchaseHistory() => Promise<GlassfyPurchasesHistory>
For more details, check the documentation https://docs.glassfy.io/dashboard/configure-offerings
Returns: Promise<GlassfyPurchasesHistory>
permissions()
permissions() => Promise<GlassfyPermissions>
For more details, check the documentation https://docs.glassfy.io/dashboard/configure-permissions.html
Returns: Promise<GlassfyPermissions>
skuWithId(...)
skuWithId(options: { identifier: string; }) => Promise<GlassfySku>
For more details, check the documentation https://docs.glassfy.io/dashboard/configure-products
Param | Type |
---|
options | { identifier: string; } |
Returns: Promise<GlassfySku>
skuWithIdAndStore(...)
skuWithIdAndStore(options: { identifier: string; store: GLASSFY_STORE; }) => Promise<GlassfySkuBase>
Param | Type |
---|
options | { identifier: string; store: GLASSFY_STORE; } |
Returns: Promise<GlassfySkuBase>
connectCustomSubscriber(...)
connectCustomSubscriber(options: { subscriberId: string; }) => Promise<GlassfySku>
Param | Type |
---|
options | { subscriberId: string; } |
Returns: Promise<GlassfySku>
connectPaddleLicenseKey(...)
connectPaddleLicenseKey(options: { licenseKey: string; force: boolean; }) => Promise<void>
Param | Type |
---|
options | { licenseKey: string; force: boolean; } |
connectGlassfyUniversalCode(...)
connectGlassfyUniversalCode(options: { universalCode: string; force: boolean; }) => Promise<void>
Param | Type |
---|
options | { universalCode: string; force: boolean; } |
setEmailUserProperty(...)
setEmailUserProperty(options: { email: string; }) => Promise<void>
Param | Type |
---|
options | { email: string; } |
setDeviceToken(...)
setDeviceToken(options: { token: string; }) => Promise<void>
Param | Type |
---|
options | { token: string; } |
setExtraUserProperty(...)
setExtraUserProperty(options: { extra: GlassfyExtraProperty; }) => Promise<void>
Param | Type |
---|
options | { extra: GlassfyExtraProperty; } |
getUserProperty()
getUserProperty() => Promise<GlassfyUserProperties>
Returns: Promise<GlassfyUserProperties>
purchaseSku(...)
purchaseSku(options: { sku: GlassfySku; skuToUpgrade?: GlassfySku; prorationMode?: GLASSFY_PRORATION_MODE; }) => Promise<GlassfyTransaction>
Param | Type |
---|
options | { sku: GlassfySku; skuToUpgrade?: GlassfySku; prorationMode?: GLASSFY_PRORATION_MODE; } |
Returns: Promise<GlassfyTransaction>
restorePurchases()
restorePurchases() => Promise<GlassfyPermissions>
Returns: Promise<GlassfyPermissions>
setAttribution(...)
setAttribution(options: { type: GLASSFY_ATTRIBUTION; value: string; }) => Promise<void>
Param | Type |
---|
options | { type: GLASSFY_ATTRIBUTION; value: string; } |
setAttributions(...)
setAttributions(options: { items: GlassfyAttributionItem[]; }) => Promise<void>
Param | Type |
---|
options | { items: GlassfyAttributionItem[]; } |
_paywall(...)
_paywall(options: { remoteConfig: String; awaitLoading: Boolean; }) => Promise<void>
Param | Type |
---|
options | { remoteConfig: String; awaitLoading: Boolean; } |
_closePaywall()
_closePaywall() => Promise<void>
_openUrl(...)
_openUrl(options: { url: String; }) => Promise<void>
Param | Type |
---|
options | { url: String; } |
Interfaces
GlassfyVersion
GlassfyOfferings
Prop | Type |
---|
all | GlassfyOffering[] |
GlassfyOffering
Prop | Type |
---|
offeringId | string |
skus | GlassfySku[] |
GlassfySku
Prop | Type |
---|
introductoryEligibility | GLASSFY_ELEGGIBILITY |
promotionalEligibility | GLASSFY_ELEGGIBILITY |
extravars | { key: string: string; } |
product | GlassfyProduct |
GlassfyProduct
Prop | Type |
---|
title | string |
identifier | string |
description | string |
price | number |
currencyCode | string |
introductoryPrice | GlassfyProductDiscount |
discounts | GlassfyProductDiscount[] |
GlassfyProductDiscount
Prop | Type |
---|
identifier | string |
price | number |
currencyCode | string |
period | string |
numberOfPeriods | number |
type | string |
GlassfyPurchasesHistory
Prop | Type |
---|
all | GlassfyPurchaseHistory[] |
GlassfyPurchaseHistory
Prop | Type |
---|
productId | string |
skuId | string |
type | GLASSFY_EVENT_TYPE |
store | GLASSFY_STORE |
purchaseDate | string |
expireDate | string |
transactionId | string |
subscriberId | string |
currencyCode | string |
countryCode | string |
isInIntroOfferPeriod | boolean |
promotionalOfferId | string |
offerCodeRefName | string |
licenseCode | string |
webOrderLineItemId | string |
GlassfyPermissions
Prop | Type |
---|
installationId | string |
subscriberId | string |
originalApplicationVersion | string |
originalApplicationDate | string |
all | GlassfyPermission[] |
GlassfyPermission
Prop | Type |
---|
permissionId | string |
entitlement | GLASSFY_ENTITLEMENT |
isValid | boolean |
expireDate | string |
accountableSkus | GlassfyAccountableSku[] |
GlassfyAccountableSku
Prop | Type |
---|
isInIntroOfferPeriod | boolean |
isInTrialPeriod | boolean |
GlassfySkuBase
Prop | Type |
---|
skuId | string |
productId | string |
store | GLASSFY_STORE |
GlassfyUserProperties
Prop | Type |
---|
email | String |
token | boolean |
extra | GlassfyExtraProperty |
String
Allows manipulation and formatting of text strings and determination and location of substrings within strings.
Prop | Type | Description |
---|
length | number | Returns the length of a String object. |
Method | Signature | Description |
---|
toString | () => string | Returns a string representation of a string. |
charAt | (pos: number) => string | Returns the character at the specified index. |
charCodeAt | (index: number) => number | Returns the Unicode value of the character at the specified location. |
concat | (...strings: string[]) => string | Returns a string that contains the concatenation of two or more strings. |
indexOf | (searchString: string, position?: number | undefined) => number | Returns the position of the first occurrence of a substring. |
lastIndexOf | (searchString: string, position?: number | undefined) => number | Returns the last occurrence of a substring in the string. |
localeCompare | (that: string) => number | Determines whether two strings are equivalent in the current locale. |
match | (regexp: string | RegExp) => RegExpMatchArray | null | Matches a string with a regular expression, and returns an array containing the results of that search. |
replace | (searchValue: string | RegExp, replaceValue: string) => string | Replaces text in a string, using a regular expression or search string. |
replace | (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string) => string | Replaces text in a string, using a regular expression or search string. |
search | (regexp: string | RegExp) => number | Finds the first substring match in a regular expression search. |
slice | (start?: number | undefined, end?: number | undefined) => string | Returns a section of a string. |
split | (separator: string | RegExp, limit?: number | undefined) => string[] | Split a string into substrings using the specified separator and return them as an array. |
substring | (start: number, end?: number | undefined) => string | Returns the substring at the specified location within a String object. |
toLowerCase | () => string | Converts all the alphabetic characters in a string to lowercase. |
toLocaleLowerCase | (locales?: string | string[] | undefined) => string | Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. |
toUpperCase | () => string | Converts all the alphabetic characters in a string to uppercase. |
toLocaleUpperCase | (locales?: string | string[] | undefined) => string | Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. |
trim | () => string | Removes the leading and trailing white space and line terminator characters from a string. |
substr | (from: number, length?: number | undefined) => string | Gets a substring beginning at the specified location and having the specified length. |
valueOf | () => string | Returns the primitive value of the specified object. |
RegExpMatchArray
Prop | Type |
---|
index | number |
input | string |
RegExp
Prop | Type | Description |
---|
source | string | Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. |
global | boolean | Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. |
ignoreCase | boolean | Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. |
multiline | boolean | Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. |
lastIndex | number | |
Method | Signature | Description |
---|
exec | (string: string) => RegExpExecArray | null | Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. |
test | (string: string) => boolean | Returns a Boolean value that indicates whether or not a pattern exists in a searched string. |
compile | () => this | |
RegExpExecArray
Prop | Type |
---|
index | number |
input | string |
GlassfyTransaction
Prop | Type |
---|
productId | string |
receiptValidated | boolean |
permissions | GlassfyPermissions |
GlassfyAttributionItem
Prop | Type |
---|
type | GLASSFY_ATTRIBUTION |
value | string |
Boolean
Method | Signature | Description |
---|
valueOf | () => boolean | Returns the primitive value of the specified object. |
Type Aliases
GlassfyExtraProperty
{ key: string: string }
Enums
GLASSFY_LOGLEVEL
Members | Value |
---|
OFF | 0 |
ERROR | 1 |
DEBUG | 2 |
INFO | 3 |
ALL | 3 |
GLASSFY_ELEGGIBILITY
Members | Value |
---|
ELEGIBLE | 1 |
NON_ELEGIBLE | -1 |
UNKNOWN | 0 |
GLASSFY_EVENT_TYPE
Members | Value |
---|
InitialBuy | 5001 |
Restarted | 5002 |
Renewed | 5003 |
Expired | 5004 |
DidChangeRenewalStatus | 5005 |
IsInBillingRetryPeriod | 5006 |
ProductChange | 5007 |
InAppPurchase | 5008 |
Refund | 5009 |
Paused | 5010 |
Resumed | 5011 |
ConnectLicense | 5012 |
DisconnectLicense | 5013 |
GLASSFY_STORE
Members | Value |
---|
AppStore | 1 |
PlayStore | 2 |
Paddle | 3 |
Stripe | 4 |
Glassfy | 5 |
GLASSFY_ENTITLEMENT
Members | Value |
---|
NEVERBUY | -9 |
OTHERREFUND | -8 |
ISSUEREFUND | -7 |
UPGRADED | -6 |
EXPIREDVOLUNTARY | -5 |
PRODUCTNOTAVAILABLE | -4 |
FAILTOACCEPTINCREASE | -3 |
EXPIREDFROMBILLING | -2 |
INRETRY | -1 |
MISSINGINFO | 0 |
EXPIREDINGRACE | 1 |
OFFPLATFORM | 2 |
NONRENEWING | 3 |
AUTORENEWOFF | 4 |
AUTORENEWON | 5 |
GLASSFY_PRORATION_MODE
Members | Value |
---|
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY | 0 |
IMMEDIATE_WITH_TIME_PRORATION | 1 |
IMMEDIATE_AND_CHARGE_PRORATED_PRICE | 2 |
IMMEDIATE_WITHOUT_PRORATION | 3 |
DEFERRED | 4 |
IMMEDIATE_AND_CHARGE_FULL_PRICE | 5 |
GLASSFY_ATTRIBUTION
Members | Value |
---|
AdjustID | 1 |
AppsFlyerID | 2 |
IP | 3 |
IDFA | 4 |
IDFV | 5 |
GAID | 6 |
ASID | 7 |
AID | 8 |