Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Delphi FMX.InAppPurchase - stucks after payment on Android

I have added an InAppPurchase object into my app. The ApplicationLicenseKey is ok and the google merchant account too. I have added a product and when I call it using InAppPurchase1.PurchaseProduct('theid') it opens the purchasing process successfully with the window and the payment process. After the payment using a testing account it is confirmed but the app does not go into the InAppPurchase1PurchaseCompleted event and remains stucks until I kill it. The purchase is done because I receive the receipt from Google after the test payment.

I'm using Delphi 10.2. Vending Billing (In-App Billing) is set to true.

My code:

    procedure Frm.FormCreate(Sender: TObject);
    begin    
    {$IFDEF ANDROID}
      InAppPurchase1.ApplicationLicenseKey:='part1'+'part2'+'part3';
      InAppPurchase1.SetupInAppPurchase;
      if not InAppPurchase1.CanMakeInAppPurchases then
      begin
       BuyPremium.Visible:=false;
       LabelPremium.Visible:=false;
      end;    
    {$ENDIF ANDROID}
    end;

procedure Frm.BuyPremiumClick(Sender: TObject);
begin
 InAppPurchase1.PurchaseProduct('t001');  // This product is ok on Google Play Console
end;

procedure Frm.InAppPurchase1PurchaseCompleted(Sender: TObject;
  const ProductID: string; NewTransaction: Boolean);
begin
   CloseAdButtonClick(sender);
end;

Any idea of what is happening?

Thank you.

Comments