bizz84 / bizz84/SwiftyStoreKit
receipt["cancellation_date"] != nil, always return .notPurchased
- Dominant language
- Swift
- Stars
- 6.7k
- Forks
- 801
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
when user buy a autoRenewable product ,the product has not expire, when user cancel the autoRenewable , the restore buy call verifySubscriptions() function always return .notPurchased
**To Reproduce**
Steps to reproduce the behavior:
1. Step one...
**Expected behavior**
A clear and concise description of what you expected to happen.
## Platform Information
- OS: [e.g. iOS 13.4, watchOS 6.2.1, tvOS 9.2.3, macOS 10.14.3, Catalyst 13.0]
- Purchase Type: [e.g. consumable, non-consumable, auto-renewable subscription, non-renewing subscription, discount]
- Environment: [e.g. sandbox, app review, production]
- SwiftyStoreKit version: [e.g. 0.16]
## Additional context
Add any other context about the problem here.
**Potentially Related Issues**
- Issue #___
**Screenshots**
If applicable, add screenshots to help explain your problem.
class func verifySubscriptions(
ofType type: SubscriptionType,
productIds: Set,
inReceipt receipt: ReceiptInfo,
validUntil date: Date = Date()
) -> VerifySubscriptionResult {
// The values of the latest_receipt and latest_receipt_info keys are useful when checking whether an auto-renewable subscription is currently active. By providing any transaction receipt for the subscription and checking these values, you can get information about the currently-active subscription period. If the receipt being validated is for the latest renewal, the value for latest_receipt is the same as receipt-data (in the request) and the value for latest_receipt_info is the same as receipt.
let (receipts, duration) = getReceiptsAndDuration(for: type, inReceipt: receipt)
let receiptsInfo = filterReceiptsInfo(receipts: receipts, withProductIds: productIds)
let nonCancelledReceiptsInfo = receiptsInfo.filter { receipt in receipt["cancellation_date"] == nil }
if nonCancelledReceiptsInfo.count == 0 {
return .notPurchased
}
Contributor guide
Assessment
This issue has not been assessed yet.