As @remy-lebeau rightly pointed out, the code sample I originally found wasn't the best example to follow.
The following code works nice in my case and allows me to set up an in-app subscription for the add-on:
procedure TfSubsriptions.btnSubscribe(Sender: TObject);
var
Status: StorePurchaseStatus;
begin
try
WindowsStore1.RefreshInfo;
except
//
end;
for var i := 0 to WindowsStore1.AppProducts.Count - 1 do
begin
if WindowsStore1.AppProducts[i].StoreId.ToString = 'XXXXXXXXXXXX' then
begin
try
Status := WindowsStore1.PurchaseProduct(WindowsStore1.AppProducts[i]);
case Status of
StorePurchaseStatus.Succeeded:
begin
SUBSCRIPTION := True;
UpdateUI;
Break;
end;
StorePurchaseStatus.AlreadyPurchased:
//
StorePurchaseStatus.NotPurchased:
//
StorePurchaseStatus.NetworkError:
//
StorePurchaseStatus.ServerError:
//
else
//
end;
except
On e : Exception do
begin
//
Break;
end;
end;
end;
end;
end;