- π¨ 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.
- Node version >= 8
npm install @onreadydesa/vtex-node-sdk --save
or
yarn add @onreadydesa/vtex-node-sdk
First, import the SDK:
const { VTEX } = require('@onreadydesa/vtex-node-sdk');
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);
})
try {
const response = await vtex.oms.orders.getOrder('orderId');
console.log(response);
} catch (error) {
console.log(error);
}
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');
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 | β |