Skip to content

[in_app_purchase] In StoreKit2, the quantity of SK2ProductPurchaseOptionsMessage does not work. #171570

@AmazyConch

Description

@AmazyConch

What package does this bug report belong to?

in_app_purchase

What target platforms are you seeing this bug on?

iOS

Have you already upgraded your packages?

Yes

Dependency versions

No response

Steps to reproduce

In InAppPurchasePlugin+StoreKit2.swift file:

...
var purchaseOptions: Set<Product.PurchaseOption> = []
if let appAccountToken = options?.appAccountToken,
  let accountTokenUUID = UUID(uuidString: appAccountToken)
{
  purchaseOptions.insert(.appAccountToken(accountTokenUUID))
}
if let quantity = options?.quantity {
    purchaseOptions.insert(.quantity(Int(quantity)))
}
if #available(iOS 17.4, macOS 14.4, *) {
  if let promotionalOffer = options?.promotionalOffer {
    purchaseOptions.insert(
      .promotionalOffer(
        offerID: promotionalOffer.promotionalOfferId,
        signature: promotionalOffer.promotionalOfferSignature.convertToSignature
      )
    )
  }
}
if #available(iOS 18.0, macOS 15.0, *) {
  if let winBackOfferId = options?.winBackOfferId,
    let winBackOffer = product.subscription?.winBackOffers.first(where: {
      $0.id == winBackOfferId
    })
  {
    purchaseOptions.insert(.winBackOffer(winBackOffer))
  }
}
let result = try await product.purchase(options: purchaseOptions)
...

The .quantity was not inserted into purchaseOptions, so I am unable to handle bulk purchase scenarios.

Expected results

Add

if let quantity = options?.quantity {
    purchaseOptions.insert(.quantity(Int(quantity)))
}

to the purchase method.

On the Flutter side:
Add quantity: purchasedQuantity, to the convertFromPigeon method.

Actual results

the quantity does not work.

Code sample

Leave a comment

Screenshots or Videos

No response

Logs

No response

Flutter Doctor output

Leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Flutterp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions