bizz84 / bizz84/SwiftyStoreKit

Verify Receipt Doesn't Work

Open
#679 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

I have implemented **_SwiftyStoreKit.verifyReceipt_** and _**SwiftyStoreKit.verifySubscription**_ methods. While debugging, debugger never goes inside switch statement although result contain "success" when debugged in **InAppReceiptVerificator** class **verifyReceipt()** method.

Here is the function :

```
func SubscriptionVerify(productID: String){
SwiftyStoreKit.verifyReceipt(using: appleValidator!) { result in
switch result {
case .success(let receipt):
let productId = productID
// Verify the purchase of a Subscription
let purchaseResult = SwiftyStoreKit.verifySubscription(
ofType: .autoRenewable, // or .nonRenewing (see below)
productId: productId,
inReceipt: receipt)


switch purchaseResult {
case .purchased(let expiryDate, let items):
print("\(productId) is valid until \(expiryDate)\n\(items)\n")

case .expired(let expiryDate, let items):
print("\(productId) is expired since \(expiryDate)\n\(items)\n")
case .notPurchased:
print("The user has never purchased \(productId)")
}

case .error(let error):
print("Receipt verification failed: \(error)")
}
}
}
```

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.