PurchaserService

Preparation

This API becomes available with advanced Magify SDK integration are described here.

Overview

This service provides all API to work with in-app purchases and subscriptions.

InAppStore

IInAppStore InAppStore { get; }

Current instance if IInAppStore implementation, that was set via SetPurchasingProvider.

InAppProducts

IReadOnlyList<InAppProduct> InAppProducts { get; }

List of InApp products that were configured and loaded for Magify.

SubscriptionProducts

IReadOnlyList<SubscriptionProduct> SubscriptionProducts { get; }

List of subscription products that were configured and loaded for Magify.

PurchasingInProgress

bool PurchasingInProgress { get; }

Indicates whether purchase of some product in progress (if PurchaseProductAsync in progress).

ExternalPurchaseVerificationHandler

IReactiveProperty<IPurchaseVerificationHandler> ExternalPurchaseVerificationHandler { get; }

Allows you to control purchases verification process and get the result of it.

VerificationRetryInterval

FloatReactiveProperty VerificationRetryInterval { get; }

The time in seconds between purchase verification attempts. Minimum allowed value is 1 second.

SetPurchasingProvider

void SetPurchasingProvider([CanBeNull] IInAppStore inAppStore);

The method allows you to tell SDK which implementation of IInAppStore to use to work with InApp purchases and subscriptions.

PrepareProductAsync

UniTask<ProductPrepareResult> PrepareProductAsync(ProductDef product, CancellationToken cancellationToken);

Initiate loading of products for the current InAppStore so that they can be purchased at a later time. Inside uses a timeout and can also be canceled by cancellationToken. Relies on IInAppStore.OnProductFetched and IInAppStore.OnProductFetchFailed events.

PurchaseProductAsync

UniTask<(ProductObtainFailReason? FailReason, PurchaseInfo Info)> PurchaseProductAsync(InAppProduct product);

UniTask<(ProductObtainFailReason? FailReason, PurchaseInfo Info)> PurchaseProductAsync(SubscriptionProduct product);

Initiates the purchase of a product with current InAppStore. Relies on IInAppStore.OnPurchaseFinished and IInAppStore.OnPurchaseFailed events.

  • If the purchase is in progress then PurchasingInProgress is true.
  • Returns purchase Info if successful or FailReason if unsuccessful.

Related articles

Campaigns

Creatives

AdvertiserService

Request config by scopes

Analytics

Visual customization