Skip to content

[in_app_purchase] PurchaseParam#sandboxTesting is not used to switch iOS sandbox environment #62779

@oboenikui

Description

@oboenikui

Steps to Reproduce

I'm using in_app_purchase plugin version 0.3.4+3, and I notice that PurchaseParam has a confusing param.

sample code:

final PurchaseParam purchaseParam = PurchaseParam(
  productDetails: productDetails,
  sandboxTesting: true,
);
await InAppPurchaseConnection.instance
    .buyNonConsumable(purchaseParam: purchaseParam);

PurchaseParam has sandboxTesting param. This document says:

The 'sandboxTesting' is only available on iOS, set it to true for testing in AppStore's sandbox environment. The default value is false.

But this explanation seems to be wrong. In fact, it is only used to test Ask to Buy feature.

    await _skPaymentQueueWrapper.addPayment(SKPaymentWrapper(
        productIdentifier: purchaseParam.productDetails.id,
        quantity: 1,
        applicationUsername: purchaseParam.applicationUserName,
        simulatesAskToBuyInSandbox: purchaseParam.sandboxTesting,
        requestData: null));

https://github.com/flutter/plugins/blob/939b9a6f00367238131ad8dcc8b704f4e3e5ba26/packages/in_app_purchase/lib/src/in_app_purchase/app_store_connection.dart#L52

Furthermore, simulatesAskToBuyInSandbox isn't actually used because of typo.

    payment.simulatesAskToBuyInSandbox =
        [[paymentMap objectForKey:@"simulatesAskToBuyInSandBox"] boolValue];

https://github.com/flutter/plugins/blob/f903d4cf0342b894e44143b02d993bf298b8abe4/packages/in_app_purchase/ios/Classes/InAppPurchasePlugin.m#L182-L183

Correct key is simulatesAskToBuyInSandbox, but actual is simulatesAskToBuyInSandBox.

Expected results:

sandboxTesting is used to switch sandbox environment.

Actual results:

sandboxTesting is used to switch "Ask to Buy" feature, and furthermore, it is not working.

To switch sandbox environment, switch provisioning profile. This seems to be an iOS specification, so there seems to be no way to change it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions