{"id":25703578,"url":"https://github.com/tikhop/mercato","last_synced_at":"2025-08-07T15:23:30.890Z","repository":{"id":45023768,"uuid":"410146170","full_name":"tikhop/Mercato","owner":"tikhop","description":"Lightweight StoreKit 2 Wrapper","archived":false,"fork":false,"pushed_at":"2024-10-16T21:21:52.000Z","size":97,"stargazers_count":73,"open_issues_count":4,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T02:39:33.461Z","etag":null,"topics":["in-app-purchase","in-app-receipt","ios","macos","storekit","storekit2"],"latest_commit_sha":null,"homepage":"","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/tikhop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-25T01:32:03.000Z","updated_at":"2025-03-31T06:19:11.000Z","dependencies_parsed_at":"2022-08-29T19:20:22.765Z","dependency_job_id":"8887cf76-b403-4e66-a8ef-390368021e3f","html_url":"https://github.com/tikhop/Mercato","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikhop%2FMercato","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikhop%2FMercato/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikhop%2FMercato/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikhop%2FMercato/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tikhop","download_url":"https://codeload.github.com/tikhop/Mercato/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999860,"owners_count":21031046,"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":["in-app-purchase","in-app-receipt","ios","macos","storekit","storekit2"],"created_at":"2025-02-25T05:32:31.193Z","updated_at":"2025-04-09T08:08:30.692Z","avatar_url":"https://github.com/tikhop.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg height=\"160\" src=\"https://github.com/tikhop/Mercato/blob/master/www/logo.png\" /\u003e\n\u003c/p\u003e\n\n# Mercato\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://mit-license.org)\n[![Platform](http://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-lightgrey.svg?style=flat)](https://developer.apple.com/resources/)\n[![Language](https://img.shields.io/badge/swift-5.5-orange.svg)](https://developer.apple.com/swift)\n\nMercato is a lightweight In-App Purchases (StoreKit 2) library for iOS, tvOS, watchOS, macOS, and Mac Catalyst.\n\nInstallation\n------------\n\n### Swift Package Manager\n\nTo integrate using Apple's Swift package manager, add the following as a dependency to your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/tikhop/Mercato.git\", .upToNextMajor(from: \"0.0.1\"))\n```\n\nThen, specify `\"Mercato\"` as a dependency of the Target in which you wish to use Mercato.\n\nLastly, run the following command:\n```swift\nswift package update\n```\n\n### CocoaPods\n\nIn progress...\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\nIn any swift file you'd like to use Mercato, import the framework with `import Mercato`.\n\n### Requirements\n\n- iOS 15.0 / OSX 12.0 / watchOS 8.0\n- Swift 5.5\n\nUsage\n-------------\n\n#### Listen for transaction updates\n\nStart transaction update listener as soon as your app launches so you don't miss a single transaction. This is important, for example, to handle transactions that may have occured after `purchase` returns, like an adult approving a child's purchase request or a purchase made on another device.\n\n\u003e If your app has unfinished transactions, you receive them immediately after the app launches\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool\n{\n\tMercato.listenForTransactions(finishAutomatically: false) { transaction in\n\t\t//Deliver content to the user.\n\t\t\n\t\t//Finish transaction\n\t\tawait transaction.finish()\n\t}\n\t\n\treturn true\n}\n```\n\n#### Fetching products\n\n```swift\ndo\n{\n\tlet productIds: Set\u003cString\u003e = [\"com.test.product.1\", \"com.test.product.2\", \"com.test.product.3\"]\n\tlet products = try await Mercato.retrieveProducts(productIds: productIds)\n\t\n\t//Show products to the user\n}catch{\n\t//Handle errors\n}\n```\n\n#### Purchase a product \n\n```swift\ntry await Mercato.purchase(product: product, quantity: 1, finishAutomatically: false, appAccountToken: nil, simulatesAskToBuyInSandbox: false)\n```\n\n#### Offering in-app refunds\n\n```swift\ntry await Mercato.beginRefundProcess(for: product, in: windowScene)\n```\n\n#### Restore completed transactions\n\n In general users won't need to restore completed transactions when your app is reinstalled or downloaded on a new device. Everything should automatically be fetched by StoreKit and stay up to date. In the rare case that a user thinks they should have a transaction but you don't see it, you have to provide UI in your app that allows users to initiate the sync. It should be very rare that a user needs to initiate a sync manually. Automatic synchronization should cover the majority of cases.\n  \n```swift\ntry await Mercato.restorePurchases()\n```\n\n## Essential Reading\n\n* [Apple - Meet StoreKit 2](https://developer.apple.com/videos/play/wwdc2021/10114/)\n* [Apple - In-App Purchase](https://developer.apple.com/documentation/storekit/in-app_purchase)\n* [WWDC by Sundell - Working With In-App Purchases in StoreKit 2](https://wwdcbysundell.com/2021/working-with-in-app-purchases-in-storekit2/)\n\n## License\n\nMercato is released under an MIT license. See [LICENSE](https://github.com/tikhop/Mercato/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftikhop%2Fmercato","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftikhop%2Fmercato","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftikhop%2Fmercato/lists"}