I am getting below exception when I try to pay for a subscription for play store.
Plugin.InAppBilling.InAppBillingPurchaseException: Unable to process purchase. at Plugin.InAppBilling.InAppBillingImplementation.ParseBillingResult(BillingResult result, Boolean ignoreInvalidProducts) at Plugin.InAppBilling.InAppBillingImplementation.PurchaseAsync(String productSku, String itemType, String obfuscatedAccountId, String obfuscatedProfileId, String subOfferToken) at Plugin.InAppBilling.InAppBillingImplementation.PurchaseAsync(String productId, ItemType itemType, String obfuscatedAccountId, String obfuscatedProfileId, String subOfferToken)
Screenshot:
I have created 3 subscriptions on the play store and activated it. My app was in draft state, so I published a new build on internal testing. But when I try to pay for the subscription I am getting above exception.
My Code:
UserDialogs.Instance.ShowLoading("");
if (IsBusy)
return;
IsBusy = true;
try
{
// check internet first with Essentials
if (Connectivity.NetworkAccess != NetworkAccess.Internet)
return;
// connect to the app store api
var connected = await CrossInAppBilling.Current.ConnectAsync();
if (!connected)
return;
UserDialogs.Instance.HideHud();
//try to make purchase, this will return a purchase, empty, or throw an exception
var purchase = await CrossInAppBilling.Current.PurchaseAsync(productId, ItemType.Subscription);
if (purchase == null)
{
//nothing was purchased
return;
}
if (purchase.State == PurchaseState.Purchased)
{
Debug.WriteLine("Purchase successfull");
Debug.WriteLine("Purchase token:>>" + purchase.PurchaseToken);
Debug.WriteLine("Purchase id:>>" + purchase.Id);
}
else
{
throw new InAppBillingPurchaseException(PurchaseError.GeneralError);
}
}
catch (InAppBillingPurchaseException purchaseEx)
{
// Handle all the different error codes that can occure and do a pop up
Debug.WriteLine("purchaseEx:>>" + purchaseEx);
}
catch (Exception ex)
{
// Handle a generic exception as something really went wrong
Debug.WriteLine("exception:>>" + ex);
}
finally
{
await CrossInAppBilling.Current.DisconnectAsync();
IsBusy = false;
}
Under manifest added the below permission:
<uses-permission android:name="com.android.vending.BILLING" />
Do I miss any other set up for the proper working of this? Is the subscriptions needs to published on anywhere?