Skip to content

A modern Node.js wrapper for the Pwinty API. Typescript definitions included.

Notifications You must be signed in to change notification settings

mathieudutour/pwinty-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pwinty

A modern Node.js wrapper for the Pwinty API. Typescript definitions included.

Installation

npm install @mathieudutour/pwinty

Usage

Sign up to Pwinty and note the MerchantID and API key you received when signing up.

import Pwinty, { ShippingMethod } from '@mathieudutour/pwinty'

const pwinty = new Pwinty({
  merchantId: String, // defaults to process.env.PWINTY_MERCHANT_ID
  apiKey: String, // defaults to process.env.PWINTY_API_KEY
  baseApiEndpoint: String, // defaults to `https://api.pwinty.com/v3.0` if process.env.NODE_ENV === 'production', `https://sandbox.pwinty.com/v3.0` otherwise
})

Then access the Pwinty endpoints:

pwinty.orders
  .create({
    recipientName: '',
    addressTownOrCity: 'Lyon',
    countryCode: 'FR',
    preferredShippingMethod: ShippingMethod.Standard,
  })
  .then(order => {
    // todo
  })
  .catch(err => {
    // todo
  })

See the typescript definitions for an overview of the methods available.

License

MIT

About

A modern Node.js wrapper for the Pwinty API. Typescript definitions included.

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published