Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receipt["cancellation_date"] != nil, always return .notPurchased #681

Open
kongyuluEleven opened this issue Sep 6, 2022 · 0 comments
Open

Comments

@kongyuluEleven
Copy link

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<String>,
    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
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant