{"id":17445972,"url":"https://github.com/jamen/sagepay","last_synced_at":"2025-09-25T01:30:54.318Z","repository":{"id":65492396,"uuid":"121887889","full_name":"jamen/sagepay","owner":"jamen","description":"A Node.js package for Sage Pay's server integration protocol.","archived":false,"fork":false,"pushed_at":"2018-02-17T20:00:47.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T11:43:45.482Z","etag":null,"topics":[],"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/jamen.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":"2018-02-17T20:00:36.000Z","updated_at":"2022-05-17T17:43:59.000Z","dependencies_parsed_at":"2023-01-25T19:35:11.620Z","dependency_job_id":null,"html_url":"https://github.com/jamen/sagepay","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/jamen%2Fsagepay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsagepay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsagepay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsagepay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/sagepay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234143349,"owners_count":18786140,"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":[],"created_at":"2024-10-17T18:19:17.566Z","updated_at":"2025-09-25T01:30:54.009Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# sagepay\n\nA Node.js package for [Sage Pay][1]'s [server integration protocol][2].\n\n## Install\n\n```sh\nnpm i sagepay\n```\n\n## Usage\n\nThe docs rely heavily on [\"Sage Pay Server Integration and Protocol Guidelines\n3.00\"][3], specifically pages 44+ (Character Sets and Encoding, Transaction\nRegistration, Notification of Transaction Results, URLs).\n\nRefer to these guidelines to build better understanding on registering,\nverifying, and testing payments from Node.js.\n\n**Note:** All option and return properties match the casing of the guidelines.\n\n### `sagepay.registerTransaction(options)`\n\nRegisters payment with Sage Pay.  Uses `NotificationURL` option to send a request\nback to your server (where you use `sagepay.finishTransaction`).  See [the\nguidelines][3] for more required options.\n\nAdditional options:\n\n- `testing` switches to Sage Pay's test server.  Defaults to `false`\n\nReturns a promise containing the response data.  Use `NextURL` to\nredirect your client to Sage Pay's transaction portal.\n\n```js\nsagepay.registerPayment({\n  Vendor: 'your vendor name',\n  NotificationURL: 'your notification endpoint',\n  TxType: 'payment',\n  // ...\n}).then(result =\u003e {\n  console.log(result.Status)\n  console.log(result.NextURL)\n}, err =\u003e {\n  console.error(err)\n})\n```\n\n### `sagepay.transactionResults(request)`\n\nTakes a [`http.Server` request][4] that comes from Sage Pay's server (after\nregistering the transaction) and returns a promise of the results.  Use\n`sagepay.finishTransaction` after.\n\n```js\nsagepay.transactionResults(request).then(data =\u003e {\n  console.log(data.Status)\n  console.log(data.VendorTxCode)\n  // ...\n}, err =\u003e {\n  console.error(err)\n})\n```\n\n### `sagepay.finishTransaction(response, options)`\n\nWrites [a `http.Server` response][5] to Sage Pay finishing the transaction.\nUses `RedirectURL` option to send the user from the transaction portal back to\nyour website. See [the guidelines][3] for more options.\n\nReturns a promise and resolves when successful.\n\n```js\nsagepay.finishTransaction(request, response, {\n  Status: 'OK',\n  RedirectURL: 'your finish page',\n  // ...\n}).then(resp =\u003e {\n  console.log('Finished transaction')\n}, err =\u003e {\n  console.error(err)\n})\n```\n\n### `sagepay.testCards`\n\nA list of different test cards in the format:\n\n```json\n{\n  \"method\": \"Visa\",\n  \"number\": \"4929 0000 0000 6\",\n  \"cardtype\": \"VISA\",\n  \"3dsecure\": \"Y\"\n}\n```\n\nSee [the guidelines][3] for more details\n\n### `sagepay.fields`\n\nList of all request and response fields with proper casing.\n\n## License\n\n[MIT](license) \u0026copy; Jamen Marz\n\n[1]: https://www.sagepay.co.uk/\n[2]: https://www.sagepay.co.uk/support/find-an-integration-document/server-integration-documents\n[3]: https://www.sagepay.co.uk/file/25046/download-document/SERVER_Integration_and_Protocol_Guidelines_270815.pdf?token=0vicY97ySO6ig8HB1AKWj_6_RO4FSG9gChHL9ftI0Ow\n[4]: https://nodejs.org/api/http.html#http_class_http_incomingmessage\n[5]: https://nodejs.org/api/http.html#http_class_http_serverresponse\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fsagepay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fsagepay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fsagepay/lists"}