{"id":28211618,"url":"https://github.com/skyquakers/payshift","last_synced_at":"2025-07-28T05:34:22.075Z","repository":{"id":199907025,"uuid":"612276027","full_name":"Skyquakers/payshift","owner":"Skyquakers","description":"聚合支付，支持彩虹易支付。Unified Payment API for Multiple Payment Processors","archived":false,"fork":false,"pushed_at":"2025-07-11T03:34:40.000Z","size":1008,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-07-18T11:47:37.710Z","etag":null,"topics":["alipay","ccbill","epay","ngenius","nodejs","payment","payment-integration","paypal","stripe","wechat-pay","weixin-pay"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Skyquakers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-03-10T15:23:52.000Z","updated_at":"2025-07-13T02:04:11.000Z","dependencies_parsed_at":"2023-11-16T14:36:35.997Z","dependency_job_id":"251fcf10-fe9c-4170-8843-6502f48d3cc9","html_url":"https://github.com/Skyquakers/payshift","commit_stats":null,"previous_names":["skyquakers/payshift"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Skyquakers/payshift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyquakers%2Fpayshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyquakers%2Fpayshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyquakers%2Fpayshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyquakers%2Fpayshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Skyquakers","download_url":"https://codeload.github.com/Skyquakers/payshift/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyquakers%2Fpayshift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267468546,"owners_count":24092334,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ccbill","epay","ngenius","nodejs","payment","payment-integration","paypal","stripe","wechat-pay","weixin-pay"],"created_at":"2025-05-17T18:09:44.742Z","updated_at":"2025-07-28T05:34:22.067Z","avatar_url":"https://github.com/Skyquakers.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payshift\n\nunified payment api for multiple payment processors\n\n## Installation\n\n```bash\nnpm install payshift\n```\n\n## Supported Payment Processors\n\n- Alipay\n- Wechat Pay\n- Stripe\n- Paypal\n- EPay\n- Multiple EPay instances with round robin algorithm to split your cashflow and risk\n- CCBill\n- N-Genius Payments\n- Peropay\n\n## Usage\n\n```javascript\nimport {\n  Payshift,\n  AlipayProvider,\n  StripeProvider,\n  WechatPayProvider,\n  EPayProvider,\n  EPayClusterProvider\n} from \"payshift\"\nimport { privateKeyPath, alipayPublicKeyPath, appId } from \"your alipay config\"\nimport { testKey, endpointSecret } from \"your stripe config\"\nimport { apiKey, mcid, publicKeyPath } from \"your wechatpay config\"\nimport { pid, key, endpoint } from \"your epay config\"\n\nconst alipay = new AlipayProvider({\n  appId,\n  privateKey: fs.readFileSync(path.join(__filename, privateKeyPath))\n  alipayPublicKey: fs.readFileSync(path.join(__filename, alipayPublicKeyPath))\n})\nconst stripe = new StripeProvider(testKey)\nconst wechat = new WechatPayProvider(appId, mcid, publicKeyPath, privateKeyPath, apiKey)\nconst epay = new EPayProvider(endpoint, pid, key)\nconst anotherEPay = new EPayProvider(anotherEndpoint, anotherPid, anotherKey)\nconst epayCluster = new EPayClusterProvder([epay, anotherEPay])\n\nconst payshift = new Payshift([alipay, stripe, wechat, epay, epayCluster], {\n  stripeEndpointSecret: endpointSecret\n})\n// webhooks server, used for notify_url for some payments\npayshift.startWebServer('http://localhost:3000', 3000)\n\n// optionally, you can use mongodb to save your txns in \"payshift\" database\npayshit.usedb()\n\n// handle webhooks using the internal webhook server\npayshift.on('charge.succeeded', async event =\u003e {\n  // handle event, eg. update the status of your order\n  // throwing any error will fail the webhook to the payment processor as well\n})\n```\n\nWhere `event` is a `PayshiftEvent`\n\n```typescript\ntype PayshiftEvent = {\n  amount?: number // in cents\n  title?: string\n  outTradeNo?: string\n  tradeNo?: string\n  provider: PayshiftProviderName\n  name: PayshiftEventName\n  currency?: CurrencyCode\n  accountId?: string\n}\n```\n\nThen\n\n```javascript\n// depending on your channel, res varys\nconst res = await payshift.createCharge({\n  outTradeNo: '123123123',\n  title: 'item',\n  amount: 1,\n  channel: 'alipay_mobile_web',\n  currency: CurrencyCode.CNY,\n  returnUrl: 'http://taobao.com',\n  clientIp: '127.0.0.1',\n})\n\n// in this case for alipay_mobile_web, res.data is a string of url\nreturn res.data\n```\n\n## Supported Payment Channels\n\n```typescript\ntype PayshiftChannel =\n  | 'stripe_web'\n  | 'alipay_web'\n  | 'wechat_qrcode'\n  | 'wechat_mobile_web'\n  | 'alipay_mobile_web'\n  | 'epay_alipay'\n  | 'epay_wechat_pay'\n  | 'epay_cluster_alipay'\n  | 'epay_cluster_wechat_pay'\n  | 'order2faka'\n  | 'paypal'\n  | 'ccbill_web'\n```\n\n## Using Provider Alone\n\nOf course you can use provider independently\n\n```javascript\nconst provider = new StripeProvider(testKey)\nconst accountId = await provider.createAccount({\n  country: 'JP',\n  type: 'express',\n  business_type: 'individual',\n  capabilities: { transfers: { requested: true } },\n  tos_acceptance: { service_agreement: 'recipient' },\n})\nconst url = await provider.createAccountLink(\n  accountId,\n  'http://taobao.com',\n  'http://taobao.com'\n)\nconsole.log(url)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyquakers%2Fpayshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyquakers%2Fpayshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyquakers%2Fpayshift/lists"}