iOS Development

android – Find out how to map PurchaseStatus enum for fee state worth coming from verifyreceipt api response to to manually name completePurchase technique?

Spread the love


I’m checking an in app buy package deal situation for one use case.

Initially i make a buyNonConsumable technique to buy a subscription.

After that I make an api name from my server to verifyreceipt api which is giving me “payment_state”:1 and “acknowledgement_state”: 0,

After then i examine for a property like (purchaseDetails.pendingCompletePurchase) which is giving me true after which I’m making a name for completePurchase technique. However someway at that second my app will get closed and let say i couldn’t make that api name.

So to handle it subsequent time manually I’m having all the info I want in purchaseDetails object in my server, besides PurchaseStatus enum to name technique completePurchase of in app buy package deal.

So can anybody inform me from the place can I map it that? Trigger even the PurchaseStatus Class of the package deal shouldn’t be offering any correct particulars easy methods to map it or which states are this from verifyReceipt Api name.

So please add the states required or mapped for PurchaseStatus enum in docs.

Code pattern

PurchaseDetails purchaseDetails = PurchaseDetails(
              productID: (activePlanResponse.worth.activeResponseItem?.plan
                  ?.productId ?? '').toString(),
              purchaseID
                  : (activePlanResponse.worth.activeResponseItem?.plan
                  ?.orderId ?? '').toString(),
              standing
                  : getPurchaseStatusById(id: state.toInt()),
              transactionDate
                  : (activePlanResponse.worth.activeResponseItem?.plan
                  ?.transactionDate ?? '').toString(),
              verificationData: PurchaseVerificationData(
                  supply: activePlanResponse.worth.activeResponseItem?.plan
                      ?.supply ?? '',
                  localVerificationData: activePlanResponse.worth
                      .activeResponseItem?.plan?.localVerificationData ?? '',
                  serverVerificationData
                      : activePlanResponse.worth.activeResponseItem?.plan
                      ?.serverVerificationData ?? ''));
          await purchaseDetails.completePurchase(purchaseDetails);

Above values I’m fetching from my server and mapping however don’t know easy methods to map this PurchaseStatus worth.

I’m getting an error like following when attempt to map standing manually,
updatePurchaseProducts error :
‘package deal:in_app_purchase_android/src/in_app_purchase_android_platform.dart’: Failed assertion: line 176 pos 7: ‘buy is GooglePlayPurchaseDetails’: On Android, the acquisition ought to all the time be of sort GooglePlayPurchaseDetails.

Can anybody present me attainable resolution or give transient on PurchaseStatus values for google play retailer and app retailer fee states?

Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *