0.0.3 • Published 2 years ago
paymentportalss v0.0.3
Paymentportal SDK for Node.js
This repo provides an npm package for interacting with Paymentportal APIs within Node.js applications.
Read the latest package docs or checkout the platform docs for API docs, guides, video tutorials, and more.
This package is written with typescript so you should be able to get valid type definitions in your editor when importing this package. Using typescript is not a requirement to use this package.
Install
With npm:
npm install paymentportalss
Usage
Example server endpoint handled by express.
For a more detailed example visit the Integrating with Paymentportal guide and its accompanying examples repository with a Node.js + express.js example .
const express = require('express')
const api = require('paymentportalss').default({
auth: { apiKey: process.env.API_KEY }
})
const app = express()
// See links above for more complete examples
app.post('/', (req, res) => {
return Promise.resolve(req.body.credentials)
.then(api.auth.sendMetrics())
.then(data => res.json({ data }).send(201))
.catch(err => res.json({ errors: ["Failed credentials"] }).send(500))
})
app.listen(process.env.PORT)
subscriptions
app.post('/', (req, res) => {
const ress = await api.auth.externalPackage(company_email, user_email)
return res.json(ress.parsedBody)
})
api metrics
app.post('/', (req, res) => {
const ress = await api.auth.sendMetrics()
return res.json(ress.parsedBody)
})