RxSwift wrapper for StoreKit.
SKProduct.fetch(["my.product.id", "my.other.product.id"])
.subscribe(
onNext: { products: [SKProduct] in
// display products
},
onError: { error in
// handle the error
}
)
.disposed(by: disposeBag)SKPaymentQueue.default().rx.transactionsUpdated
.subscribe(onNext: { transactions: [SKPaymentTransaction] in
// Unlock content?
})
.disposed(by: disposeBag)SKPaymentQueue.default().rx.restoreCompletedTransactions()
.subscribe(
onNext: { transactions: [SKPaymentTransaction] in
// Unlock content?
},
onError: { error in
// handle the error
}
)
.disposed(by: disposeBag)let receiptValidator = ReceiptValidator(secret: "my_secret_key")
receiptValidator.verifySubscription(productIds: ["my.product.id"])
.subscribe(
onNext: { receipt in
// check expiry date of receipt
},
onError: { error in
// handle the error
}
)
.disposed(by: disposeBag)