Unable to get the status of a subscription

71 views
Skip to first unread message

Jean-Baptiste BERGY

unread,
May 21, 2015, 10:06:15 AM5/21/15
to google-api-d...@googlegroups.com, jbbergy....@eurosport.com
Hi,

I use for the first time a Google API. There is too much information and not enough in the same time.
So, I work in .Net and I try to get the purchase status of a subscription using the Client Library API. I based my code on the "Getting started" sample. on call to get method, I've the following message :

"subscription not found for this application"

I've tried a lot of combination of package names and tokens. this is my code :

using Google.Apis.AndroidPublisher.v2;
using Google.Apis.AndroidPublisher.v2.Data;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;


[...]


UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { AndroidPublisherService.Scope.Androidpublisher },
"user", CancellationToken.None, new FileDataStore("Purchases.Subscriptions"));
} // Create the service.
var service = new AndroidPublisherService(new BaseClientService.Initializer
{
ApplicationName = "Player",
HttpClientInitializer = credential,
ApiKey = "AIzaxxxxxxxxxxxxxxxxxxxx8Dc"
});

SubscriptionPurchase SubscriptionStatus = service.Purchases.Subscriptions.Get("com.xxxxxxxxx.player", "12999763169054705758.1328238348743391", "efnbphnaibhjagcmogldcmnj.AO[.....]m4c4M").Execute();
bool test = SubscriptionStatus.AutoRenewing.Value;



thanks for reading and hope you can help me,
Reply all
Reply to author
Forward
0 new messages