onPurchase method

void onPurchase(
  1. GlassfySku sku
)

Implementation

void onPurchase(GlassfySku sku) async {
  if (onPurchaseCallback != null) {
    onPurchaseCallback!(sku);
  } else {
    try {
      final transaction = await Glassfy.purchaseSku(sku);
      onClose(transaction, null);
    } catch (error) {
      onClose(null, error);
    }
    GlassfyPaywall._listener = null;
    GlassfyPaywall.close();
  }
}