{"id":24739499,"url":"https://github.com/notixbit/paypal-basket","last_synced_at":"2025-10-10T08:30:45.826Z","repository":{"id":46717473,"uuid":"91455499","full_name":"notixbit/paypal-basket","owner":"notixbit","description":"A simple basket \u0026 product manager for the PayPal-node SDK","archived":true,"fork":false,"pushed_at":"2024-02-19T08:09:09.000Z","size":66,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T10:53:22.807Z","etag":null,"topics":["basket","e-commerce","nodejs","payment","paypal","paypal-rest-api","paypal-rest-sdk","products","shop"],"latest_commit_sha":null,"homepage":null,"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/notixbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2017-05-16T12:24:47.000Z","updated_at":"2025-08-24T14:51:40.000Z","dependencies_parsed_at":"2025-08-14T17:53:50.161Z","dependency_job_id":"32db9bd9-5e71-4ff3-8e87-ce31bfd35e19","html_url":"https://github.com/notixbit/paypal-basket","commit_stats":null,"previous_names":["burnett01/paypal-basket"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/notixbit/paypal-basket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notixbit%2Fpaypal-basket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notixbit%2Fpaypal-basket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notixbit%2Fpaypal-basket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notixbit%2Fpaypal-basket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notixbit","download_url":"https://codeload.github.com/notixbit/paypal-basket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notixbit%2Fpaypal-basket/sbom","scorecard":{"id":26185,"data":{"date":"2025-08-04","repo":{"name":"github.com/notixbit/paypal-basket","commit":"068874895db44d4e5e7835340cc115c23036cb6d"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T17:56:27.704Z","repository_id":46717473,"created_at":"2025-08-14T17:56:27.704Z","updated_at":"2025-08-14T17:56:27.704Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000715,"owners_count":26082837,"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-10-08T02:00:06.501Z","response_time":56,"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":["basket","e-commerce","nodejs","payment","paypal","paypal-rest-api","paypal-rest-sdk","products","shop"],"created_at":"2025-01-27T22:58:54.322Z","updated_at":"2025-10-10T08:30:45.550Z","avatar_url":"https://github.com/notixbit.png","language":"JavaScript","funding_links":["https://developer.paypal.com/"],"categories":[],"sub_categories":[],"readme":"\n# paypal-basket\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/notixbit/paypal-basket/master/LICENSE) [![Build Status](https://travis-ci.com/notixbit/paypal-basket.svg?branch=master)](https://travis-ci.com/notixbit/paypal-basket) [![npm version](https://badge.fury.io/js/%40notixbit%2Fpaypal-basket.svg)](https://badge.fury.io/js/%40notixbit%2Fpaypal-basket)\n\n\u003cimg src=\"http://i.imgur.com/qnXIWQ6.png\" align=\"right\"/\u003e\n\nA simple basket \u0026 product manager for the [PayPal-node SDK](https://github.com/paypal/PayPal-node-SDK/).\n\nThis module will assist you in managing your products and baskets, in order to craft the Paypal payment request (JSON doc).\u003cbr\u003e\nUltimatively it can also request the actual PayPal payment details for you.\n\nFeatures:\n  * Easy product \u0026 basket management\n  * ES8, ES6, ES5 support\n  * Async/Await, Promises \u0026 Callbacks\n  * Tests\n\nVariants:\n\nDue to migration of the package over the last years, it comes in 3 variants.\u003cbr /\u003e\nAll of them share the same code, version, receive all future updates, and \u003cbr/\u003e\nyou won't have to update your ``package.json``:\n\n``@notixbit/paypal-basket``\u003cbr /\u003e\n``@burnett01/paypal-basket``\u003cbr /\u003e\n``paypal-basket``\n\n---\n\n# Table of contents\n* [API Reference](#api-reference)\n  * [Basket](#basket)\n  * [Product](#product)\n* [Property Reference](#property-reference)\n* [Function Reference](#function-reference)\n  * [Creating a basket](#creating-a-basket)\n  * [Creating a product](#creating-a-product)\n  * [Adding products to a basket](#adding-products-to-a-basket)\n  * [Deleting products from a basket](#deleting-products-from-a-basket)\n  * [Empty a basket](#empty-a-basket)\n  * [Selling a basket (crafting manifest / payment request)](#selling-a-basket-crafting-manifest-payment-request)\n    * [Auto payment-request processing](#auto-payment-request-processing)\n    * [Manual payment-request processing](#manual-payment-request-processing)\n  * [Payment request-data](#payment-request-data)\n* [Examples](#examples)\n  * [Example 1 (Music Store)](#example-1-music-store)\n  * [Example 2 (Manual payment-request)](#example-2-manual-payment-request)\n* [Setup / Install](#setup-install)\n* [Unit-Tests](#unit-tests)\n  * [Make](#make-1)\n  * [NPM](#npm-1)\n* [Contributing](#contributing)\n* [License](#license)\n\n---\n\n## API Reference\n\n### Basket:\n\n```javascript\nBasket(\n    [Object {\n        label: String='',\n        urls: Object { \n            return_url: String='',\n            cancel_url: String=''\n        }\n    } options]\n) -\u003e Object {\n    /* Constants */\n    options:  Object=options,\n    products: Array=[Product, ...],\n    total:    Number=0.00,\n\n    /* Methods */\n    add:  [Product, Number=amount, (ErrorClass err) =\u003e {}] | Promise\n    del:  [Product, (ErrorClass err) =\u003e {}] | Promise\n    clear:  [(ErrorClass err) =\u003e {}] | Promise\n    sell: [Object {\n        currency: String='USD',\n        description: String='',\n        norequest: Boolean=false\n    } options, (ErrorClass err, String manifest) =\u003e {}] | Promise\n}\n```\n\n### Product:\n\n```javascript\nProduct(\n    [Object {\n        sku: String='',\n        name: String='',\n        price: Number=0.00,\n        currency: String='USD',\n    } options]\n) -\u003e Object {\n    sku:   String=sku\n    name:  String=name\n    price: Number=price\n    currency: String=currency\n}\n```\n\n---\n\n## Property reference:\n\n| Property | Description |\n| ------ | ----------- |\n| options | An object with some options (optional) |\n| label | Description of the basket (eg. Mike's basket) |\n| urls | ``return_url`` = Url to return on successfull payment\n|  |``cancel_url`` = Url to return on erronous payment |\n| products | Array of products in the basket\n| total | Current total of cash in the basket\n| currency | ISO 4217 currency code\n| description | Description of the payment\n| norequest | Whether to perform actual payment request\n| manifest | Crafted JSON document for paypal sdk\n|  |``.payment`` = Actual payment request (links, id, ..) |\n| sku | Stock Keeping Unit / short product name\n| name | Product name\n| price | Product price (float) (eg. 5.00)\n\n---\n\n## Function reference:\n\n### Creating a basket\n\n**Available options:**\n\n| |  | Required | \n| ------ | ----------- | ------ |\n| label | Description of the basket (eg. Mike's basket) | Yes |\n| urls | ``return_url`` = Url to return to, on successfull payment | Yes |\n|  |``cancel_url`` = Url to return to, on erroneous payment |\n\n```javascript\nconst demoBasket = new Basket({\n  label: 'My Demo Basket',\n  urls: {\n      return_url: 'http://return.url',\n      cancel_url: 'http://cancel.url'\n  }\n})\n```\n\n---\n\n### Creating a product\n\n**Available options:**\n\n| |  | Required | \n| ------ | ----------- | ------ |\n| sku | Stock Keeping Unit (eg. myawesomeproduct) | Yes |\n| name | Product name (eg. My Awesome Product) | Yes |\n| price | Product price (float) (eg. 5.00) | Yes |\n| currency | ISO 4217 currency code (eg. USD, EUR, GBP,...) | No |\n\n```javascript\nconst demoProduct = new Product({\n  sku: 'mydemoproduct',\n  name: 'My Demo Product',\n  price: 5.00\n})\n```\n\n---\n\n### Adding products to a basket\n\n```javascript\n/* Synchronous */\ndemoBasket.add(demoProduct)\ndemoBasket.add(demoProduct, 10)\n\n/* Async/Await */\nawait demoBasket.add(demoProduct)\nawait demoBasket.add(demoProduct, 10)\n\n/* Promise */\ndemoBasket.add(demoProduct)\n  .then(() =\u003e console.log('Product has been added!'))\n  .catch(err =\u003e console.log(err))\n\n/* Promise batch */\ndemoBasket.add(demoProduct)\n  .then(demoBasket.add(demoProduct))\n  .then(demoBasket.add(demoProduct))\n  .then(demoBasket.add(demoProduct))\n\n/* Callback */\ndemoBasket.add(demoProduct, err =\u003e {\n  if (err) { return console.log(err) }\n  console.log('Product has been added!')\n})\n```\n\n---\n\n### Deleting products from a basket\n\n```javascript\n/* Synchronous */\ndemoBasket.del(demoProduct)\n\n/* Async/Await */\nawait demoBasket.del(demoProduct)\n\n/* Promise */\ndemoBasket.del(demoProduct)\n  .then(() =\u003e console.log('Product has been removed!'))\n  .catch(err =\u003e console.log(err))\n\n/* Promise batch */\ndemoBasket.del(demoProduct)\n  .then(demoBasket.del(demoProduct))\n  .then(demoBasket.del(demoProduct))\n  .then(demoBasket.del(demoProduct))\n\n/* Callback */\ndemoBasket.del(demoProduct, err =\u003e {\n  if (err) { return console.log(err) }\n  console.log('Product has been removed!')\n})\n```\n\n---\n\n### Empty a basket\n\n```javascript\n/* Synchronous */\ndemoBasket.clear()\n\n/* Async/Await */\nawait demoBasket.clear()\n\n/* Promise */\ndemoBasket.clear()\n  .then(() =\u003e console.log('Basket has been cleared!'))\n  .catch( err =\u003e console.log(err))\n\n/* Callback */\ndemoBasket.clear(err  =\u003e {\n  if (err) { return console.log(err) }\n  console.log('Basket has been cleared!')\n})\n```\n\n---\n\n### Selling a basket (crafting manifest / payment request)\n\n**Available options:**\n\n| |  | Required | \n| ------ | ----------- | ------ |\n| currency | ISO 4217 currency code (eg. USD, EUR, GBP,...) | No |\n| description | Describe the payment (eg. Mike's payment) | No |\n| norequest | Enable/Disable payment-request processing by paypal-basket. | No |\n| | If this option is set to ``true``, paypal-basket **will not** perform the actual payment-request.\u003cbr\u003eIn addition, the ``.payment`` property of the manifest won't be available.\u003cbr\u003eIf this option is set to ``false``, paypal-basket **will** perform the actual payment-request,\u003cbr\u003eand the ``.payment`` property of the manifest will be available. |\n\n#### Auto payment-request processing:\n\n```javascript\n/* Async/Await */\nconst manifest = await demoBasket.sell({ 'currency': 'USD' })\n// Payment request has been performed and you can access\n// the data (links, timestamp, etc) by using manifest.payment\nconsole.log(\"Payment ID: \" + manifest.payment.id)\nconsole.log(\"Payment created: \" + manifest.payment.create_time)\nconsole.log(\"Payment URL: \" + manifest.payment.links[1].href)\n\n/* Promise */\ndemoBasket.sell({ 'currency': 'USD' })\n  .then(manifest =\u003e {\n    // Payment request has been performed and you can access\n    // the data (links, timestamp, etc) by using manifest.payment\n    console.log(\"Payment ID: \" + manifest.payment.id)\n    console.log(\"Payment created: \" + manifest.payment.create_time)\n    console.log(\"Payment URL: \" + manifest.payment.links[1].href)\n  })\n  .catch(err =\u003e console.log(err))\n\n/* Callback */\ndemoBasket.sell({ 'currency': 'USD' }, (err, manifest) =\u003e {\n  if (err) { return console.log(err) }\n  // Payment request has been performed and you can access\n  // the data (links, timestamp, etc) by using manifest.payment\n  console.log(\"Payment ID: \" + manifest.payment.id)\n  console.log(\"Payment created: \" + manifest.payment.create_time)\n  console.log(\"Payment URL: \" + manifest.payment.links[1].href)\n})\n```\n\n#### Manual payment-request processing:\n\n```javascript\nconst paypal = require('paypal-rest-sdk')\n\n/* Async/Await */\nconst manifest = await demoBasket.sell({ 'currency': 'USD', 'norequest': true })\n// Payment request has not been performed and you can use\n// the manifest to perform it yourself\nconst payment = await paypal.payment.create(manifest)\nconsole.log(\"Payment ID: \" + payment.id)\nconsole.log(\"Payment created: \" + payment.create_time)\nconsole.log(\"Payment URL: \" + payment.links[1].href)\n\n/* Promise */\ndemoBasket.sell({ 'currency': 'USD', 'norequest': true })\n  .then(manifest =\u003e {\n    // Payment request has not been performed and you can use\n    // the manifest to perform it yourself\n    paypal.payment.create(manifest, (errPP, payment) =\u003e {\n      if (errPP){ console.log(errPP) }\n      console.log(\"Payment ID: \" + payment.id)\n      console.log(\"Payment created: \" + payment.create_time)\n      console.log(\"Payment URL: \" + payment.links[1].href)\n    })\n  })\n  .catch(err =\u003e console.log(err))\n\n/* Callback */\ndemoBasket.sell({ currency: 'USD', 'norequest': true }, (err, manifest) =\u003e {\n  if (err) { return console.log(err) }\n  // Payment request has not been performed and you can use\n  // the manifest to perform it yourself\n  paypal.payment.create(manifest, (errPP, payment) =\u003e {\n    if (errPP) { console.log(errPP) }\n    console.log(\"Payment ID: \" + payment.id)\n    console.log(\"Payment created: \" + payment.create_time)\n    console.log(\"Payment URL: \" + payment.links[1].href)\n  })\n})\n```\n\n---\n\n### Payment request-data:\n\n\u003cimg src=\"https://i.imgur.com/g50sduz.png\" /\u003e\n\n---\n\n## Examples\n\n### Example 1 (Music Store)\nIn this example paypal-basket will craft the manifest and request the actual payment by using the internal Paypal-SDK.\n\n```javascript\nconst { Paypal, Basket, Product } = require('@notixbit/paypal-basket')\n\n/* Configure paypal sdk */\nPaypal.configure({\n  mode: 'sandbox',\n  client_id: '',\n  client_secret: ''\n})\n\n/* A JSON collection of music albums */\nconst albums = [\n  {\n    \"sku\": \"davidguettalisten\",\n    \"name\": \"David Guetta - Listen\",\n    \"price\": \"5.00\"\n  },\n  {\n    \"sku\": \"michaeljacksonworld\",\n    \"name\": \"Michael Jackson - World\",\n    \"price\": \"10.00\"\n  },\n  {\n    \"sku\": \"simplyredthrillme\",\n    \"name\": \"Simply Red - Thrill me\",\n    \"price\": \"10.00\"\n  }\n]\n\n/* \n  A collection of music products\n  to contain the actual album products\n*/\nconst products = {}\n\n/* \n  Create products from albums \n  and push to collection\n*/\nfor(const index in albums) {\n  const album = albums[index]\n  products[album.sku] = new Product(album)\n}\n\n/* \n  At this point you can access a product like:\n\n  products['michaeljacksonworld']\n  products['davidguettalisten']\n*/\n\n/* Create a basket (eg. for a customer) */\nconst sessionxyzBasket = new Basket({\n  label: 'Basket of session xyz',\n  urls: {\n    return_url: 'http://return.url',\n    cancel_url: 'http://cancel.url'\n  }\n})\n\n/* \n  Now let the customer add/del \n  some products to/from their basket.\n  Presumably via website\n*/\nsessionxyzBasket.add(products['davidguettalisten'])\nsessionxyzBasket.add(products['michaeljacksonworld'])\nsessionxyzBasket.add(products['simplyredthrillme'])\nsessionxyzBasket.del(products['davidguettalisten'])\n\n/* Print current total */\nconsole.log('Current total is: $' + sessionxyzBasket.total)\n\n/*\n  Now sell the basket (generate manifest)\n  and request actual payment details\n*/\ntry {\n  const manifest = await sessionxyzBasket.sell({ 'currency': 'USD' })\n  console.log(\"Payment Response:\")\n  console.log(manifest.payment)\n} catch (err) {\n  console.log(err)\n}\n```\n\nResult:\n\n\u003cimg src=\"https://i.imgur.com/MocqM4o.png\" /\u003e\n\u003cimg src=\"https://i.imgur.com/f8QqimE.png\" /\u003e\n\n\n### Example 2 (Manual payment-request)\n\nIn this example paypal-basket will craft the payment manifest,\nbut it won't perform the actual payment request.\n\u003cbr\u003eJust perform the request yourself.\n\nMake sure ```norequest``` is *true*.\n\n```javascript\nconst paypal = require('paypal-rest-sdk')\nconst { Basket, Product } = require('@notixbit/paypal-basket')\n\n/* Configure external paypal sdk */\npaypal.configure({\n  mode: 'sandbox',\n  client_id: '',\n  client_secret: ''\n})\n\n/* Some sample products */\nconst demoProduct1 = new Product({\n  sku: 'demoproduct1',\n  name: 'Demo Product 1',\n  price: 15.00\n})\n\nconst demoProduct2 = new Product({\n  sku: 'demoproduct2',\n  name: 'Demo Product 2',\n  price: 6.53\n})\n\n/* Create a basket (eg. for a customer) */\nconst demoBasket = new Basket({\n  label: 'Demo Basket',\n  urls: {\n    return_url: 'http://return.url',\n    cancel_url: 'http://cancel.url'\n  }\n})\n\n/* \n  Add the demo products\n*/\ndemoBasket.add(demoProduct1)\ndemoBasket.add(demoProduct2)\n\n/* Print current total */\nconsole.log('Current total is: $' + demoBasket.total)\n\n/*\n  Now sell the basket (generate manifest)\n  and perform actual payment request with external paypal sdk\n*/\ntry {\n  const manifest = await demoBasket.sell({ currency: 'USD', norequest: true })\n  const payment = await paypal.payment.create(manifest)\n  console.log(\"Payment Response:\")\n  console.log(payment)\n} catch (err) {\n  console.log(err)\n}\n```\n\n---\n\n## Setup / Install\n\nUse `npm install @notixbit/paypal-basket` \n\n```javascript\nconst { Paypal, Basket, Product } = require('@notixbit/paypal-basket')\n\n/*\n  Configure paypal SDK\n  Grab your developer details here:\n  https://developer.paypal.com/\n*/\nPaypal.configure({\n  mode: 'sandbox',\n  client_id: '',\n  client_secret: ''\n})\n\n/* Now check examples above */\n```\n\n---\n\n## Unit-Tests\n\nThe testing-framework used by this module is [Mocha](https://github.com/mochajs/mocha) with the BDD / TDD assertion library [Chai](https://github.com/chaijs/chai).\n\nVarious tests are performed to make sure this module runs as smoothly as possible.\n\n* test/test.default.js `Performs 6 tests` | [Source](../master/test/test.default.js)\n\nOutput using [Mocha](https://github.com/mochajs/mocha) `spec` reporter:   \n\n\u003cimg src=\"https://i.imgur.com/kYxdF5q.png\" /\u003e\n\nDefault reporter: `list`\n\n### Make\n\n```make test```\n\n### NPM\n\n```npm test```\n\n---\n\n## Contributing\n\nYou're very welcome and free to contribute. Thank you.\n\n---\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotixbit%2Fpaypal-basket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotixbit%2Fpaypal-basket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotixbit%2Fpaypal-basket/lists"}