FMX.InAppPurchase.IFMXInAppPurchaseService

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

IFMXInAppPurchaseService = interface(IInterface)

C++

__interface  INTERFACE_UUID("{D49D5CE3-136A-47A7-8243-FD929AD0FF29}") IFMXInAppPurchaseService  : public System::IInterface

Properties

Type Visibility Source Unit Parent
interface
class
public
FMX.InAppPurchase.pas
FMX.InAppPurchase.hpp
FMX.InAppPurchase FMX.InAppPurchase

Description

Platform service that provides support for in-app payment services. This platform service is only implemented on Android and iOS.

Instead of accessing this platform service directly, you can use a wrapper such as TInAppPurchase.

This platform service keeps a list of all instances of TCustomInAppPurchase and subclasses (such as TInAppPurchase). These instances are responsible for adding themselves to this list when they are created, and removing themselves from the list when they are destroyed. If you subclass TCustomInAppPurchase but you do not inherit its constructor and destructor, remember to do this as well:

constructor MyComponent.Create(AOwner: TComponent);
var
  IAPIntf: IInterface;
begin
  if TPlatformServices.Current.SupportsPlatformService(
    IFMXInAppPurchaseService, IAPIntf) then
  begin
    FInAppPurchaseService := IFMXInAppPurchaseService(IAPIntf);
    FInAppPurchaseService.AddComponent(Self);
  end;
end;

destructor MyComponent.Destroy;
begin
  if Assigned(FInAppPurchaseService) then
    FInAppPurchaseService.RemoveComponent(Self);
  FInAppPurchaseService := nil;
end;

Exceptions

This is a detailed list of exceptions that the different implementations of this platform service may throw:

Platform Exception Causes

Android

EIAPException

  • You attempt to purchase a product that has been already purchased.
  • The connection to the service failed.
  • Unexpected result from the service API when consuming a list of products.

EIAPNoLicenseKey

  • You attempt to consume or purchase a product without previously specifying your license key.
  • You attempt to restore purchased products without previously specifying your license key.

iOS

EIAPException

  • You attempt to purchase a product that has been already purchased.
  • You attempt to consume a product that has not been purchased.
  • You request information about a list of products while there is a request in progress already.

See Also