Important: Glassfy SDKs are deprecated. Glassfy will be ceasing operations by the end of 2024. Read the blog post here
Warning
These plugin is for Capacitor 6. For Capacitor 5, use the 3.x version.
Glassfy is a subscription revenue optimisation infrastructure for mobile applications.
Check the documentation at docs.glassfy.io to learn details on implementing and using Glassfy SDK.
npm install capacitor-plugin-glassfy
npx cap sync
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
Promise<GlassfyVersion>
--------------------
### initialize(...)
```typescript
initialize(options: { apiKey: string; watcherMode: boolean; }) => Promise{ apiKey: string; watcherMode: boolean; }
|
--------------------
### setLogLevel(...)
```typescript
setLogLevel(options: { logLevel: GLASSFY_LOGLEVEL; }) => Promise{ logLevel: GLASSFY_LOGLEVEL; }
|
--------------------
### offerings()
```typescript
offerings() => PromisePromise<GlassfyOfferings>
--------------------
### purchaseHistory()
```typescript
purchaseHistory() => PromisePromise<GlassfyPurchasesHistory>
--------------------
### permissions()
```typescript
permissions() => PromisePromise<GlassfyPermissions>
--------------------
### skuWithId(...)
```typescript
skuWithId(options: { identifier: string; }) => Promise{ identifier: string; }
|
**Returns:** Promise<GlassfySku>
--------------------
### skuWithIdAndStore(...)
```typescript
skuWithIdAndStore(options: { identifier: string; store: GLASSFY_STORE; }) => Promise{ identifier: string; store: GLASSFY_STORE; }
|
**Returns:** Promise<GlassfySkuBase>
--------------------
### connectCustomSubscriber(...)
```typescript
connectCustomSubscriber(options: { subscriberId: string; }) => Promise{ subscriberId: string; }
|
--------------------
### connectPaddleLicenseKey(...)
```typescript
connectPaddleLicenseKey(options: { licenseKey: string; force: boolean; }) => Promise{ licenseKey: string; force: boolean; }
|
--------------------
### connectGlassfyUniversalCode(...)
```typescript
connectGlassfyUniversalCode(options: { universalCode: string; force: boolean; }) => Promise{ universalCode: string; force: boolean; }
|
--------------------
### setEmailUserProperty(...)
```typescript
setEmailUserProperty(options: { email: string; }) => Promise{ email: string; }
|
--------------------
### setDeviceToken(...)
```typescript
setDeviceToken(options: { token: string; }) => Promise{ token: string; }
|
--------------------
### setExtraUserProperty(...)
```typescript
setExtraUserProperty(options: { extra: GlassfyExtraProperty; }) => Promise{ extra: GlassfyExtraProperty; }
|
--------------------
### getUserProperty()
```typescript
getUserProperty() => PromisePromise<GlassfyUserProperties>
--------------------
### purchaseSku(...)
```typescript
purchaseSku(options: { sku: GlassfySku; skuToUpgrade?: GlassfySku; replacementMode?: GLASSFY_REPLACEMENT_MODE; }) => Promise{ sku: GlassfySku; skuToUpgrade?: GlassfySku; replacementMode?: GLASSFY_REPLACEMENT_MODE; }
|
**Returns:** Promise<GlassfyTransaction>
--------------------
### restorePurchases()
```typescript
restorePurchases() => PromisePromise<GlassfyPermissions>
--------------------
### storeInfo()
```typescript
storeInfo() => PromisePromise<GlassfyStoresInfo>
--------------------
### setAttribution(...)
```typescript
setAttribution(options: { type: GLASSFY_ATTRIBUTION; value: string; }) => Promise{ type: GLASSFY_ATTRIBUTION; value: string; }
|
--------------------
### setAttributions(...)
```typescript
setAttributions(options: { items: GlassfyAttributionItem[]; }) => Promise{ items: GlassfyAttributionItem[]; }
|
--------------------
### _paywall(...)
```typescript
_paywall(options: { remoteConfig: string; awaitLoading: boolean; }) => Promise{ remoteConfig: string; awaitLoading: boolean; }
|
--------------------
### _closePaywall()
```typescript
_closePaywall() => Promise{ url: string; }
|
--------------------
### Interfaces
#### GlassfyVersion
| Prop | Type |
| ------------- | ------------------- |
| **`version`** | string
|
#### GlassfyOfferings
| Prop | Type |
| --------- | ------------------------------ |
| **`all`** | GlassfyOffering[]
|
#### GlassfyOffering
| Prop | Type |
| ---------------- | ------------------------- |
| **`offeringId`** | string
|
| **`skus`** | GlassfySku[]
|
#### GlassfySku
| Prop | Type |
| ----------------------------- | ------------------------------------------------------------------------- |
| **`introductoryEligibility`** | GLASSFY_ELEGIBILITY
|
| **`promotionalEligibility`** | GLASSFY_ELEGIBILITY
|
| **`extravars`** | { [key: string]: string; }
|
| **`product`** | GlassfyProduct
|
| **`basePlanId`** | string
|
| **`offerId`** | string
|
| **`discount`** | GlassfyProductDiscount
|
#### GlassfyProduct
| Prop | Type |
| ----------------------- | ------------------------------------------------------------------------- |
| **`title`** | string
|
| **`identifier`** | string
|
| **`description`** | string
|
| **`price`** | number
|
| **`currencyCode`** | string
|
| **`period`** | string
|
| **`introductoryPrice`** | GlassfyProductDiscount
|
| **`discounts`** | GlassfyProductDiscount[]
|
| **`basePlanId`** | string
|
#### 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
|
| **`basePlanId`** | string
|
| **`offerId`** | string
|
#### GlassfySkuBase
| Prop | Type |
| --------------- | ------------------------------------------------------- |
| **`skuId`** | string
|
| **`productId`** | string
|
| **`store`** | GLASSFY_STORE
|
#### GlassfyUserProperties
| Prop | Type |
| ----------- | --------------------------------------------------------------------- |
| **`email`** | string
|
| **`token`** | boolean
|
| **`extra`** | GlassfyExtraProperty
|
#### GlassfyTransaction
| Prop | Type |
| ---------------------- | ----------------------------------------------------------------- |
| **`productId`** | string
|
| **`receiptValidated`** | boolean
|
| **`permissions`** | GlassfyPermissions
|
#### GlassfyStoresInfo
| Prop | Type |
| --------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **`all`** | (GlassfyStoreInfo \| GlassfyPaddleStoreInfo)[]
|
#### GlassfyStoreInfo
| Prop | Type |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`store`** | Exclude<GLASSFY_STORE, GLASSFY_STORE.Paddle>
|
| **`extravars`** | { [key: string]: string; }
|
#### GlassfyPaddleStoreInfo
| Prop | Type |
| -------------------- | -------------------------------------------------------------- |
| **`store`** | GLASSFY_STORE.Paddle
|
| **`extravars`** | { [key: string]: string; }
|
| **`userid`** | string
|
| **`planId`** | string
|
| **`subscriptionId`** | string
|
| **`updateURL`** | string
|
| **`cancelURL`** | string
|
#### GlassfyAttributionItem
| Prop | Type |
| ----------- | ------------------------------------------------------------------- |
| **`type`** | GLASSFY_ATTRIBUTION
|
| **`value`** | string
|
### Type Aliases
#### GlassfyExtraProperty
{ [key: string]: string }
#### Exclude
Exclude from T those types that are assignable to U
T extends U ? never : T
### Enums
#### GLASSFY_LOGLEVEL
| Members | Value |
| ----------- | -------------- |
| **`OFF`** | 0
|
| **`ERROR`** | 1
|
| **`DEBUG`** | 2
|
| **`INFO`** | 3
|
| **`ALL`** | 3
|
#### GLASSFY_ELEGIBILITY
| 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_REPLACEMENT_MODE
| Members | Value |
| ------------------------------ | -------------- |
| **`UNKNOWN_REPLACEMENT_MODE`** | 0
|
| **`WITH_TIME_PRORATION`** | 1
|
| **`CHARGE_PRORATED_PRICE`** | 2
|
| **`WITHOUT_PRORATION`** | 3
|
| **`CHARGE_FULL_PRICE`** | 5
|
| **`DEFERRED`** | 6
|
#### GLASSFY_ATTRIBUTION
| Members | Value |
| ----------------- | -------------- |
| **`AdjustID`** | 1
|
| **`AppsFlyerID`** | 2
|
| **`IP`** | 3
|
| **`IDFA`** | 4
|
| **`IDFV`** | 5
|
| **`GAID`** | 6
|
| **`ASID`** | 7
|
| **`AID`** | 8
|