I am trying to implement Subscriptions for the first time. I am using BillingClient v3.0.1. It is contract so I am not the owner of the Google Play account. The account owner has set up financials for the account and has configured the API. I have created the subscription products in the Google Play console, added the billing library through Gradle and com.android.vending.BILLING
in the manifest, and published a build on the Closed Alpha track for internal testing.
I initialize the billing client successfully
billingClient = BillingClient.newBuilder(mContext)
.enablePendingPurchases()
.setListener(this)
.build();
billingClient.startConnection(new BillingClientStateListener() {
@Override public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
...
}
@Override public void onBillingServiceDisconnected() {
...
}
});
and everything works, I retrieve the list of products
SkuDetailsParams params = SkuDetailsParams.newBuilder()
.setSkusList(skuList)
.setType(BillingClient.SkuType.SUBS)
.build();
billingClient.querySkuDetailsAsync(params, new SkuDetailsResponseListener() {
@Override public void onSkuDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<SkuDetails> list) {
...
});
and that too is successful, but when I try to purchase the product on a real device with a build running the same version code as the Alpha testing track version using:
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
.setSkuDetails(product)
.build();
BillingResult billingResult = billingClient.launchBillingFlow(mContext, billingFlowParams);
The pop-up shows an Error in the pop-up "The item you were attempting to purchase could not be found".
I have been going through everything I can find (short of receipt validation, which will be next up after I can actually complete a purchase), but am stuck.
Any advice / thoughts?
Thanks Stephen