@mathieudutour/pwinty
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i @mathieudutour/pwinty

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

41.9 kB

Total Files

8

Last publish

Collaborators

  • mathieudutour