Android in-app payment is being developed and is being conducted as an internal test on the Google Play Console.
All in-app payment items have been added, API access settings have been completed, and Firebase settings have been completed.
App payment was actually completed and PurchaseToken occurred normally (both operation and test)
However, 400 error always occurs when using AndroidPublisher library for verification.
GET https://www.googleapis.com/androidpublisher/v3/applications/com.kisline.riotapp.inapp02/purchases/products/com.kisinfo.blizzardapp/tokens/cffhcmklpdoonpdjgkpcnbfd.AO-J1OxCcJXg2J-WRDyiRPtBeXX4BSY8TtY8I-j9lSUKCd8Tgu4Z9IinjcYvshNPeC4nkXaaA3KsYg7JtrIHycgMjv-C4cDMraouAdWIBvtPKotr-lqZIB8
{
"code" : 400,
"errors" : [ {
"domain" : "androidpublisher",
"location" : "token",
"locationType" : "parameter",
"message" : "The purchase token does not match the package name.",
"reason" : "purchaseTokenDoesNotMatchPackageName"
} ],
"message" : "The purchase token does not match the package name."
}
in my ServerSide Code
GoogleCredentials credentials = GoogleCredentials.fromStream(Resources.getResourceAsStream("in my project resource path")).createScoped(Arrays.asList("https://www.googleapis.com/auth/androidpublisher"));
credentials.refreshIfexpired();
AccessToken token = credentials.getAccessToken();
JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
HttpTransport httptransport = GoogleNetHttpTransport.newTrustedTransport();
HttpCredentialsAdapter adapter = new HttpCredentialsAdapter(credentials);
AndroidPublisher pub = new AndroidPublisher.Builder(httpTransport, JSON_FACTORY, adapter).setapplicationName("com.kisinfo.blizzardapp").build();
AndroidPublisher.Purchases.Products.Get prod = pub.purchases().products().get("com.kisline.riotapp.inapp02","com.kisinfo.blizzardapp","cffhcmklpdoonpdjgkpcnbfd.AO-J1OxCcJXg2J-WRDyiRPtBeXX4BSY8TtY8I-j9lSUKCd8Tgu4Z9IinjcYvshNPeC4nkXaaA3KsYg7JtrIHycgMjv-C4cDMraouAdWIBvtPKotr-lqZIB8");
What's wrong?
question from:
https://stackoverflow.com/questions/65879714/i-get-400-error-purchasetokendoesnotmatchpackagename-in-androidpublisher 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…