{"id":28754252,"url":"https://github.com/zeroasterisk/slidepay-nodejs-sdk","last_synced_at":"2025-06-17T01:08:14.110Z","repository":{"id":10989822,"uuid":"13310327","full_name":"zeroasterisk/slidepay-nodejs-sdk","owner":"zeroasterisk","description":"SlidePay Node.js SDK","archived":false,"fork":false,"pushed_at":"2013-09-26T05:27:42.000Z","size":291,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2023-03-11T05:08:22.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/zeroasterisk.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":"2013-10-03T21:28:25.000Z","updated_at":"2014-08-19T21:59:27.000Z","dependencies_parsed_at":"2022-09-01T22:40:30.550Z","dependency_job_id":null,"html_url":"https://github.com/zeroasterisk/slidepay-nodejs-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/zeroasterisk/slidepay-nodejs-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2Fslidepay-nodejs-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2Fslidepay-nodejs-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2Fslidepay-nodejs-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2Fslidepay-nodejs-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroasterisk","download_url":"https://codeload.github.com/zeroasterisk/slidepay-nodejs-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2Fslidepay-nodejs-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260269462,"owners_count":22983647,"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":"2025-06-17T01:08:11.807Z","updated_at":"2025-06-17T01:08:14.100Z","avatar_url":"https://github.com/zeroasterisk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"SlidePay Node.js SDK\n====================\n\nHelper package for working with the [SlidePay](http://slidepay.com) REST API.\n\n## Installation\n\nThis package will be published on npm once backward compatibility can be guaranteed. For now, you can install via git by running ```npm install git://github.com/slidepay/slidepay-nodejs-sdk.git```.\n\n----------------------------\n\n## Usage\n\n### Authentication\n\nYou can either create a new instance of the SlidePay REST client either while requiring it or in a separate step:\n\nWhen requiring:\n```javascript\nRestClient = require('node-slidepay')(credentials);\n```\n\nAfterward:\n```javascript\nslidepay = require('node-slidepay');\nRestClient = new slidepay.RestClient(credentials);\n```\n\nA separate client instance should be used for each user/session (token or API key), so you'll want to use the latter method if you're processing payments for multiple users. The REST client expects a `credentials` object to be passed in and will throw an error if one isn't passed. This object must contain at least one of the following:\n\n* Both an `email` and `password` corresponding to a SlidePay user account\n* A SlidePay `token`\n* A SlidePay `apiKey`\n\nThe library will always attempt to use the `apiKey` if defined, falling back to the `token`. In order to get a valid token, use the `login` method:\n\n```javascript\nRestClient.login().then(function() {\n\t// when the promise fulfills,\n\t// you are successfully logged in and can submit requests\n});\n```\n\nThe login method will store your token for use in requests and set the proper endpoint. You can always set `RestClient.auth.token`, `RestClient.auth.apiKey`, and `RestClient.endpoint` manually at any time.\n\n### Making Requests\n\nThis package is heavily promise-based ([Q](https://github.com/kriskowal/q)). Creating a new [simple payment](https://getcube.atlassian.net/wiki/display/CDP/Processing+a+Simple+Payment) would be done as follows:\n```javascript\nRestClient.payment.create(simplePaymentObject).then(function(payment) {\n\t// payment is the data property of the SlidePay response body\n}, function(err) {\n\t// if an error occurs at any point,\n\t// this function will be invoked with a Node error object\n});\n```\n\nIf you'd rather not use promises in your own implementation, you can pass Node-style callbacks and the library will call your callbacks when the resource promises resolve. Using the previous example:\n\n```javascript\nRestClient.payment.create(simplePaymentObject, function(err, payment) {\n\tif (err) {\n\t\t// an error ocurred and should be handled here.\n\t\t// payment will be null.\n\t}\n\telse {\n\t\t// no error\n\t\t// payment will be the SlidePay response body's data property\n\t}\n});\n```\nThe login method in callback style would be written as:\n\n```javascript\nRestClient.login(function(err) {\n\tif (err) {\n\t\t// there was a problem with login\n\t}\n\telse {\n\t\t// login occurred successfully and you can now make requests\n\t}\n});\n```\n\nGeneric requests can be made using the `RestClient.request` method which manages requests using the [request](https://github.com/mikeal/request) library and passes its options argument through. Use relative URLs in the `options.url` property. Your URL should have a leading slash and consist of everything you'd normally put after */rest.svc/API*.\n\n### Resources\n\nThis package manages most of SlidePay's resources and methods. You don't need to use the actual HTTP endpoints. Resourced are properties of the RestClient.\n\nSupported resources and methods are listed here:\n\n* **api_key**: `create` `list` *`read` `delete`*\n* **authorization**: `create` `void` *`capture.auto` `capture.manual`*\n* **bank_account**: `create` *`read` `delete`*\n* **merchant**: `createAccount` `boarding.createApplication` `boarding.submitAnswers`\n* **payment**: `create` `store` `search` *`read` `refund`*\n* **settlement**: `create` `balance` `search` *`read`*\n\nNote that resource methods that are italicized are \"instance\" methods, whereas the rest are \"class\" methods. Methods with included dots have a root object—merchant, for example, has a boarding property with `createApplication` and `submitAnswers` methods. For a payment:\n\n```javascript\n// Use a class method to create the object\nRestClient.payment.create(simplePaymentObject).then(function(payment) {\n\t// payment.id =\u003e 123\n});\n\n// Use an instance method to read the object\nRestClient.payment.read('123').then(function(payment) {\n\t// the same payment object returned by payment.create\n\t// will be retrieved\n});\n```\n\n## Testing\n\nTests expect a `credentials.json` file in the project's root directory with a valid username and password.\n\nThat file should be provided in a format similar to the following:\n\n```json\n{\n\t\"email\": \"slidepay_account@example.com\",\n\t\"password\": \"SECRET_SLIDEPAY_PASSWORD\",\n\t\"apiKey\": \"IMPORTANT_SUPER_SECRET_SLIDEPAY_KEY_THAT_YOU_NEVER_SHARE\" // Optional\n}\n```\n\nRun the mocha tests from the command line with:\n\n```bash\n$ npm test\n```\n\n## Contributing\n\nPlease file an issue for any feature requests, questions, or bugs. If you'd like to contribute a new feature or fill gaps in the resources, fork the repository and issue a pull request. If you're adding new functionality, make sure to write appropriate tests.\n\n## License\n\nThe MIT License\n\n\u0026copy; 2013 Ben Drucker and SlidePay\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroasterisk%2Fslidepay-nodejs-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroasterisk%2Fslidepay-nodejs-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroasterisk%2Fslidepay-nodejs-sdk/lists"}