Open EddosPrazeres opened 6 years ago
Same issue here!
In App Purchase returns subscription status (active or not) ?
Yes in app purchase returns a state of a previously purchased item. If the item is in the array then it has been purchased previously and it is either Active Cancelled or Refunded.
In App Purchase returns remaining subscription time?
This plugin to my knowledge doesn't do this but you can accomplish this easily by checking the state of the product purchased. I think inapppurchase2 allows you to subscribe to it.
Is it possible to set subscription period? Something like a subscription without automatic renewal. If so, how can I do it?
This is something you would configure in iTunes connect. You'd create a developer account and create an auto renewable subscription. In order to do this you will have to complete a payment contract.
Hope this helps, Mo
For Question number 3: Please read the App Store documentation on types of in-app purchases : https://support.apple.com/en-us/HT202023
By the way what is inapppurchase2?
Hello, Thanks for the feedback but unfortunately I still can't solve this issue. I'm using In App Purchase 1(https://ionicframework.com/docs/native/in-app-purchase/) and I can make a purchase, restore a purchase and get subscription information. I'm using a self-renewing subscription in Apple with a 30 day duration. I'm testing on the sandbox environment but I'm having difficulties on how to verify the status of a subscription to know whether it's active or not. Unfortunately 'restorePurchases' returns me the following: { “productId”:“com.totalcommit.diariodebordolojista.AssinaturaMensal”, “date”:“2018-04-09T17:54:01Z”, “transactionId”:“1000000389398093", “state”:3 }” The documentation says “state - the state of the product. On Android the statuses are: 0 - ACTIVE, 1 - CANCELLED, 2 - REFUNDED”. Being that, how can I tell if a subscription is active or not? I'm using the difference in days between the time of purchase and the current date, for now. P.S.: What I described above was made on IOS.
@EddosPrazeres Sounds like you're off to a great start. State 3 on iOS means active. This means that you can handle determining whether a subscription is active or not by seeing if restoredPurchasesArray[i].state == 3 and if not showing ads (or whatever behavior you want to happen when a user isn't subscribed.) please keep in mind that this will only work for iOS as state is stored within a receipt object for android and will need more processing to get that state value.
Hey @monichols thanks for your help, you seem to have figured this out.
What about android, how do we get state there ? You mentioned a receipt object. So basically to check if an android user has an active subscription the following condition must apply?
restoredPurchasesArray[i].receipt.purchaseState == 0
Also, where can I find the status codes for iOS ?
Good Afternoon, I`m developing an app using APP Purchase. I need some help with the following questions:
Greetings.