Browse Source

Added sample code for Receipt Verification in README

Andrea Bizzotto 9 years ago
parent
commit
3b24958b07
1 changed files with 26 additions and 0 deletions
  1. 26 0
      README.md

+ 26 - 0
README.md

@@ -63,6 +63,32 @@ SwiftyStoreKit.restorePurchases() { result in
 }
 ```
 
+### Verify Receipts
+
+```
+SwiftyStoreKit.verifyReceipt() { result in
+    if case .Error(let error) = result {
+        if case .NoReceiptData = error {
+            self.refreshReceipt()
+        }
+    }
+}
+
+func refreshReceipt() {
+    SwiftyStoreKit.refreshReceipt { result in
+        switch result {
+        case .Success:
+            print("Receipt refresh success")
+            break
+        case .Error(let error):
+            print("Receipt refresh failed: \(error)")
+            break
+        }
+    }
+}
+```
+
+
 **NOTE**:
 The framework provides a simple block based API with robust error handling on top of the existing StoreKit framework. It does **NOT** persist in app purchases data locally. It is up to clients to do this with a storage solution of choice (i.e. NSUserDefaults, CoreData, Keychain).