{"library":"node-bigcommerce","title":"BigCommerce API Client for Node.js","description":"node-bigcommerce is a comprehensive Node.js module designed for integrating applications with the BigCommerce API. It facilitates OAuth 2.0 authentication, handles authorization flows, verifies signed payloads for app load/uninstall events, and provides convenient helper methods for executing various API requests (GET, POST, PUT, DELETE). The current stable version is 4.1.0. While the release cadence is moderate, major versions introduce breaking changes such as the significant refactor in v3.0.0 to exclusively use Promises and the dropping of older Node.js versions. A key differentiator is its streamlined approach to BigCommerce-specific authentication mechanisms and direct support for different API versions (v2 and v3). Since v3.0.0, it leverages ES6 classes and standard Promises, moving away from callback-based patterns.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-bigcommerce"],"cli":null},"imports":["const BigCommerce = require('node-bigcommerce');","const bigCommerce = new BigCommerce({ clientId: '...', secret: '...', callback: '...' });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const express = require('express');\nconst BigCommerce = require('node-bigcommerce');\n\nconst app = express();\nconst PORT = process.env.PORT || 3000;\n\n// Basic BigCommerce configuration for authorization\nconst bigCommerce = new BigCommerce({\n  clientId: process.env.BIGCOMMERCE_CLIENT_ID ?? 'your_client_id_here',\n  secret: process.env.BIGCOMMERCE_SECRET ?? 'your_secret_here',\n  callback: process.env.BIGCOMMERCE_CALLBACK_URL ?? 'https://localhost:3000/auth',\n  responseType: 'json',\n  apiVersion: 'v3' // Specify API version, defaults to v2\n});\n\n// Example Authorization Route\napp.get('/auth', (req, res, next) => {\n  bigCommerce.authorize(req.query)\n    .then(data => {\n      console.log('Authorization successful:', data);\n      // Store access_token and context for future API calls\n      res.send(`<h1>Authorized!</h1><p>Access Token: ${data.access_token}</p>`);\n    })\n    .catch(err => {\n      console.error('Authorization failed:', err);\n      next(err);\n    });\n});\n\n// Example Load/Uninstall Verification Route\n// For load/uninstall, only secret is typically needed for verify method.\nconst bigCommerceVerify = new BigCommerce({\n  secret: process.env.BIGCOMMERCE_SECRET ?? 'your_secret_here',\n  responseType: 'json'\n});\n\napp.get('/load', (req, res, next) => {\n  try {\n    const data = bigCommerceVerify.verify(req.query['signed_payload']);\n    console.log('Signed Payload Verified:', data);\n    res.send(`<h1>Welcome!</h1><p>User: ${data.user.email}</p><p>Store: ${data.store_hash}</p>`);\n  } catch (err) {\n    console.error('Signed payload verification failed:', err);\n    next(err);\n  }\n});\n\napp.listen(PORT, () => {\n  console.log(`Server running on http://localhost:${PORT}`);\n  console.log('Set BIGCOMMERCE_CLIENT_ID, BIGCOMMERCE_SECRET, BIGCOMMERCE_CALLBACK_URL environment variables.');\n});","lang":"javascript","description":"This quickstart demonstrates how to set up `node-bigcommerce` with Express.js to handle both OAuth authorization and verify signed payloads for app load/uninstall events, showcasing key authentication flows.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}