iOS Question Annual App Subscription with Trial Period

toro1950

Active Member
Licensed User
Good morning to the whole community, I would like to publish my app with a free trial period, then if the customer likes it they should
subscribe to an annual subscription. Thanks to Erel I was able to test the in-app purchase with the code
B4X:
Sub richiesta
    MyStore.Initialize("MyStore")
    If MyStore.CanMakePayments = True Then
        MyStore.RequestPayment("product.id")
    End If
    End Sub
and for the answer
B4X:
Sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)

    Log("Acquisto completato")
    If Product.IsInitialized Then
        Log("Product: " & Product.ProductIdentifier & ", date=" & DateTime.Time(Product.TransactionDate) & _
       ", Transaction identifier=" & Product.TransactionIdentifier)
    End If
    If Success =True Then
    
        hd.ToastMessageShow("Acquisto completato",False)
        
    End If
End Sub
This is the first time I publish an app on the Apple Store, so I am having trouble and would like some information to help me do it.
With the in-app purchase through a check of the days passed, trial or annual, I would use the code to request payment and possibly
block the app if necessary, with the annual subscription is the payment request completely managed by the Apple Store?
with the sub Sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)
do I intercept the payment as in an in-app purchase?
Is there a possibility of setting up a subscription with a free trial period, is it easy to do it?
Are there any tutorials? Erel, someone from the forum or Apple Store
 

Alexander Stolte

Expert
Licensed User
Longtime User
To me it looks like you just have to create a subscription variant with free trial and then everything works like a normal subscription, if the customer does not cancel it during the free trial phase, the whole thing will automatically continue, only that it then costs money.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
but you didn't answer this question for me
The answer is: Yes

You can also have a look at the b4xlib, there is a helper class inside, everything is done with istore. I use the library for all my inapp subscriptions in my apps
 
Upvote 0

toro1950

Active Member
Licensed User
hi Alexander, two more questions, I know that the renewal of a subscription is automatic, unless the customer interrupts it,
once the subscription is automatically renewed, the sub that I told you about before is activated? If the customer
does not renew the subscription, how does Apple block the app, I think via a screenshot that covers the screen of the app,
or do I have to block it? If so, I have to be sure that the sub is activated
 
Upvote 0

toro1950

Active Member
Licensed User
if at each renewal the sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)
Notify me of the renewal done I have no problem doing it

Alexander check your email I sent you a personal message
 
Upvote 0

toro1950

Active Member
Licensed User
I'm still having trouble with the subscription, if I set an annual subscription, when I start the app I could ask the user
whether to subscribe or do a free trial for a week, in the first case I could use the code
B4X:
Sub request
    MyStore.Initialize("MyStore")
    If MyStore.CanMakePayments = True Then
        MyStore.RequestPayment("product.id")
    End If
    End Sub
to request the purchase of the annual subscription,
in the second case I would postpone the purchase request by a week. Is it possible to do this?

If I set an annual subscription with a free trial week when I first start the app what do I have to do?
if I ask the user whether to accept the trial period and possibly cancel it before the trial expires,
do I use the same code? When will Apple activate the code
B4X:
Sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)

    Log("Acquisto completato")
    If Product.IsInitialized Then
        Log("Product: " & Product.ProductIdentifier & ", date=" & DateTime.Time(Product.TransactionDate) & _
       ", Transaction identifier=" & Product.TransactionIdentifier)
    End If
    If Success =True Then
           
        'Registration of the subscription start date for subsequent checks
    End If
End Sub
after it has received the money ?
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
A subscription with a free trial period is treated like a normal subscription.

1. you show the user a page with an overview of the available tariffs, e.g. 1 month (7-day trial)

2. the user selects and presses a button to subscribe
3. you execute your code at the top to make the purchase
4. the user gets a popup window from apple where it says that the money will only be debited 7 days later if he does not cancel the subscription before.
5. the user buys it, does not have to pay anything, because apple automatically collects the money after the end of the test period

I wouldn't invest so much time looking for a theoretical solution first, but create the subscription and test it with your sandbox user to see how the istore library works. This will answer some of the questions you are still asking yourself. I know it looks difficult when you work with istore for the first time, but it is easier than you think once you understand how it works :)
 
Upvote 0

toro1950

Active Member
Licensed User
4. the user gets a popup window from apple where it says that the money will only be debited 7 days later if he does not cancel the subscription before.
5. the user buys it, does not have to pay anything, because apple automatically collects the money after the end of the test period
Alexander what is obvious to you is not for me, what should I do to understand if the user has paid or canceled? that is, block the app or not.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Alexander what is obvious to you is not for me, what should I do to understand if the user has paid or canceled? that is, block the app or not.
what technology do you use to validate the receipt?
I use RevenueCat so that I don't have to host anything myself.

An alternative is:

Without this, you can't find out how long the subscription is valid for and you can't check whether the subscription has been canceled or terminated prematurely.
 
Upvote 0

toro1950

Active Member
Licensed User
Hi Alexander, I created an annual subscription, I downloaded your RevenueCat Example, I can see the subscription, I can buy it. With which code can I check that the subscription is valid, that is, that it has not expired or revoked?. I also tried with an in-app purchase, but even in this way, as with the subscription, I can only know that the purchase was made if I try to buy it again
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Upvote 0
Top