{"_id":"2checkout-node","_rev":"6-a904451cc75f224b88c005e2d919ca55","name":"2checkout-node","description":"A node.js wrapper for the 2Checkout Payment API.","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"2checkout-node","version":"0.0.1","description":"A node.js wrapper for the 2Checkout Payment API.","author":{"name":"Craig Christenson","email":"peedlecode@gmail.com"},"main":"lib/2checkout.js","repository":{"type":"git","url":"http://github.com/craigchristenson/2checkout-node.git"},"engines":{"node":">= v0.8.0"},"devDependencies":{"mocha":"~1.13.0"},"dependencies":{"request":"2.x.x"},"bugs":{"url":"https://github.com/craigchristenson/2checkout-node/issues"},"homepage":"https://github.com/craigchristenson/2checkout-node","_id":"2checkout-node@0.0.1","dist":{"shasum":"edae4c1d400887a63e8545e37fb9ab05579a6885","tarball":"https://registry.npmjs.org/2checkout-node/-/2checkout-node-0.0.1.tgz","npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhuea9CRA9TVsSAnZWagAAzFkP+weiY30S72MC1KT0JATY\npCPxzMas73DUD8z+ysKtxr1cCAqOW+WuE7HUa/pQ0CtBhxqAZiY+ERZtOG+W\ndeN3Wgo+kfTfL489lyQ2UuZiLJxw8mPNMRVuLCMjfS4BG6swkd2WDt5QWQLx\nsu0uQfOfVO4FePtomv2/NxN4K9OjlSurN6y502ZoKMtf3SNdII0EDd8wSfhy\naMESE16ynFhFKaSoyqyXw5Q3hmBaa8JTxrKc23s66oEhiKB1d6ptf/OWt1JC\nDNlEDr7viPNYrU/Egg2ZCkKvQ8K8nWxx5FVx/gApVUK5rkgJnkHvHFSuS11f\n/+GNyyRegP4Bg4WbeGQWyTrz7U3veqZk/dQau4maqpDb1U0A2cZ+pRqXqht2\n2YcYdzhCX0LsI+xWNXBWjSrRejEmS7Up9RwU00pSKsHv+mtMCSSTPCpCsU/1\noTNSAJHapa9Fefomuq429ZFhyijY/rV3xgSDHmw8cYV5M5ce+4X0A1bJ1rVo\n4anq0GsEO+61ZRPrOAYlzR9zw0gfmBa2eXwMqgyD/cQoYAq0jPLgcJwtowEO\nihtEyv5LoPWnJduKWl4+pdEA4d/I+8+VaKbkD1WqufltF89KZIWHQ1CWwzWq\nwPCobXyQj2IOg+BWX671cIR71nkRrBzZhW3ASvDlGA2hwxZvlgxuucJL33F6\nS+af\r\n=eEv5\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-FmrrrJSNHECY5cXF8Mmq0XB4PfbyU505O6oJijFlc31m5afNs1KVvZriChCDkBXT7o/WptjIj0+h107Nbif8yQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFpAXBz1Evv/hP1knMpNweuIg0xmvFi+P2o+1idGyTUFAiEAh/nj/Sck7XG9YWmQMLM5kT3hY5YrTTO+nZyQVoEDBw8="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"janfredrik","email":"janfredriksmail@gmail.com"},"maintainers":[{"name":"janfredrik","email":"janfredriksmail@gmail.com"}],"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"readme":"2Checkout Node.js Library\n=====================\n\nThis library provides developers with a simple set of bindings to the 2Checkout Payment API, Hosted Checkout, Instant Notification Service and Admin API.\n\nTo use, download or clone the repository and install with npm.\n\n```shell\ngit clone https://github.com/craigchristenson/2checkout-node.git\nnpm install 2checkout-node\n```\n\nThen you can require the module and setup the 2Checkout object with a number of options shown below.\n\n```javascript\n// Require the module\nvar Twocheckout = require('2checkout-node');\n\n// Pass in your private key and seller ID\nvar tco = new Twocheckout({\n    apiUser: \"APIuser1817037\",                              // Admin API Username, required for Admin API bindings\n    apiPass: \"APIpass1817037\",                              // Admin API Password, required for Admin API bindings\n    sellerId: \"1817037\",                                    // Seller ID, required for all non Admin API bindings \n    privateKey: \"3508079E-5383-44D4-BF69-DC619C0D9811\",     // Payment API private key, required for checkout.authorize binding\n    secretWord: \"tango\",                                    // Secret Word, required for response and notification checks\n    demo: true,                                             // Set to true if testing response with demo sales\n    sandbox: false                                          // Uses 2Checkout sandbox URL for all bindings\n});\n```\n\nExample Purchase API Usage\n-----------------\n\n*Example Request:*\n\n```javascript\n// Setup the authorization object\nvar params = {\n    \"merchantOrderId\": \"123\",\n    \"token\": \"MWQyYTI0ZmUtNjhiOS00NTIxLTgwY2MtODc3MWRlNmZjY2Jh\",\n    \"currency\": \"USD\",\n    \"total\": \"10.00\",\n    \"billingAddr\": {\n        \"name\": \"Testing Tester\",\n        \"addrLine1\": \"123 Test St\",\n        \"city\": \"Columbus\",\n        \"state\": \"Ohio\",\n        \"zipCode\": \"43123\",\n        \"country\": \"USA\",\n        \"email\": \"example@2co.com\",\n        \"phoneNumber\": \"5555555555\"\n    }\n};\n\n// Make the call using the authorization object and your callback function\ntco.checkout.authorize(params, function (error, data) {\n    if (error) {\n        console.log(error.message);\n    } else {\n        console.log(JSON.stringify(data));\n    }\n});\n```\n\n*Example Response:*\n\n```json\n{\n    \"validationErrors\": null,\n    \"response\": {\n        \"type\": \"AuthResponse\",\n        \"currencyCode\": \"USD\",\n        \"lineItems\": [\n            {\n                \"description\": \"\",\n                \"duration\": \"1 Year\",\n                \"options\": [],\n                \"price\": \"6.99\",\n                \"quantity\": \"2\",\n                \"recurrence\": \"1 Month\",\n                \"startupFee\": null,\n                \"productId\": \"123\",\n                \"tangible\": \"N\",\n                \"name\": \"Demo Item 1\",\n                \"type\": \"product\"\n            },\n            {\n                \"description\": \"\",\n                \"duration\": null,\n                \"options\": [\n                    {\n                        \"optName\": \"Size\",\n                        \"optValue\": \"Large\",\n                        \"optSurcharge\": \"1.00\"\n                    }\n                ],\n                \"price\": \"1.99\",\n                \"quantity\": \"1\",\n                \"recurrence\": null,\n                \"startupFee\": null,\n                \"productId\": \"\",\n                \"tangible\": \"N\",\n                \"name\": \"Demo Item 2\",\n                \"type\": \"product\"\n            },\n            {\n                \"description\": \"\",\n                \"duration\": null,\n                \"options\": [],\n                \"price\": \"3.00\",\n                \"quantity\": \"1\",\n                \"recurrence\": null,\n                \"startupFee\": null,\n                \"productId\": \"\",\n                \"tangible\": \"Y\",\n                \"name\": \"Shipping Fee\",\n                \"type\": \"shipping\"\n            }\n        ],\n        \"transactionId\": \"205203115673\",\n        \"billingAddr\": {\n            \"addrLine1\": \"123 Test St\",\n            \"addrLine2\": null,\n            \"city\": \"Columbus\",\n            \"zipCode\": \"43123\",\n            \"phoneNumber\": \"5555555555\",\n            \"phoneExtension\": null,\n            \"email\": \"example@2co.com\",\n            \"name\": \"Testing Tester\",\n            \"state\": \"Ohio\",\n            \"country\": \"USA\"\n        },\n        \"shippingAddr\": {\n            \"addrLine1\": \"123 Test St\",\n            \"addrLine2\": \"\",\n            \"city\": \"Columbus\",\n            \"zipCode\": \"43123\",\n            \"phoneNumber\": null,\n            \"phoneExtension\": null,\n            \"email\": null,\n            \"name\": \"Testing Tester\",\n            \"state\": \"OH\",\n            \"country\": \"USA\"\n        },\n        \"merchantOrderId\": \"123\",\n        \"orderNumber\": \"205203115664\",\n        \"recurrentInstallmentId\": null,\n        \"responseMsg\": \"Successfully authorized the provided credit card\",\n        \"responseCode\": \"APPROVED\",\n        \"total\": \"19.97\",\n        \"errors\": null\n    },\n    \"exception\": null\n}\n```\n\nExample Admin API Usage\n-----------------\n\n*Example Request:*\n\n```javascript\ntco.sales.retrieve({sale_id: 205203115664}, function (error, data) {\n    if (error) {\n        console.log(error);\n    } else {\n        console.log(data);\n    }\n});\n```\n\nExample Checkout Usage:\n-----------------------\n\n*Example Request:*\n\n```javascript\n// Setup checkout params\nvar params = {\n    mode: '2CO',\n    li_0_name: 'Test Product',\n    li_0_price: '0.01'\n};\n\n// Get a URL encoded payment link\nvar link = tco.checkout.link(params);\n```\n\n*Example Response:*\n```javascript\nhttps://www.2checkout.com/checkout/purchase?mode=2CO&li_0_name=Test%20Product&li_0_price=0.01&sid=1817037\n```\n\nExample Return Usage:\n---------------------\n\n*Example Request (Using Express):*\n\n```javascript\nif (tco.response.valid(request.body), 0.01) {\n    response.send(\"Valid\");\n} else {\n    response.send(\"Invalid\");\n}\n```\n\nExample INS Notifications Usage:\n------------------\n\n*Example Usage (Using Express):*\n\n```javascript\nif (tco.notification.valid(request.body)) {\n    response.send(\"Valid\");\n} else {\n    response.send(\"Invalid\");\n}\n```\n\nExceptions:\n-----------\nErrors are returned as the first argument to your callback if they occur. It is best to always check for these before attempting to work with the response.\n\n*Example*\n\n```javascript\ntco.checkout.authorize(params, function (error, data) {\n    if (error) {\n        console.log(error.message);\n    } else {\n        console.log(JSON.stringify(data));\n    }\n});\n```","maintainers":[{"name":"janfredrik","email":"janfredriksmail@gmail.com"}],"time":{"modified":"2022-06-12T14:06:48.577Z","created":"2014-06-12T16:37:26.767Z","0.0.1":"2014-06-12T16:37:26.767Z"},"homepage":"https://github.com/craigchristenson/2checkout-node","repository":{"type":"git","url":"http://github.com/craigchristenson/2checkout-node.git"},"author":{"name":"Craig Christenson","email":"peedlecode@gmail.com"},"bugs":{"url":"https://github.com/craigchristenson/2checkout-node/issues"},"readmeFilename":"README.md"}