All Projects → onready → vtex-node-sdk

onready / vtex-node-sdk

Licence: MIT license
VTEX Node SDK, built 100% with Typescript and 0 dependencies!

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vtex-node-sdk

vtex-cms-sauce
VTEX package for handling CMS requests.
Stars: ✭ 25 (-13.79%)
Mutual labels:  vtex
vtex
Scripts de integração com a VTEX.
Stars: ✭ 24 (-17.24%)
Mutual labels:  vtex

VTEX Logo Node Logo

VTEX NODE SDK

npm version node-js-ci downloads license

  • 🔨 Built 100% with Typescript.
  • 💪 0 dependencies. It uses the native https Node module.
  • 🎉 Promise based.
  • 💫 Type definitions for many VTEX requests and responses.

Note: This is not a VTEX official package, we are VTEX Partners since 2017 and we developed this to collaborate with VTEX Community.

Requirements

  • Node version >= 8

Installation

npm install @onreadydesa/vtex-node-sdk --save

or

yarn add @onreadydesa/vtex-node-sdk

Basic usage example

First, import the SDK:

const { VTEX } = require('@onreadydesa/vtex-node-sdk');
Using ES6 imports
import { VTEX } from '@onreadydesa/vtex-node-sdk';

Then, use the SDK like this:

const vtex = new Vtex('store name', 'app key', 'app token');

// Get order by id
vtex.oms.orders.getOrder('orderId')
  .then((response) => {
    console.log(response.status); // 200
    console.log(response.body); // { orderId: 'orderId', ... }
  })
  .catch((error) => {
    console.log(error.status);
    console.log(error.body);
  })
Using async/await
try {
  const response = await vtex.oms.orders.getOrder('orderId');
  console.log(response);
} catch (error) {
  console.log(error);
}

VTEX Environments

By default, the SDK makes all requests to vtexcommercestable environment. If you want to use another environment (For example, vtexcommercebeta), you can pass an extra argument like this:

const { VTEX } = require('@onreadydesa/vtex-node-sdk')

const vtex = new Vtex('store name', 'app key', 'app token', 'beta');

Current implemented APIS

The final goal is to implement all VTEX Rest Apis. Feel free to contribute.

API Implemented
OMS
Logistics
Pricing
Master Data (V2) (*) Attachments API pending
Catalog
Search
Payments Gateway
Suggestions
VTEX DO
CMS
Session Manager
License Manager
Customer Credit
Subscriptions (V2)
Rates and Benefits
Checkout
Giftcard Hub
Antifraud Provider
Giftcard
Giftcard Provider Protocol
Payment Provider Protocol
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].