@onreadydesa/vtex-node-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.16.0-beta • Public • Published

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

Package Sidebar

Install

npm i @onreadydesa/vtex-node-sdk

Weekly Downloads

3

Version

1.16.0-beta

License

MIT

Unpacked Size

513 kB

Total Files

1007

Last publish

Collaborators

  • onreadydesa