Get active subscriptions In-app Billing Android
up vote
4
down vote
favorite
I have used the In-app billing library for adding subscriptions in my app. Everything is working properly but I am unable to find how do I get a Users current active subscription?
As per the docs, the method queryPurchaseHistoryAsync
returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed. Due to this, I am unable to know whether a current subscription is active or not.
According to this post, if we cancel the subscription, it will still be considered active for that day. But I am getting the subscriptions in the response which were canceled before 15 days.
Any help will be appreciated. Thanks in advance.
android google-play in-app-billing in-app-subscription play-billing-library
add a comment |
up vote
4
down vote
favorite
I have used the In-app billing library for adding subscriptions in my app. Everything is working properly but I am unable to find how do I get a Users current active subscription?
As per the docs, the method queryPurchaseHistoryAsync
returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed. Due to this, I am unable to know whether a current subscription is active or not.
According to this post, if we cancel the subscription, it will still be considered active for that day. But I am getting the subscriptions in the response which were canceled before 15 days.
Any help will be appreciated. Thanks in advance.
android google-play in-app-billing in-app-subscription play-billing-library
Most of the applications stores the subscription transaction in their own DB as well, do you maintain any database in your application ?
– Akshay Paliwal
Nov 12 at 12:33
1
I have not yet implemented subscriptions, but I am quite sure that queryPurchases() returns the currently valid purchases. Do you have problems with that query?
– gicci
Nov 13 at 21:39
Who got the bounty?
– Obsthändler
Nov 15 at 15:34
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I have used the In-app billing library for adding subscriptions in my app. Everything is working properly but I am unable to find how do I get a Users current active subscription?
As per the docs, the method queryPurchaseHistoryAsync
returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed. Due to this, I am unable to know whether a current subscription is active or not.
According to this post, if we cancel the subscription, it will still be considered active for that day. But I am getting the subscriptions in the response which were canceled before 15 days.
Any help will be appreciated. Thanks in advance.
android google-play in-app-billing in-app-subscription play-billing-library
I have used the In-app billing library for adding subscriptions in my app. Everything is working properly but I am unable to find how do I get a Users current active subscription?
As per the docs, the method queryPurchaseHistoryAsync
returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed. Due to this, I am unable to know whether a current subscription is active or not.
According to this post, if we cancel the subscription, it will still be considered active for that day. But I am getting the subscriptions in the response which were canceled before 15 days.
Any help will be appreciated. Thanks in advance.
android google-play in-app-billing in-app-subscription play-billing-library
android google-play in-app-billing in-app-subscription play-billing-library
asked Nov 4 at 10:24
Mehul Kanzariya
458728
458728
Most of the applications stores the subscription transaction in their own DB as well, do you maintain any database in your application ?
– Akshay Paliwal
Nov 12 at 12:33
1
I have not yet implemented subscriptions, but I am quite sure that queryPurchases() returns the currently valid purchases. Do you have problems with that query?
– gicci
Nov 13 at 21:39
Who got the bounty?
– Obsthändler
Nov 15 at 15:34
add a comment |
Most of the applications stores the subscription transaction in their own DB as well, do you maintain any database in your application ?
– Akshay Paliwal
Nov 12 at 12:33
1
I have not yet implemented subscriptions, but I am quite sure that queryPurchases() returns the currently valid purchases. Do you have problems with that query?
– gicci
Nov 13 at 21:39
Who got the bounty?
– Obsthändler
Nov 15 at 15:34
Most of the applications stores the subscription transaction in their own DB as well, do you maintain any database in your application ?
– Akshay Paliwal
Nov 12 at 12:33
Most of the applications stores the subscription transaction in their own DB as well, do you maintain any database in your application ?
– Akshay Paliwal
Nov 12 at 12:33
1
1
I have not yet implemented subscriptions, but I am quite sure that queryPurchases() returns the currently valid purchases. Do you have problems with that query?
– gicci
Nov 13 at 21:39
I have not yet implemented subscriptions, but I am quite sure that queryPurchases() returns the currently valid purchases. Do you have problems with that query?
– gicci
Nov 13 at 21:39
Who got the bounty?
– Obsthändler
Nov 15 at 15:34
Who got the bounty?
– Obsthändler
Nov 15 at 15:34
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
To query users subscription i use this method:
public void querySubscriptions() {
Runnable queryToExecute = () -> {
Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (mBillingClient == null ||
purchasesResult.getResponseCode() != BillingClient.BillingResponse.OK) {
return;
}
mPurchases.clear();
onPurchasesUpdated(BillingClient.BillingResponse.OK, purchasesResult.getPurchasesList());
};
executeServiceRequest(queryToExecute);
}
If you need more details, ask.
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
add a comment |
up vote
0
down vote
A user can have multiple subscriptions active at any moment. You can check whether the subscription is active or not using isAutoRenewing
method.Here is the docs for that method
Indicates whether the subscription renews automatically. If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription. The user has access to subscription content until the next billing date and will lose access at that time unless they re-enable automatic renewal (or manually renew, as described in Manual Renewal). If you offer a grace period, this value remains set to true for all subscriptions, as long as the grace period has not lapsed. The next billing date is extended dynamically every day until the end of the grace period or until the user fixes their payment method.
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
To query users subscription i use this method:
public void querySubscriptions() {
Runnable queryToExecute = () -> {
Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (mBillingClient == null ||
purchasesResult.getResponseCode() != BillingClient.BillingResponse.OK) {
return;
}
mPurchases.clear();
onPurchasesUpdated(BillingClient.BillingResponse.OK, purchasesResult.getPurchasesList());
};
executeServiceRequest(queryToExecute);
}
If you need more details, ask.
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
add a comment |
up vote
2
down vote
To query users subscription i use this method:
public void querySubscriptions() {
Runnable queryToExecute = () -> {
Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (mBillingClient == null ||
purchasesResult.getResponseCode() != BillingClient.BillingResponse.OK) {
return;
}
mPurchases.clear();
onPurchasesUpdated(BillingClient.BillingResponse.OK, purchasesResult.getPurchasesList());
};
executeServiceRequest(queryToExecute);
}
If you need more details, ask.
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
add a comment |
up vote
2
down vote
up vote
2
down vote
To query users subscription i use this method:
public void querySubscriptions() {
Runnable queryToExecute = () -> {
Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (mBillingClient == null ||
purchasesResult.getResponseCode() != BillingClient.BillingResponse.OK) {
return;
}
mPurchases.clear();
onPurchasesUpdated(BillingClient.BillingResponse.OK, purchasesResult.getPurchasesList());
};
executeServiceRequest(queryToExecute);
}
If you need more details, ask.
To query users subscription i use this method:
public void querySubscriptions() {
Runnable queryToExecute = () -> {
Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (mBillingClient == null ||
purchasesResult.getResponseCode() != BillingClient.BillingResponse.OK) {
return;
}
mPurchases.clear();
onPurchasesUpdated(BillingClient.BillingResponse.OK, purchasesResult.getPurchasesList());
};
executeServiceRequest(queryToExecute);
}
If you need more details, ask.
answered Nov 14 at 12:53
Obsthändler
10311
10311
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
add a comment |
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
Does this method return only active subscriptions or does it also return previously purchased subscription?
– Mehul Kanzariya
Nov 15 at 5:48
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
It will return only active subscriptions. You can test it, here is a link on how to test subscriptions: developer.android.com/google/play/billing/…
– Obsthändler
Nov 15 at 9:05
add a comment |
up vote
0
down vote
A user can have multiple subscriptions active at any moment. You can check whether the subscription is active or not using isAutoRenewing
method.Here is the docs for that method
Indicates whether the subscription renews automatically. If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription. The user has access to subscription content until the next billing date and will lose access at that time unless they re-enable automatic renewal (or manually renew, as described in Manual Renewal). If you offer a grace period, this value remains set to true for all subscriptions, as long as the grace period has not lapsed. The next billing date is extended dynamically every day until the end of the grace period or until the user fixes their payment method.
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
add a comment |
up vote
0
down vote
A user can have multiple subscriptions active at any moment. You can check whether the subscription is active or not using isAutoRenewing
method.Here is the docs for that method
Indicates whether the subscription renews automatically. If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription. The user has access to subscription content until the next billing date and will lose access at that time unless they re-enable automatic renewal (or manually renew, as described in Manual Renewal). If you offer a grace period, this value remains set to true for all subscriptions, as long as the grace period has not lapsed. The next billing date is extended dynamically every day until the end of the grace period or until the user fixes their payment method.
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
add a comment |
up vote
0
down vote
up vote
0
down vote
A user can have multiple subscriptions active at any moment. You can check whether the subscription is active or not using isAutoRenewing
method.Here is the docs for that method
Indicates whether the subscription renews automatically. If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription. The user has access to subscription content until the next billing date and will lose access at that time unless they re-enable automatic renewal (or manually renew, as described in Manual Renewal). If you offer a grace period, this value remains set to true for all subscriptions, as long as the grace period has not lapsed. The next billing date is extended dynamically every day until the end of the grace period or until the user fixes their payment method.
A user can have multiple subscriptions active at any moment. You can check whether the subscription is active or not using isAutoRenewing
method.Here is the docs for that method
Indicates whether the subscription renews automatically. If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription. The user has access to subscription content until the next billing date and will lose access at that time unless they re-enable automatic renewal (or manually renew, as described in Manual Renewal). If you offer a grace period, this value remains set to true for all subscriptions, as long as the grace period has not lapsed. The next billing date is extended dynamically every day until the end of the grace period or until the user fixes their payment method.
answered Nov 9 at 7:02
Farmaan Elahi
814814
814814
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
add a comment |
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
How do I identify the case where the auto-renewal is set to false but still 10 days are left for the subscription? How can I allow user to access premium features until the subscription is expired?
– Mehul Kanzariya
Nov 9 at 9:10
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
Dude, this is not correct. Read the text from the doc you posted.
– Obsthändler
Nov 14 at 13:08
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139793%2fget-active-subscriptions-in-app-billing-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Most of the applications stores the subscription transaction in their own DB as well, do you maintain any database in your application ?
– Akshay Paliwal
Nov 12 at 12:33
1
I have not yet implemented subscriptions, but I am quite sure that queryPurchases() returns the currently valid purchases. Do you have problems with that query?
– gicci
Nov 13 at 21:39
Who got the bounty?
– Obsthändler
Nov 15 at 15:34