{"id":20681229,"url":"https://github.com/flxxyz/bytedance-mini-pay","last_synced_at":"2026-04-17T16:31:30.778Z","repository":{"id":57192102,"uuid":"385176835","full_name":"flxxyz/bytedance-mini-pay","owner":"flxxyz","description":"字节跳动小程序支付SDK","archived":false,"fork":false,"pushed_at":"2022-02-28T04:19:31.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T12:51:28.493Z","etag":null,"topics":["bytedance-miniapp","bytedance-miniprogram","bytedance-sdk","pay","payment"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/flxxyz.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":"2021-07-12T08:26:31.000Z","updated_at":"2022-09-30T09:31:50.000Z","dependencies_parsed_at":"2022-09-01T06:02:45.405Z","dependency_job_id":null,"html_url":"https://github.com/flxxyz/bytedance-mini-pay","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fbytedance-mini-pay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fbytedance-mini-pay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fbytedance-mini-pay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fbytedance-mini-pay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flxxyz","download_url":"https://codeload.github.com/flxxyz/bytedance-mini-pay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242926226,"owners_count":20207754,"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":["bytedance-miniapp","bytedance-miniprogram","bytedance-sdk","pay","payment"],"created_at":"2024-11-16T22:10:13.327Z","updated_at":"2026-04-17T16:31:25.756Z","avatar_url":"https://github.com/flxxyz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bytedance-mini-pay\n字节跳动小程序支付SDK\n\n\u003ca href=\"https://npmcharts.com/compare/bytedance-mini-pay?minimal=true\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/bytedance-mini-pay.svg?sanitize=true\" alt=\"Downloads\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/bytedance-mini-pay\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/bytedance-mini-pay.svg?sanitize=true\" alt=\"Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/bytedance-mini-pay\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/bytedance-mini-pay.svg?sanitize=true\" alt=\"License\" /\u003e\u003c/a\u003e\n\n## 使用\n\n```javascript\nconst { TTPay } = require('bytedance-mini-pay');\n\nconst ttpay = new TTPay({\n  appId: '',  // 必须\n  appSecret: '',  // 必须\n  SALT: '',  // 必须\n  TOKEN: '',  // 可选 为了安全性请务必填写！\n  mchId: '',  // 可选 商户号\n  notifyURL: 'https://example.com/webhook/payments/toutiao/callback',  // 可选 支付回调URL\n});\n\n// 下单的回调消息\nconst orderNotify = {\n  msg: '{\"appid\":\"tt84cdf2701bf7f8ed\",\"cp_orderno\":\"t000004\",\"cp_extra\":\"\",\"way\":\"1\",\"channel_no\":\"\",\"channel_gateway_no\":\"12106090149746618265\",\"payment_order_no\":\"4346300973202106091611552039\",\"out_channel_order_no\":\"\",\"total_amount\":1,\"status\":\"SUCCESS\",\"seller_uid\":\"69664700453838051970\"}',\n  msg_signature: 'b6fd60b92b9e3502cab6e1e505a91ebaedc8a6d0',\n  type: 'payment',\n  timestamp: '1623235256',\n  nonce: '2281'\n};\nif (ttpay.checkNotifySign(orderNotify)) {\n  console.log('下单验证成功');\n}\n\n// 退款的回调消息\nconst refundNotify = {\n  msg: '{\"appid\":\"tt84cdf2701bf7f8ed\",\"cp_refundno\":\"t343413r\",\"cp_extra\":\"\",\"status\":\"SUCCESS\",\"refund_amount\":1}',\n  msg_signature: '9f7e0f8ac2bd0436ee2ca56f273bebfee4a5a37a',\n  type: 'refund',\n  timestamp: '1623239959',\n  nonce: '2103',\n};\n\nif (ttpay.checkNotifySign(refundNotify)) {\n  console.log('退款验证成功');\n}\n```\n\n完整Web示例可以看 [example](https://github.com/flxxyz/bytedance-mini-pay/tree/master/example)\n\n## Reference\n\n- [字节小程序担保支付简介](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/ecpay/introduction/)\n- [接口定义](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/ecpay/server-doc/)\n- [附录](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/ecpay/appendix/)\n\n## License\n\n采用[MIT](./LICENSE)许可证\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflxxyz%2Fbytedance-mini-pay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflxxyz%2Fbytedance-mini-pay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflxxyz%2Fbytedance-mini-pay/lists"}