{"id":17690549,"url":"https://github.com/slashmo/swift-app-store-receipt-validation","last_synced_at":"2025-05-13T02:13:09.560Z","repository":{"id":55678369,"uuid":"224618706","full_name":"slashmo/swift-app-store-receipt-validation","owner":"slashmo","description":"Small wrapper around AsyncHTTPClient to verify App Store Receipts.","archived":false,"fork":false,"pushed_at":"2020-12-13T12:36:54.000Z","size":26,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T02:13:02.725Z","etag":null,"topics":["appstoreconnect","asynchttpclient","receipt","swift","swift-nio","swift-server"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slashmo.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":"2019-11-28T09:37:04.000Z","updated_at":"2023-05-29T15:09:49.000Z","dependencies_parsed_at":"2022-08-15T06:20:25.180Z","dependency_job_id":null,"html_url":"https://github.com/slashmo/swift-app-store-receipt-validation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashmo%2Fswift-app-store-receipt-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashmo%2Fswift-app-store-receipt-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashmo%2Fswift-app-store-receipt-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashmo%2Fswift-app-store-receipt-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slashmo","download_url":"https://codeload.github.com/slashmo/swift-app-store-receipt-validation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856664,"owners_count":21974582,"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":["appstoreconnect","asynchttpclient","receipt","swift","swift-nio","swift-server"],"created_at":"2024-10-24T11:51:10.189Z","updated_at":"2025-05-13T02:13:09.544Z","avatar_url":"https://github.com/slashmo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AppStoreReceiptValidation\n\n[![Swift 5.1](https://img.shields.io/badge/Swift-5.1-blue.svg)](https://swift.org/download/)\n[![github-actions](https://github.com/fabianfett/swift-aws-lambda/workflows/CI/badge.svg)](https://github.com/fabianfett/swift-aws-lambda/actions)\n[![codecov](https://codecov.io/gh/fabianfett/swift-app-store-receipt-validation/branch/main/graph/badge.svg)](https://codecov.io/gh/fabianfett/swift-app-store-receipt-validation)\n\nThis package implements the [validating receipts with the app store](https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1) api.\n\n## Features:\n\n- [x] Great swift server citizen: Uses [`AsyncHTTPClient`](https://github.com/swift-server/async-http-client) and [`Swift-NIO`](https://github.com/apple/swift-nio) under the hood.\n- [x] Automatic retry, if sandbox receipt was send to production.\n- [x] Response object is pure swift struct using enums.\n- [x] API Erros are translated into corresponding swift errors.\n\n## Usage\n\nAdd `swift-app-store-receipt-validation`, `async-http-client` and `swift-nio` as dependencies to \nyour project. For this open your `Package.swift` and add this to your dependencies:\n\n```swift\n  dependencies: [\n    .package(url: \"https://github.com/swift-server/async-http-client\", .upToNextMajor(from: \"1.1.0\")),\n    .package(url: \"https://github.com/apple/swift-nio\", .upToNextMajor(from: \"2.14.0\")),\n    .package(url: \"https://github.com/slashmo/swift-app-store-receipt-validation\", .upToNextMajor(from: \"0.1.0\")),\n  ]\n```\n  \nThen, add `AsyncHTTPClient`, `SwiftNIO` and `AppStoreReceiptValidation` as target dependencies.\n\n```swift\n  targets: [\n    .target(name: \"Hello\", dependencies: [\n      .product(name: \"NIO\", package: \"swift-nio\"),\n      .product(name: \"AsyncHTTPClient\", package: \"async-http-client\"),\n      .product(name: \"AppStoreReceiptValidation\", package: \"swift-app-store-receipt-validation\"),\n    ]\n  ]\n```\n\nTo verify an AppStore Receipt in your code you need to create an `HTTPClient` first:\n\n```swift\n\nlet httpClient = HTTPClient(eventLoopGroupProvider: .createNew)\ndefer { try? httpClient.syncShutdown() }\n\nlet appStoreClient = AppStore.Client(httpClient: httpClient, secret: \"abc123\")\n\nlet base64EncodedReceipt: String = ...\nlet receipt = try appStoreClient.validateReceipt(base64EncodedReceipt).wait()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslashmo%2Fswift-app-store-receipt-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslashmo%2Fswift-app-store-receipt-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslashmo%2Fswift-app-store-receipt-validation/lists"}