bizz84 / bizz84/SwiftyStoreKit

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

Open
#663 1 comment 0 reactions 0 assignees View on GitHub
type: question
Dominant language
Swift
Stars
6.7k
Forks
801
PR merge metrics
No merged PRs in 30d

Description

## 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.
```swift
// 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
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.