{"id":13719506,"url":"https://github.com/glassonion1/RxStoreKit","last_synced_at":"2025-05-07T11:32:08.640Z","repository":{"id":46786068,"uuid":"94960870","full_name":"glassonion1/RxStoreKit","owner":"glassonion1","description":"StoreKit library for RxSwift","archived":false,"fork":false,"pushed_at":"2021-01-05T12:50:24.000Z","size":74,"stargazers_count":112,"open_issues_count":4,"forks_count":33,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-08T04:23:26.827Z","etag":null,"topics":["functional","ios","observer","reactivex","rxswift","skpaymentqueue","storekit","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glassonion1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-21T03:55:55.000Z","updated_at":"2024-10-10T07:50:50.000Z","dependencies_parsed_at":"2022-09-11T02:22:50.906Z","dependency_job_id":null,"html_url":"https://github.com/glassonion1/RxStoreKit","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassonion1%2FRxStoreKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassonion1%2FRxStoreKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassonion1%2FRxStoreKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassonion1%2FRxStoreKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glassonion1","download_url":"https://codeload.github.com/glassonion1/RxStoreKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224596940,"owners_count":17337814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional","ios","observer","reactivex","rxswift","skpaymentqueue","storekit","swift"],"created_at":"2024-08-03T01:00:50.336Z","updated_at":"2024-11-14T09:30:22.181Z","avatar_url":"https://github.com/glassonion1.png","language":"Swift","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# RxStoreKit\n\nRxStoreKit is lightweight and easy to use Rx support for StoreKit(In-App Purchases).\n\n## Usage\n\n### Request Products\n\n```swift\nimport StoreKit\nimport RxSwift\nimport RxStoreKit\n\nlet disposeBag = DisposeBag()\n\nlet productRequest = SKProductsRequest(productIdentifiers: Set([\"your app product id\"]))\nproductRequest.rx.productsRequest\n    .subscribe(onNext: { product in\n        print(product)\n    }).disposed(by: disposeBag)\nproductRequest.start()\n```\n\n### Restore Transactions\n\n```swift\nSKPaymentQueue.default().rx.restoreCompletedTransactions()\n    .subscribe(onNext: { queue in\n        // paymentQueueRestoreCompletedTransactionsFinished\n        print(queue)\n    }, onError: { error in\n        // restoreCompletedTransactionsFailedWithError\n        print(queue)\n    }).disposed(by: disposeBag)\n```\n\n### Request payment\n\n```swift\nlet productRequest = SKProductsRequest(productIdentifiers: Set([\"xxx.xxx.xxx\"]))\nproductRequest.rx.productsRequest\n    .flatMap { response -\u003e Observable\u003cSKProduct\u003e in\n        return Observable.from(response.products)\n    }\n    .flatMap { product -\u003e Observable\u003cSKPaymentTransaction\u003e in\n        return SKPaymentQueue.default().rx.add(product: product)\n    }\n    .subscribe(onNext: { transaction in\n        print(transaction)\n    }).disposed(by: disposeBag)\nproductRequest.start()\n```\n\n### Request receipt refresh\n```swift\nlet receiptRefreshRequest = SKReceiptRefreshRequest()\nreceiptRefreshRequest.rx.request\n    .subscribe(onCompleted: {\n        // Refreshed receipt is available\n    }, onError: { error in\n        print(error)\n    }).disposed(by: disposeBag)\nreceiptRefreshRequest.start()\n```\n\n### Download hosting contents\nDownload In-App Purchase Contents\n```swift\nlet productRequest = SKProductsRequest(productIdentifiers: Set([\"xxx.xxx.xxx\"]))\nproductRequest.rx.productsRequest\n    .flatMap { response -\u003e Observable\u003cSKProduct\u003e in\n        return Observable.from(response.products)\n    }\n    .flatMap { product -\u003e Observable\u003cSKPaymentTransaction\u003e in\n        return SKPaymentQueue.default().rx.add(product: product)\n    }\n    .flatMap { transaction -\u003e Observable\u003cSKDownload\u003e in\n        return SKPaymentQueue.default().rx.start(downloads: transaction.downloads)\n    }\n    .subscribe(onNext: { download in\n        print(download)\n    }).disposed(by: disposeBag)\nproductRequest.start()\n```\n\n## Installation\n\nThis library depends on both __RxSwift__ and __RxCocoa__\n\n### Swift Package Manager\nCreate a Package.swift file.\n```swift\nimport PackageDescription\n\nlet package = Package(\n  name: \"RxTestProject\",\n  dependencies: [\n    .package(url: \"https://github.com/glassonion1/RxStoreKit.git\", from: \"1.3.0\")\n  ],\n  targets: [\n    .target(name: \"RxTestProject\", dependencies: [\"RxStoreKit\"])\n  ]\n)\n```\n\n## License\n\nRxStoreKit is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglassonion1%2FRxStoreKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglassonion1%2FRxStoreKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglassonion1%2FRxStoreKit/lists"}