{"id":17056769,"url":"https://github.com/halturin/applepay","last_synced_at":"2025-04-12T17:33:53.905Z","repository":{"id":57411064,"uuid":"69250465","full_name":"halturin/applepay","owner":"halturin","description":"a Python library for decrypting Apple Pay payment tokens.","archived":false,"fork":false,"pushed_at":"2021-03-08T10:15:30.000Z","size":52,"stargazers_count":64,"open_issues_count":4,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T10:17:51.235Z","etag":null,"topics":["apple-pay","encryption","python","python-library","token"],"latest_commit_sha":null,"homepage":"","language":"Python","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/halturin.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":"2016-09-26T13:01:54.000Z","updated_at":"2025-03-12T12:03:34.000Z","dependencies_parsed_at":"2022-09-09T22:23:10.133Z","dependency_job_id":null,"html_url":"https://github.com/halturin/applepay","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halturin%2Fapplepay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halturin%2Fapplepay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halturin%2Fapplepay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halturin%2Fapplepay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halturin","download_url":"https://codeload.github.com/halturin/applepay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248605072,"owners_count":21132104,"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":["apple-pay","encryption","python","python-library","token"],"created_at":"2024-10-14T10:25:33.004Z","updated_at":"2025-04-12T17:33:53.859Z","avatar_url":"https://github.com/halturin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Python library for decrypting Apple Pay payment tokens.\n\nApplePay reference https://developer.apple.com/library/ios/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html\n\n## Apple's intermediate and root certificates\n\n```sh\n$ wget 'https://www.apple.com/certificateauthority/AppleAAICAG3.cer'\n$ wget 'https://www.apple.com/certificateauthority/AppleRootCA-G3.cer'\n```\n\n## Install\n\nInstalling library into your environment:\n\n```sh\n$ pip install applepay\n```\n\n## Usage\n\nStep by step:\n\n\n```python\nfrom applepay import payment as apple\n\n# payment_json value example:\n#\n#    {\"data\":\"\u003c\u003cBase64EncodedData\u003e\u003e\",\n#     \"header\":\n#         {\"publicKeyHash\":\"\u003c\u003cBase64EncodedData\u003e\u003e\",\n#          \"ephemeralPublicKey\":\"\u003c\u003cBase64EncodedData\u003e\u003e\",\n#          \"transactionId\":\"\u003c\u003cHexifiedData\u003e\u003e\"},\n#     \"version\":\"EC_v1\"}\n\n\ncertificate_pem = open('merchant_cert.pem', 'rb').read()\nprivate_key_pem = open('merchant_private_key', 'rb').read()\n\npayment = apple.Payment(certificate_pem, private_key_pem)\n\ndecrypted_json = payment.decrypt(payment_json['header']['ephemeralPublicKey'], payment_json['data'])\n\n\n# decrypted_json value example\n#    {\n#      \"applicationPrimaryAccountNumber\"=\u003e\"4804123456789012\",\n#      \"applicationExpirationDate\"=\u003e\"190123\",\n#      \"currencyCode\"=\u003e\"123\",\n#      \"transactionAmount\"=\u003e700,\n#      \"deviceManufacturerIdentifier\"=\u003e\"123456789012\",\n#      \"paymentDataType\"=\u003e\"3DSecure\",\n#      \"paymentData\"=\u003e {\n#        \"onlinePaymentCryptogram\"=\u003e\"\u003c\u003cBase64EncodedData\u003e\u003e\",\n#        \"eciIndicator\"=\u003e\"5\"\n#      }\n#    }\n```\n\n## Testing\n\n```sh\n$ python setup.py test\n```\n\n## Contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalturin%2Fapplepay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalturin%2Fapplepay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalturin%2Fapplepay/lists"}