onPurchasesUpdated not called for pending purchase success
See original GitHub issueI have updated my application to use v2.1.0 (from an earlier 2.0.1 release) of the android play billing library and I am no longer receiving purchase updates on completion of a pending purchase.
I construct my billing client setting the listener to the current class, that implements PurchasesUpdatedListener
:
billingClient = BillingClient.newBuilder( getActivity() )
.setListener( this )
.enablePendingPurchases()
.build();
I then launch a purchase and use the “slow test card approves after a few minutes”
BillingFlowParams.Builder purchaseParamsBuilder = BillingFlowParams.newBuilder()
.setSkuDetails( product );
billingClient.launchBillingFlow( getActivity(), purchaseParamsBuilder.build() );
My listener gets called after this indicating the purchase is pending:
@Override
public void onPurchasesUpdated( BillingResult billingResult, List<Purchase> purchases )
{
int responseCode = billingResult.getResponseCode();
if (responseCode == BillingClient.BillingResponseCode.OK)
{
// I get to here with a Purchase.PurchaseState.PENDING
}
}
However this listener does NOT get called when the purchase completes. I leave the application open and I see the notification from the play store saying the purchase was successful in the notification bar.
If I query the purchases manually after this notification I can get the updated purchase however this doesn’t seem like a valid approach for handling the purchase.
Does anyone know what I am doing wrong or has this process changed?
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (2 by maintainers)
Top GitHub Comments
We have found the issue and made a fix for it. ETA 01/13/2020 to roll out to all devices.
No solution as yet! Glad I’m not the only one.
I’ve created an issue as requested here