E [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(4, One or more of the arguments provided are invalid., {code: 4, message: One or more of the arguments provided are invalid., readableErrorCode: PurchaseInvalidError, readable_error_code: PurchaseInvalidError, underlyingErrorMessage: There is no current Activity}, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296)
<asynchronous suspension>
#2 Purchases._invokeReturningMap (package:purchases_flutter/purchases_flutter.dart:871)
<asynchronous suspension>
#3 Purchases._invokeReturningCustomerInfo (package:purchases_flutter/purchases_flutter.dart:855)
<asynchronous suspension>
#4 Purchases.purchasePackage (package:purchases_flutter/purchases_flutter.dart:300)
<asynchronous suspension>
#5 PurchaseNotifer.executePersionPurchase
Hey @miyauchi ,
Unfortunately this error is a little vague - just that one or more of the arguments being provided in making the purchase is invalid. This could be the payment method, something on Google’s side, something with the sandbox account.
I see that you’ve created a ticket with us as well - I’ll respond there so we can continue to troubleshoot and share more information.
This issue has been resolved.
I'm writing code with flutter using add-to-app, but it's because the purchase screen was created with flutterfragment.
I solved it by changing it to flutteractivity.
The same issue
D//Purchases] - DEBUG( 7678):
Vending Offerings from cache
D/ Purchases] - DEBUG( 7678):
Product change started: Subscription(productId=chillaxdev_premium, optionId=yearly, productDetails=ProductDetails{jsonString='{"productId":"chillaxdev_premium","type":"subs","title":"Premium Plan (ChillaxCare Dev)","name":"Premium Plan","description":"Premium Plan","localizedIn":l"en-GB"],"skuDetailsToken":"AEuhp4KXq9Le04mGW9BWd7ltfdUSBajKOz3-VbxA3u4Ef55XBeXVgqtdGkkbJsyQxZAG","subscriptionOfferDetails":D{"offerIdToken":"AUj\/YhgIjKaPbI4nRZne0gJ+f2jHcLlg2bPG4wofLABdQ\/q77yg6CP4ZINKEEb+rsogwlWa5+aLITYzDiYals4hQb4+XN2HpD956b1LK5kFgTe3mXE\/k","basePlanId":"monthly","pricingPhases":g{"priceAmountMicros":142000000000,"priceCurrencyCode":"VND","formattedPrice":"₫142,000","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":o]},{"offerIdToken":"AUj\/YhiaEy9PNh21uzjRV3FH+MeVEpMi9JXJSOp0r0ii+M11my90fCJbBsXze8jCzDV1iHT\/E77uIdE08vI09siybe55r8h4GXXPL+55k2VLo78=","basePlanId":"yearly","pricingPhases":i{"priceAmountMicros":1400000000000,"priceCurrencyCode":"VND","formattedPrice":"₫1,400,000","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":,]}]}', parsedJson={"productId":"chillaxdev_premium","type":"subs","title":"Premium Plan (ChillaxCare Dev)","name":"Premium Plan","description":"Premium Plan","localizedIn":l"en-GB"],"skuDetailsToken":"AEuhp4KXq9Le04mGW9BWd7ltfdUSBajKOz3-VbxA3u4Ef55XBeXVgqtdGkkbJsyQxZAG","subscriptionOfferDetails":f{"offerIdToken":"AUj\/YhgIjKaPbI4nRZne0gJ+f2jHcLlg2bPG4wofLABdQ\/q77yg6CP4ZINKEEb+rsogwlWa5+aLITYzDiYals4hQb4+XN2HpD956b1LK5kFgTe3mXE\/k","basePlanId":"monthly","pricingPhases":i{"priceAmountMicros":142000000000,"priceCurrencyCode":"VND","formattedPrice":"₫142,000","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":}]},{"offerIdToken":"AUj\/YhiaEy9PNh21uzjRV3FH+MeVEpMi9JXJSOp0r0ii+M11my90fCJbBsXze8jCzDV1iHT\/E77uIdE08vI09siybe55r8h4GXXPL+55k2VLo78=","basePlanId":"yearly","pricingPhases":p{"priceAmountMicros":1400000000000,"priceCurrencyCode":"VND","formattedPrice":"₫1,400,000","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags"::]}]}, productId='chillaxdev_premium', productType='subs', title='Premium Plan (ChillaxCare Dev)', productDetailsToken='AEuhp4KXq9Le04mGW9BWd7ltfdUSBajKOz3-VbxA3u4Ef55XBeXVgqtdGkkbJsyQxZAG', subscriptionOfferDetails=tcom.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@92c1f1, com.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@6fa31d6]}, token=AUj/YhiaEy9PNh21uzjRV3FH+MeVEpMi9JXJSOp0r0ii+M11my90fCJbBsXze8jCzDV1iHT/E77uIdE08vI09siybe55r8h4GXXPL+55k2VLo78=) - offering: premium_plan_offer oldProductId: chillaxdev_premium:monthly googleProrationMode IMMEDIATE_WITHOUT_PRORATION
D/_Purchases] - DEBUG( 7678):
Querying Purchase with chillaxdev_premium:monthly and type SUBS
D/ Purchases] - DEBUG( 7678):
Checking if cache is stale AppInBackground false
E/IPurchases] - ERROR( 7678): 
PurchasesError(code=PurchaseInvalidError, underlyingErrorMessage=Couldn't find existing purchase for SKU: chillaxdev_premium:monthly, message='One or more of the arguments provided are invalid.')
I/flutter ( 7678): {} {2023-07-08 12:26:18.892000} {SubscriptionHelper} {paymentMultiSubscription: can't make payment PlatformException errorCode PurchasesErrorCode.purchaseInvalidError 4 -> One or more of the arguments provided are invalid.} {LogLevel.INFO}