Hi,
I've implemented inapp subscriptions in my android application. In the app
side we frequently check the autorenewing status using Google Play
Developer api.
We' had some customer reports. For one of customers this autorenewing
status returns false and so we processed the cancel status in the backend
thinking that user had cancelled the subscription.
Then we contacted the customer. The customer says that after the
subscription purchase from play store via paypal, he had a look on a paypal
and the paypal notified the user the payment was still in pending status.
The autorenewing status returning code is as follows:
private static boolean getSubscriptionDetails(String accessToken, String
refreshToken, String subscriptionId, String purchaseToken){
try{
TokenResponse tokenResponse = new TokenResponse();
tokenResponse.setAccessToken(accessToken);
tokenResponse.setRefreshToken(refreshToken);
tokenResponse.setExpiresInSeconds(3600L);
tokenResponse.setScope("https://www.googleapis.com/auth/androidpublisher");
tokenResponse.setTokenType("Bearer");
HttpRequestInitializer credential = new
GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setClientSecrets(Constants.GOOGLE_PLAY_DEVELOPER_CLIENT_ID,
Constants.GOOGLE_PLAY_DEVELOPER_CLIENT_SECRET)
.build()
.setFromTokenResponse(tokenResponse);
AndroidPublisher publisher = new
AndroidPublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).
setApplicationName(app_name).
build();
AndroidPublisher.Purchases purchases = publisher.purchases();
com.google.api.services.androidpublisher.AndroidPublisher.Purchases.Subscriptions.Get
get = purchases.subscriptions().get("com.bounts.it",
"com.bounts.it.premium_one_year_test1",
"laeofgllimohojmjhogdfmpn.AO-J1Oy75E6WVwyLHP2vlHerQtkIVkJVWLdVhJZGT3Ka2a9N6127KLcPnbfUYv7W_0vTgD682z-xZKgva_sXQXbDESgW3X8kt9gYyAuwvFnATzGNO6CAwR9VHlgA6NctsOdJW_8At4_r_ljvNCgtdz84OJ0gkpDK0Q");
SubscriptionPurchase subscriptionPurchase= get.execute();
Log.e("111", subscriptionPurchase.get("priceCurrencyCode").toString());
return subscriptionPurchase.getAutoRenewing();
}
catch (IOException e) {
e.printStackTrace();
return false;
}
If 'autorenewing' is false we update the subscription cancellation status
to the backend.
Is 'autoRenewing' status returns 'false' for pending payment status. VCould
you help me please. Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/0ccf7436-2103-438f-a48d-0a47d961cc7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.