{"id":21102180,"url":"https://github.com/renyijiu/alipay_mini","last_synced_at":"2025-05-16T18:34:39.889Z","repository":{"id":59150526,"uuid":"145518675","full_name":"renyijiu/alipay_mini","owner":"renyijiu","description":"An unofficial simple alipay mini program gem","archived":false,"fork":false,"pushed_at":"2019-01-14T13:50:23.000Z","size":33,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-11T03:52:47.218Z","etag":null,"topics":["alipay-mini-program","alipay-sdk","ruby-gem"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/alipay_mini","language":"Ruby","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/renyijiu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-21T06:40:34.000Z","updated_at":"2019-09-18T10:05:28.000Z","dependencies_parsed_at":"2022-09-13T10:50:16.723Z","dependency_job_id":null,"html_url":"https://github.com/renyijiu/alipay_mini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renyijiu%2Falipay_mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renyijiu%2Falipay_mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renyijiu%2Falipay_mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renyijiu%2Falipay_mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renyijiu","download_url":"https://codeload.github.com/renyijiu/alipay_mini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225444688,"owners_count":17475354,"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":["alipay-mini-program","alipay-sdk","ruby-gem"],"created_at":"2024-11-19T23:54:19.039Z","updated_at":"2024-11-19T23:54:19.508Z","avatar_url":"https://github.com/renyijiu.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://travis-ci.com/renyijiu/alipay_mini.svg?branch=master)\n[![Gem Version](https://badge.fury.io/rb/alipay_mini.svg)](https://badge.fury.io/rb/alipay_mini)\n[![Maintainability](https://api.codeclimate.com/v1/badges/38ee73000994e3721c04/maintainability)](https://codeclimate.com/github/renyijiu/alipay_mini/maintainability)\n\n[English](https://github.com/renyijiu/alipay_mini/blob/master/README_en.md)\n\n# AlipayMini\n\n一个非官方的支付宝小程序相关的gem包。\n\n由于官方未提供Ruby版本的服务端SDK，所以对于小程序开放的接口进行Ruby版本的封装。\n\n## 安装\n\n在Gemfile中添加下列命令：\n\n```ruby\ngem 'alipay_mini', '~\u003e 0.1.0'\n```\n\n执行下列命令：\n\n    $ bundle\n\n或者通过命令行安装gem：\n\n    $ gem install alipay_mini\n\n## 使用\n\n### Config配置\n\n首先配置的初始选项\n\n```ruby\nAlipayMini.configure do |c|\n   c.private_key = \"your own private key generate by alipay\"\n   c.public_key = \"the alipay's public key\"\n   c.url = \"the alipay api url\"\n   c.app_id = \"your own app_id\"\nend\n```\n\n\u003e 注意⚠️: public_key 为支付宝官方的公钥，不要填错了！！！\n\n示例：\n\n```ruby\nAlipayMini.configure do |c|\n  c.private_key = \"MIIEogIBAAKCAQEA0J12pYTGu5y6uWv06/vso4EZkmh9s51hbV4TiM9K99x4bz/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p5kM2lNjNsCIrFdv0bFRdbnYH4RcR8KFTjHMXMYHPr4tJAjG7xxJokXkqxfSfjgK/kOHRHAprc3VhAo0SmcMx+0QKBgEZakzbYcb1SzGAMjRiWAhQgSVP6+caNSy4zI84ro1sAJsBTz30lOOTloyLCO5dNAWyVnzeGNCS3rB56VDBs5fDiAiYCcT2KjE6EpOGMXBiAhffwG7F6nnA5bFIEi62gPElxyjAm2RO/UAlgSoq9QJWdhjQR5M336j2o2ENKOPSBAoGAeeduPyZrc2oa3zJJdgMuSN8zrfG9OMYIeGfBkAv5YPrqpYryn9w0FDj+aHLsCwiVOZPeS39ySa/0+7j7rnw/fAS2meHguosE5PlQgQfTG1V24xogPwXoBP1b3dgyC18JHWQu/wucEe9a11VTVHqY7rMDEcL6R0WPljCxNChnj5Q=\"\n  c.public_key = \"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoBr6Ag68Dlbf/ZNvqNotNpe2pDei58ObbD7SNEWjMx8CpTTIOqgwbCL0EHuUAF1fxOP42uLd4n/fEdbU0BNkd+4TL71P49Fq4wMXyqoYm+EzEZ8mBnevKtPPb813L1W2thZVISNWMR67axyy6xMk77YOEqRUz3hfJlowm9us8YgHranx+O1vR8olgVTdhjOub9QD/tK7ok1GWSw/dBFpcG9WTuKnPrklMIBxUllIONciH+7KGX+Yhs0zLTEPRufATAy1slIC8NhoBSxSB0PRsix4/gVCw4IAIzGPspdRPA0ZCeJPrjGvuBh9215lNpv0+ew6/a/x3db0ZIVDzLrzyQIDAQAB\"\n  c.app_id = \"2015102700040153\"\n  c.url = \"https://openapi.alipaydev.com/gateway.do\"\nend\n```\n\n## API\n\n### [alipay.system.oauth.token](https://docs.open.alipay.com/api_9/alipay.system.oauth.token)\n\n```ruby\n# when grant_type is 'authorization_code', code is the auth_code\n# when grant_type is 'refresh_token', code is the refresh_token\n#\n# @param grant_type String - 'authorization_code', 'refresh_token'\n# @param code String - auth_code or refresh_token\n#\n# @return Array - [flag\u003cBoolean\u003e, res\u003cHash\u003e] flag: request status, res: response hash\n#\n# Example:\n#   AlipayMini.system_oauth_token('authorization_code', 'helloworld')\n#\n\nAlipayMini.system_oauth_token(grant_type, code)\n```\n### [alipay.user.info.share](https://docs.open.alipay.com/api_2/alipay.user.info.share)\n\n```ruby\n# @param access_token String\n#\n# @return Array [flag\u003cBoolean\u003e, res\u003cHash\u003e]\n#\n# Example:\n#   AlipayMini.user_info_share(\"helloworld\")\n#\n\nAlipayMini.user_info_share(access_token)\n```\n\n### Response\n\n```ruby\n# flag: request state, true is success, false means the request error\n#\n# Example:\n#   AlipayMini.system_oauth_token('authorization_code', 'helloworld')\n#\n# Return:\n#   [true,  {\"access_token\" =\u003e \"12345\", \"alipay_user_id\" =\u003e \"12345\", \"expires_in\" =\u003e 1296000, \"re_expires_in\" =\u003e 2592000, \"refresh_token\" =\u003e \"12345\", \"user_id\"=\u003e \"12345\"}]\n#   \n#   [false, {\"code\" =\u003e \"40002\", \"msg\" =\u003e \"Invalid Arguments\", \"sub_code\" =\u003e \"isv.code-invalid\", \"sub_msg\" =\u003e \"授权码code无效\"}]]\t\n# \n```\n\n## 进度\n\n### 已完成\n\n1. [换取授权访问令牌](https://docs.open.alipay.com/api_9/alipay.system.oauth.token)(alipay.user.info.share)\n2. [支付宝会员授权信息查询接口](https://docs.open.alipay.com/api_2/alipay.user.info.share)(alipay.user.info.share)\n\n\n## 如何贡献\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n欢迎贡献相关代码或是提交你的使用反馈👏，另外请记得为你的代码编写测试。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenyijiu%2Falipay_mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenyijiu%2Falipay_mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenyijiu%2Falipay_mini/lists"}