Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akashanand708/pwinty-api
Pwinty API provides all api end points to communicate with latest v3.0 Pwinty API. This can be used in frontend (ReactJs, ReactNative) and backend( Node.js )
https://github.com/akashanand708/pwinty-api
javascript jquery nodejs nodejs-server pwinty pwinty-api react-native reactjs
Last synced: 3 months ago
JSON representation
Pwinty API provides all api end points to communicate with latest v3.0 Pwinty API. This can be used in frontend (ReactJs, ReactNative) and backend( Node.js )
- Host: GitHub
- URL: https://github.com/akashanand708/pwinty-api
- Owner: akashanand708
- License: mit
- Created: 2018-11-11T05:06:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-11T18:45:46.000Z (about 6 years ago)
- Last Synced: 2024-10-01T16:48:03.109Z (3 months ago)
- Topics: javascript, jquery, nodejs, nodejs-server, pwinty, pwinty-api, react-native, reactjs
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pwinty-api
[Pwinty API](http://pwinty.com/api/) provides all api end points to communicate with latest v3.0 Pwinty API. This can be used in frontend (ReactJs, ReactNative) and backend( Node.js )# Installation
`$ npm install pwinty-api`# Note
We don't need to pass **Sandbox API URL** or **Live API URL** explictly,
If server will run in **development mode** , it will use **Sandbox API URL**,
in **production mode**, it will use **Live API URL**.In **development mode** , we just need to use **Sandbox merchantId/Sandbox-Rest api key**,and
in **production mode** , we just need to use **Live merchantId/Sandbox-Rest api key**.We need to set environment variable for this.
```
In package.json
"scripts": {
"start": "NODE_ENV=development nodemon ./src/app.js --exec babel-node",
"build": "babel src -d dist",
"serve": "NODE_ENV=production node dist/app.js"
},
```# Quick Start
Initialize Pwinty with merchant_id and api_key
```
import { Pwinty } from 'pwinty-api/lib';
let pwinty = new Pwinty("merchant_id", 'api_key');
```
### Create order```
let orderParams = {
countryCode: 'GB',
recipientName: '',
address1: '',
addressTownOrCity: '',
stateOrCounty: '',
postalOrZipCode: '',
preferredShippingMethod: 'Express'
};
pwinty.createOrder(orderParams)
.then((response) => {
console.log(response.data);
})
.catch((err) => {
console.log("ERROR.....", err.response.data.statusTxt);
});
```
### Add image to order
```
let addImageParamsObject = {
sku: 'ART-PRI-HPG-20X28-PRODIGI_GB',
url: '',
copies: 3,
sizing: 'Crop'
};
pwinty.addImageToOrder(,)
.then((response) => {
console.log(response.data);
})
.catch((err) => {
console.log("ERROR.....", err.response.data.statusTxt);
});
```