{"id":21373802,"url":"https://github.com/itenfay/DYFStoreReceiptVerifier_Swift","last_synced_at":"2025-07-13T08:30:46.145Z","repository":{"id":70510547,"uuid":"229786678","full_name":"itenfay/DYFStoreReceiptVerifier_Swift","owner":"itenfay","description":"An open source receipt verification client program.","archived":false,"fork":false,"pushed_at":"2025-01-05T07:17:22.000Z","size":134,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T22:02:20.486Z","etag":null,"topics":["auto-renewable-subscriptions","itunes","itunes-store","receipt","receipt-verification","sandbox","shared-secret","store","storekit","subscriptions","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itenfay.png","metadata":{"files":{"readme":"README-en.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-12-23T16:24:39.000Z","updated_at":"2025-01-05T07:13:49.000Z","dependencies_parsed_at":"2024-06-02T10:13:58.553Z","dependency_job_id":"f1fbf5dc-f233-4110-989b-a4756a172762","html_url":"https://github.com/itenfay/DYFStoreReceiptVerifier_Swift","commit_stats":null,"previous_names":["itenfay/dyfstorereceiptverifier_swift"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/itenfay/DYFStoreReceiptVerifier_Swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFStoreReceiptVerifier_Swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFStoreReceiptVerifier_Swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFStoreReceiptVerifier_Swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFStoreReceiptVerifier_Swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itenfay","download_url":"https://codeload.github.com/itenfay/DYFStoreReceiptVerifier_Swift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFStoreReceiptVerifier_Swift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265109673,"owners_count":23712730,"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":["auto-renewable-subscriptions","itunes","itunes-store","receipt","receipt-verification","sandbox","shared-secret","store","storekit","subscriptions","swift"],"created_at":"2024-11-22T08:29:31.372Z","updated_at":"2025-07-13T08:30:46.136Z","avatar_url":"https://github.com/itenfay.png","language":"Swift","funding_links":[],"categories":["OOM-Leaks-Crash"],"sub_categories":["Payment"],"readme":"English Vision | [中文版](README.md)\n\n## DYFStoreReceiptVerifier_Swift\n\nAn open source receipt verification program for iOS([Objective-C Version](https://github.com/itenfay/DYFStoreReceiptVerifier)). \n\nIt is recommended that use your own server to obtain the parameters uploaded from the client to verify the receipt from the App Store server (C -\u003e Uploaded Parameters -\u003e S -\u003e App Store S -\u003e S -\u003e Receive And Parse Data -\u003e C, C: client, S: server).\n\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](LICENSE)\u0026nbsp;\n[![CocoaPods Version](http://img.shields.io/cocoapods/v/DYFStoreReceiptVerifier_Swift.svg?style=flat)](http://cocoapods.org/pods/DYFStoreReceiptVerifier_Swift)\u0026nbsp;\n![CocoaPods Platform](http://img.shields.io/cocoapods/p/DYFStoreReceiptVerifier_Swift.svg?style=flat)\u0026nbsp;\n\n\n## Group (ID:614799921)\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/DYFStoreReceiptVerifier_Swift/raw/master/images/g614799921.jpg\" width=\"30%\" /\u003e\n\u003c/div\u003e\n\n\n## Installation\n\nUsing [CocoaPods](https://cocoapods.org):\n\n```\npod 'DYFStoreReceiptVerifier_Swift'\n```\n\n\n## Usage\n\n- The URLs for verification.\n\n1. Sandbox URL: `https://sandbox.itunes.apple.com/verifyReceipt` \u003cbr\u003e\n2. Production URL: `https://buy.itunes.apple.com/verifyReceipt`\n\n- The reference verifier.\n\nYou create and return a receipt verifier(`DYFStoreReceiptVerifier`) by using lazy loading.\n\n```\nlazy var receiptVerifier: DYFStoreReceiptVerifier = {\n    let verifier = DYFStoreReceiptVerifier()\n    verifier.delegate = self\n    return verifier\n}()\n```\n\n- The verifier delegates receipt verification.\n\n1. Using the `DYFStoreReceiptVerifierDelegate` protocol:\n\n```\nfunc verifyReceiptDidFinish(_ verifier: DYFStoreReceiptVerifier, didReceiveData data: [String : Any])\nfunc verifyReceipt(_ verifier: DYFStoreReceiptVerifier, didFailWithError error: NSError)\n```\n\n2. You provide your own implementation.\n\n```\npublic func verifyReceiptDidFinish(_ verifier: DYFStoreReceiptVerifier, didReceiveData data: [String : Any]) {\n    // Writes the implementation codes.\n}\n\npublic func verifyReceipt(_ verifier: DYFStoreReceiptVerifier, didFailWithError error: NSError) {\n    // Writes the implementation codes.\n}\n````\n\n- Verifies the receipt.\n\n- Step1:\n\nFetches the data of the bundle’s App Store receipt. \n\n```\n// receiptData: the data of the bundle’s App Store receipt. \nlet receiptData = DYFStore.receiptURL()\nlet data = receiptData\n```\n\n- Step2:\n\nVerifies the in-app purchase receipt.\n\n```\nself.receiptVerifier.verifyReceipt(data)\n```\n\nYour app’s shared secret (a hexadecimal string). Only used for receipts that contain auto-renewable subscriptions.\n\n```\nself.receiptVerifier.verifyReceipt(data, sharedSecret: \"A43512564ACBEF687924646CAFEFBDCAEDF4155125657\")\n```\n\n- The status code and description.\n\n```\n/// Matches the message with the status code.\n///\n/// - Parameter status: The status code of the request response. More, please see [Receipt Validation Programming Guide](https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1)\n/// - Returns: A tuple that contains status code and the description of status code.\npublic func matchMessage(withStatus status: Int) -\u003e (Int, String) {\n    var message: String = \"\"\n    switch status {\n    case 0:\n        message = \"The receipt as a whole is valid.\"\n        break\n    case 21000:\n        message = \"The App Store could not read the JSON object you provided.\"\n        break\n    case 21002:\n        message = \"The data in the receipt-data property was malformed or missing.\"\n        break\n    case 21003:\n        message = \"The receipt could not be authenticated.\"\n        break\n    case 21004:\n        message = \"The shared secret you provided does not match the shared secret on file for your account.\"\n        break\n    case 21005:\n        message = \"The receipt server is not currently available.\"\n        break\n    case 21006:\n        message = \"This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response. Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions.\"\n        break\n    case 21007:\n        message = \"This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.\"\n        break\n    case 21008:\n        message = \"This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead.\"\n        break\n    case 21010:\n        message = \"This receipt could not be authorized. Treat this the same as if a purchase was never made.\"\n        break\n    default: /* 21100-21199 */\n        message = \"Internal data access error.\"\n        break\n    }\n    return (status, message)\n}\n\n/// Matches the message with the status code.\n///\n/// - Parameter status: The status code of the request response. More, please see [Receipt Validation Programming Guide](https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1)\n/// - Returns: A string that contains the description of status code.\npublic func matchMessage(withStatus status: Int) -\u003e String {\n    let (_, msg) = matchMessage(withStatus: status)\n    return msg\n}\n```\n\n\n## Requirements\n\n`DYFStoreReceiptVerifier_Swift` requires `iOS 8.0` or above and `ARC`.\n\n\n## Demo\n\nTo learn more, please check out [Demo](https://github.com/itenfay/DYFStore/blob/master/DYFStoreDemo/Sample/SKIAPManager.swift).\n\n\n## Feedback is welcome\n\nIf you notice any issue to create an issue. I will be happy to help you.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2FDYFStoreReceiptVerifier_Swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitenfay%2FDYFStoreReceiptVerifier_Swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2FDYFStoreReceiptVerifier_Swift/lists"}