{"_id":"mpower","_rev":"33-78317bbc8fda8d4be45ca59ceb229015","name":"mpower","description":"MPower Payments Node.JS Library","dist-tags":{"latest":"0.2.5"},"versions":{"0.0.0":{"name":"mpower","version":"0.0.0","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.0.0","dist":{"shasum":"1a6f8e5d3c7222eb130142e14e6902215aa78034","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.0.0.tgz","integrity":"sha512-PYLnUo+9Qfuy2WjN8eWDNtJgbtHtmEJvUiigAQXPothnQyUKZUVOJoUymlm+zBkBVgJv/w7NHjjaikU6BFv/Ow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC//v3Bz7+JVh1nzNJFpfn81ZbPoi3gfZmifVkhb6GZ9gIgEpdeDut/IUmKOUKhu741MNPwnIerahykjglukfhbrxA="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.0":{"name":"mpower","version":"0.1.0","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.1.0","dist":{"shasum":"7a1359750032a607e0d40c2253932d362e84cb6a","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.0.tgz","integrity":"sha512-NeSGYUoXQJ40K6vzpDtRZW2uY+0azIzUvNEbno1ZlRGpQdkGSOUZ5JxgjHN6Q78jeD1OIBETTFWkh9KlsqGwrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDvVN6EPsSs8duHdt2WELAvmtFz5SonB+IkEOKJu+Qi0AiBnesYDic3sBJxMnY/yXNaSCa/R9f3v472/5tmpOffr6A=="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.1":{"name":"mpower","version":"0.1.1","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.1.1","dist":{"shasum":"654b750c7b126eb8502438e32dcbfb24b98a69d9","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.1.tgz","integrity":"sha512-KS5aL0xDCUe25NIj4bOQiwSUznw5sRhq5/rkIKbrPcVHlB5CPSl+H+it5XkzO5OfnfQvKA7Lu4zjLUkQiu+WIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/widZ2fNDHRObbjLXICbVyBUfJ9jPFI2RgwtnjxeSAQIgE//xxHqW9fNzht3peIWjUJDVCdOy6BpX23vrauBNDn8="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.2":{"name":"mpower","version":"0.1.2","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.1.2","dist":{"shasum":"dd8c52c79ec1f09c4e07a6053e595a8ba82bc968","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.2.tgz","integrity":"sha512-kb3G14Dpg3y8DNdwE2g0u2dAKckp479n7D/JUNLL6buBV+E6lmUypMq+Mk+Xk9d925Dx1U8N/WJC1mHQvpN88w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB88IV/+YJx1dI/5tvseACM/75v6uRKQNrePwstQ0IyqAiAiuQLoXCbkYpiiRIP+ZkJscZF2h40daeMqt8A1jJ6Mtg=="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.3":{"name":"mpower","version":"0.1.3","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.1.3","dist":{"shasum":"20647f0e5816c11576d1af23b61b29085b82aa8d","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.3.tgz","integrity":"sha512-TQ9+q0lXF73ziCXZq8JXWUqN/wo6MpTXKH2gFZuXgB2VYfA7Re+0hPY3zQTFHJcVZzn6OfI0pWL6KULS3YOOUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFFnAdDg8/eWm+WMX1VjC0fkllUjv8tt3t1l3gN0w+nnAiEA/rHo904I9eKoFs/zKx7Xxb5x+RHzZRyyTogutLDE/18="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.4":{"name":"mpower","version":"0.1.4","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.1.4","dist":{"shasum":"ea8d0ab199f4e9e027fea4ddd7d17dcf9ba50a65","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.4.tgz","integrity":"sha512-n/kaI4E2CDxj/4U2T560Eu+hX9wDVO0FrwGbZz3s9u4EbNWWTo+tFZ8xrMXF3zc95F0DgHS/wB7slhrvkMDzSg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDLmKUEf132GIHZ8EDdjIZjyfCh72S5JmPOSuMUKZQmYAIhANAM9c4aJjYBQtpFB4JqvDoBkdgUIXoo56VOTzoWcy4l"}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.5":{"name":"mpower","version":"0.1.5","description":"MPower Payments Node Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0","lodash":"~2.2.1"},"_id":"mpower@0.1.5","dist":{"shasum":"ca94524c1511039a6b87bc0f9f2724b211ab2e5b","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.5.tgz","integrity":"sha512-jWdJoPZJN4YEh5UyfeeLEmdek08X6FYYB6UQMQFM5zqoJ164Z8ZV+FdSKRllKXfPb8X+022voSE22e8WngbYmA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEeKC0DOUFOTUKGTYig4N6e1DlAZA5ltY95QnntFqaa7AiEAlU1LtZ4JRfhztcr5CziBOBJfHVnDb9M/uJyyH42LjLY="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.1.6":{"name":"mpower","version":"0.1.6","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"request":"~2.27.0"},"_id":"mpower@0.1.6","dist":{"shasum":"f829e682c34024513b7a04d0cdb9fcfce78f6f52","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.1.6.tgz","integrity":"sha512-4OObNYEdYdMnLdlPjQQ2PbDspFTHnzzVVTrDCwx2hh1JYZgpY22l7F8MJM/FOk7pcaEqKGB3K1mht+Mfz9Z+lw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+66cIXW4E9fZ+6wlUmy0FOme9fxbu/JPnVz8m4TOQdQIgJ7jq6lGaGt+YPFTCcTlyxvw0KP8UnT/s4pN9KmynUIM="}]},"_from":".","_npmVersion":"1.3.7","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}]},"0.2.0":{"name":"mpower","version":"0.2.0","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"bluebird":"^2.1.3","request":"~2.27.0"},"gitHead":"28323c5d628f6cd1c20a7309860e88e90c4a24ab","homepage":"https://github.com/samora/mpower-node","_id":"mpower@0.2.0","_shasum":"7f9c7d82d203a449c71d649be17ffe67e591eb44","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"dist":{"shasum":"7f9c7d82d203a449c71d649be17ffe67e591eb44","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.2.0.tgz","integrity":"sha512-88p4KnGuRj2c5tUPYngmxRp7eJrF6ossHoUulJ0xPsAtvG28yH2g25PfJ7TTLfYWmc6t809HCQEt0LyG1meUZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbPLLRKNTSp5t/2Z6sW9ZerwG61jGWnr1XPt6ZFNCyDgIgcd87a6XrNWtkvB2PaKt/tpfMGMdrTY6QJpWSm7jwFO0="}]}},"0.2.1":{"name":"mpower","version":"0.2.1","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"bluebird":"^2.1.3","request":"~2.27.0"},"gitHead":"2fd5b3566103186b3b362500a41fe2e5776f7ccb","homepage":"https://github.com/samora/mpower-node","_id":"mpower@0.2.1","_shasum":"e696abfd20f82c0170a6c9676ff7da4343cdff8f","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"dist":{"shasum":"e696abfd20f82c0170a6c9676ff7da4343cdff8f","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.2.1.tgz","integrity":"sha512-ks4fnkU9Trv/Lk/j2KyQRI4b7EuEvAe1ODIpVTjjh6LBosneYpwBKVMyQBvwJlyF+Kt5Sf71xxtBG2t+9RBh5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtaugvztELEDLE5BmHPK1FVaoxTS1wxDvvLHSkyW3aiwIhAJKLbJo4tPifAcD3sk9cSUCJVF+8Y0FlMGztNZugH26e"}]}},"0.2.2":{"name":"mpower","version":"0.2.2","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"bluebird":"^2.1.3","superagent":"^0.18.1"},"gitHead":"e91b429b1ebfea53aa5aa441ea2dd56c433138ac","homepage":"https://github.com/samora/mpower-node","_id":"mpower@0.2.2","_shasum":"96b76298bd2b452f34f12972ceeccbdc7179b654","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"dist":{"shasum":"96b76298bd2b452f34f12972ceeccbdc7179b654","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.2.2.tgz","integrity":"sha512-+hIGd9p6pj/1lWWhOZCHAqqC1uzTuXfXzq+4AWPz3jirm1P1gOVMTV11duP0v1QvaVoPcl+/wEDvozADRXrFRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFs7XWXsjN1tu55NYPMPfUBxchPQxKBKRG2D7G+m44DGAiEA4u6+BIIDM7IsTdwutQI65eYnWBE96kfg3a8gOZ7kNTk="}]}},"0.2.3":{"name":"mpower","version":"0.2.3","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"bluebird":"^2.1.3","superagent":"^0.18.1"},"gitHead":"d6dac8c5ae5686fa958d3be7a10d599c958f0ce4","homepage":"https://github.com/samora/mpower-node","_id":"mpower@0.2.3","_shasum":"4b9cefb5c141bb2d4be8822d53aa4914bf2dd9b1","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"dist":{"shasum":"4b9cefb5c141bb2d4be8822d53aa4914bf2dd9b1","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.2.3.tgz","integrity":"sha512-HNw/vIInSn06T3xKOsPXM+NjQ0C/xafxuTSU6mnQ0AP6FaasB7g+qbIcKJQs5AgRte7gjOmaLh/0kkVngYXWwQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBjE2vem8eXsgt6ygoHQXU1IDAi/hpN46Zs63OGsL6GzAiEA+Vsqpdycomwu1wVFbkCHAhlFxbNoBhwGbyvX+u8EAEo="}]}},"0.2.4":{"name":"mpower","version":"0.2.4","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"bluebird":"^2.1.3","superagent":"^0.18.1"},"gitHead":"0565248bfb3829833af65f97ece79c86eaf09d9b","homepage":"https://github.com/samora/mpower-node","_id":"mpower@0.2.4","_shasum":"6438b1bae2cdf10376921107cac9331e951ef7c9","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"dist":{"shasum":"6438b1bae2cdf10376921107cac9331e951ef7c9","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.2.4.tgz","integrity":"sha512-vt48y2/0b9IqqH4Dnavv8J2/5RLKnDmr2w6lImNkVix+/DzR+ToZA8LOrffVwtJdyFW5pHh1vXoqNWYnW2j35Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC45pduV/P6DfIkiWUCJ8YXOTyNBRfVVuuVoeStxQaz7AiBE7sPpp4LaoKv4ih+g6sIbe+5YfxOdXZ96yBAonhLTZg=="}]}},"0.2.5":{"name":"mpower","version":"0.2.5","description":"MPower Payments Node.JS Library","main":"lib/index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"keywords":["mpower","mpowerpayments","payment"],"author":{"name":"Samora Dake"},"license":"MIT","bugs":{"url":"https://github.com/samora/mpower-node/issues"},"dependencies":{"bluebird":"^2.1.3","superagent":"^0.18.1"},"gitHead":"0601e4d8e74ee708129a1610baa11a3b4dd8fe4e","homepage":"https://github.com/samora/mpower-node","_id":"mpower@0.2.5","_shasum":"fc0becc633ad3f5a3701d676a30a04dd79311d0f","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"samora","email":"samoradake@gmail.com"},"maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"dist":{"shasum":"fc0becc633ad3f5a3701d676a30a04dd79311d0f","tarball":"https://registry.npmjs.org/mpower/-/mpower-0.2.5.tgz","integrity":"sha512-TmZrKClt4XcE46RIWnR6fADVND7kaPI27v4d/HJUCZUkZSesSm9SmpoUpmN/vpvz15H3XIcR2jGNP41ePArrvw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCE7//VsuFJmzdkjC0AQG8mW16SlXlQdkhRufjYX9JVngIhAPRWIL4jfPvELwtPII3v9I1hFeO3F6y7Jsla0eaj5+4J"}]}}},"readme":"# MPower\r\n\r\n[![NPM version](https://badge.fury.io/js/mpower.svg)](http://badge.fury.io/js/mpower)\r\n[![Build Status](https://travis-ci.org/samora/mpower-node.svg?branch=master)](https://travis-ci.org/samora/mpower-node)\r\n\r\nThe unofficial [Node.JS](http://nodejs.org) library for [MPower Payments (mpowerpayments.com)](http://mpowerpayments.com).\r\n\r\nBuilt on the MPower Payments HTTP API (beta).\r\n\r\n## Notice\r\n\r\n* This is documentation for the current `0.2.x` release. `0.1.x` documentation is available [here](README-0.1.x.md).\r\n* `0.2.x` introduced breaking changes incompatible with `0.1.x`.\r\n* `0.2.x` is incompatible with Node.js `0.8.x` and below.\r\n\r\n\r\n## Installation\r\n\r\n```bash\r\n$ npm install --save mpower\r\n```\r\n\r\n\r\n## API configuration\r\n\r\nSetup MPower API keys.\r\n\r\n```javascript\r\nvar setup = new mpower.Setup({\r\n  masterKey: 'dd6f2c90-f075-012f-5b69-00155d864600',\r\n  privateKey: 'test_private_oDLVlm1eNyh0IsetdhdJvcl0ygA',\r\n  publicKey: 'test_public_zzF3ywvX9DE-OSDNhUqKoaTI4wc',\r\n  token: 'ca03737cf942cf644f36',\r\n  mode: 'test' // optional. use in sandbox mode.\r\n});\r\n```\r\n\r\nIt might usually be suitable to put your API configuration in environment variables. In that case you can initialize `mpower.Setup` without passing configuration parameters. \r\nThe library will automatically detect the environment variables and use them.\r\nAuto-detected environment variables: `MP_MASTER_KEY`, `MP_PRIVATE_KEY`, `MP_PUBLIC_KEY`,  `MP_TOKEN`\r\n\r\n\r\n## Checkout Store Configuration\r\n\r\n```javascript\r\nvar store = new mpower.Store({\r\n  name: 'Awesome Store', // only name is required\r\n  tagline: 'Easy shopping',\r\n  phoneNumber: '0261234567',\r\n  postalAddress: 'P.0. Box MP555, Accra',\r\n  logoURL: 'http://www.awesomestore.com.gh/logo.png'\r\n});\r\n```\r\n\r\n## Initialize Checkout Invoice\r\n\r\n```javascript\r\nvar invoice = new mpower.CheckoutInvoice(setup, store);\r\n```\r\n\r\n## Initialize Onsite Invoice\r\n\r\n```javascript\r\nvar invoice = new mpower.OnsiteInvoice(setup, store);\r\n```\r\n\r\n## Add Invoice Items & Description\r\n\r\n```javascript\r\ninvoice.addItem('iPhone 4', 1, 500, 500); // name, quantity, unit price, total price\r\ninvoice.description = 'Apple product'\r\n```\r\n\r\n## Setting Total Amount Chargeable\r\n\r\n```javascript\r\ninvoice.totalAmount = 500;\r\n```\r\n\r\n## Redirecting to MPower Checkout\r\nAfter setting total amount and adding items to your invoice you can create a checkout and redirect the customer. It takes a callback which gets passed the updated invoice object containing the url.\r\n\r\n```javascript\r\ninvoice.create()\r\n  .then(function (){\r\n    invoice.status;\r\n    invoice.token; // invoice token\r\n    invoice.responseText;\r\n    invoice.url; // MPower redirect checkout url\r\n  })\r\n  .catch(function (e) {\r\n    console.log(e);\r\n  });\r\n```\r\n\r\n## Onsite Payment Request (OPR): Step 1 - Token request\r\nAfter setting total amount and adding items to your invoice get the MPower customer's username or phone number and start an OPR request.\r\n\r\n```javascript\r\ninvoice.create('samora')\r\n  .then(function(){\r\n    invoice.oprToken; // You need to pass the OPR Token on Step 2\r\n    invoice.token; // invoice token\r\n    invoice.responseText;\r\n  })\r\n  .catch(function (e) {\r\n    console.log(e);\r\n  });\r\n```\r\n\r\n## Onsite Payment Request (OPR): Step 2 - Charge\r\nTo successfully complete an OPR charge, you need both your OPR Token & the Confirmation code sent to the customer. After a successfull charge you can programatically access the receipt url, customer information and more.\r\n\r\n```javascript\r\ninvoice.charge('oprToken', '0000')\r\n  .then(function (){\r\n    invoice.status;\r\n    invoice.responseText;\r\n    invoice.receiptURL;\r\n    invoice.customer; // {name: 'Samora Dake', phone: '0204939902', email: 'samoradake@gmail.com'}\r\n  })\r\n  .catch(function (e) {\r\n    console.log(e);\r\n  });\r\n```\r\n\r\n## Extra API methods\r\n\r\n### Adding Tax Information\r\nYou may include tax information on on the checkout page. This information will be available on the invoice & receipt printouts and PDF downloads.\r\n\r\n```javascript\r\ninvoice.addTax('VAT (15%)', 5);\r\ninvoice.addTax('NHIL (5%)', 2);\r\n```\r\n\r\n### Adding Custom Data\r\nThere are times when you may need to add an extra load of data with the checkout information for later use. MPower allows saving of custom data on their servers which are persisted even after successful payment.\r\nNote: Custom data is not displayed anywhere on the checkout page, invoice/receipt download & printouts.\r\n\r\n```javascript\r\ninvoice.addCustomData('CartID', 32393);\r\ninvoice.addCustomData('Plan', 'JUMBO');\r\n```\r\n\r\n### Setting a Cancel URL\r\nYou can optionally set the URL where your customers will be redirected to after canceling a checkout.\r\nNote: There are two options as to how the cancel URL is set, one is to set it globally using the checkout setup information and the other is set it as per checkout invoice.\r\nSetting the cancel URL directly on the invoice instance will overwrite the global settings if already set.\r\n\r\n```javascript\r\n// Globally\r\nvar store = new mpower.Store({\r\n  name: 'Awesome Store',\r\n  cancelURL: 'http://www.awesomestore.com'\r\n});\r\n\r\n// Per Checkout\r\ninvoice.cancelURL;\r\n```\r\n\r\n### Setting a Return URL\r\nMPower does a good job of managing receipt downloads and printouts after your customer successfuly makes payment. However there may be cases where you may descide to redirect your customers to another URL after successfully making payment. Return URL guarantees this action.\r\nNote: MPower will append `?token=INVOICE_TOKEN` to your URL.\r\n\r\n```javascript\r\n// Globally\r\nvar store = new mpower.Store({\r\n  name: 'Awesome Store',\r\n  returnURL: 'http://www.awesomestore.com'\r\n});\r\n\r\n// Per Checkout\r\ninvoice.returnURL;\r\n```\r\n\r\n### Confirming a Checkout Programatically\r\nThe API allows you to check on the status of any checkout using the checkout token key. You have access to all the data including the receipt download link & customer information in cases where the checkout has been confirmed as completed.\r\n\r\n```javascript\r\nvar token = 'aodaff0023';\r\n\r\nvar invoice = new mpower.CheckoutInvoice(setup, store);\r\ninvoice.confirm(token)\r\n  .then(function (){\r\n    invoice.status; //  completed, pending, canceled or fail\r\n    invoice.responseText;\r\n    \r\n    // available if status == 'completed'\r\n    invoice.customer; // {name: 'Samora Dake', phone: '0281234567', email: 'samoradake@gmail.com'}\r\n    invoice.receiptURL; // 'https://app.mpowerpayments.com/sandbox-checkout/receipt/pdf/test_a6fef1449a.pdf'\r\n  })\r\n  .catch(function (e) {\r\n    console.log(e);\r\n  });\r\n```\r\n\r\n### DirectPay\r\nYou can pay any MPower account directly via your third party apps. This is particularly excellent for implementing your own Adaptive payment solutions on top of MPower.\r\n\r\n```javascript\r\nvar directPay = new mpower.DirectPay(setup);\r\ndirectPay.creditAccount('samora', 50)\r\n  .then(function (){\r\n    directPay.description;\r\n    directPay.responseText;\r\n    directPay.transactionID;\r\n  })\r\n  .catch(function (e) {\r\n    console.log(e);\r\n  });\r\n```\r\n\r\n\r\n## TODO\r\nAdd DirectCard functionality.\r\n\r\n## Running Tests\r\nTo run tests just setup the API configuration environment variables. An internet connection is required for some of the tests to pass.\r\n\r\n```\r\nnpm install -g mocha\r\n```\r\nThen\r\n`npm test` or `mocha`\r\n\r\n## License\r\nMIT","maintainers":[{"name":"samora","email":"samoradake@gmail.com"}],"time":{"modified":"2022-06-20T11:07:47.105Z","created":"2013-10-14T14:46:57.532Z","0.0.0":"2013-10-14T14:47:40.759Z","0.1.0":"2013-10-14T17:22:53.819Z","0.1.1":"2013-10-14T17:37:13.248Z","0.1.2":"2013-10-14T18:17:36.475Z","0.1.3":"2013-10-14T19:29:29.406Z","0.1.4":"2013-10-15T00:48:44.103Z","0.1.5":"2013-10-15T01:13:19.965Z","0.1.6":"2013-10-15T18:52:40.375Z","0.2.0":"2014-06-27T12:27:53.245Z","0.2.1":"2014-07-08T09:25:57.577Z","0.2.2":"2014-07-08T10:48:26.629Z","0.2.3":"2014-07-08T13:31:36.764Z","0.2.4":"2014-08-27T12:45:38.874Z","0.2.5":"2014-10-16T07:38:55.123Z"},"author":{"name":"Samora Dake"},"repository":{"type":"git","url":"https://github.com/samora/mpower-node.git"},"users":{"samora":true},"homepage":"https://github.com/samora/mpower-node","keywords":["mpower","mpowerpayments","payment"],"bugs":{"url":"https://github.com/samora/mpower-node/issues"},"license":"MIT","readmeFilename":"README.md"}