Guest User

Untitled

a guest
May 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. SwiftyStoreKit.purchaseProduct("reflex_remove_ads", quantity: 1, atomically: false) { result in
  2. switch result {
  3. case .success(let product):
  4. // fetch content from your server, then:
  5. if product.needsFinishTransaction {
  6. SwiftyStoreKit.finishTransaction(product.transaction)
  7. }
  8. print("Purchase Success: (product.productId)")
  9. case .error(let error):
  10. switch error.code {
  11. case .unknown: print("Unknown error. Please contact support")
  12. case .clientInvalid: print("Not allowed to make the payment")
  13. case .paymentCancelled: break
  14. case .paymentInvalid: print("The purchase identifier was invalid")
  15. case .paymentNotAllowed: print("The device is not allowed to make the payment")
  16. case .storeProductNotAvailable: print("The product is not available in the current storefront")
  17. case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
  18. case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
  19. case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment