SwiftyStoreKit icon indicating copy to clipboard operation
SwiftyStoreKit copied to clipboard

!!!!Some Questions about deferred case, PaymentsController.swift line 130

Open ACFancy opened this issue 4 years ago • 1 comments

Question

Why payments.remove(at: paymentIndex) in deferred case? Why not handle like purchasing case? Here some info about deferred case:

  • when in deferred case, Apple sample code comment that "Do not block the UI. Allow the user to continue using the app"
  • So in deferred case, Discussion comment that "Update your UI to show the deferred state, and wait for another callback that indicates the final status."
  • in deferred case, wait for parent to agree or disagree for this payment final status , or wait for 24h to failed case callback finally.
// PaymentsController.swift line 130
if transactionState == .deferred {
            let purchase = PurchaseDetails(productId: transactionProductIdentifier, quantity: transaction.payment.quantity, product: payment.product, transaction: transaction, originalTransaction: transaction.original, needsFinishTransaction: !payment.atomically)

            payment.callback(.deferred(purchase: purchase))
            // why payment removed?
            payments.remove(at: paymentIndex)
            return true
        }

ACFancy avatar Dec 23 '21 03:12 ACFancy

@bizz84

ACFancy avatar Dec 31 '21 01:12 ACFancy