New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

woven-pay-js

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

woven-pay-js

Js SDK for the Woven Payment REST api

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by80%
Maintainers
3
Weekly downloads
 
Created
Source

WOVEN PAYMENTS JS SDK

** PLEASE NOTE THAT THIS LIBRARY IS UNDER ACTIVE DEVELOPMENT **

USAGE

Install

npm i -S woven-pay-js

SUPPORTED RESOURCES

  • Customers
  • Payments
  • Plans
  • Webhooks
  • Payments

To Be Added

  • Account Resource [GET and PUT only]
  • Business Resource [GET and PUT only]
  • Plan Resource [GET]
  • Webhook Resource [GET]
  • Subscriptions Resource
  • Payment refund
  • Payment cancel
  • Payment disburse
  • Payment disburse

Create a new Instance of wovenpay

import WovenPay from 'woven-pay-js';
let wovenpay = new WovenPay(url, apikey, apisecret);

To add Token

let token = "mytoken"
wovenpay.token = token

To add request timeout

wovenpay.timeout = 5000 //5 seconds max

To add api version

wovenpay.version = "1" //Every request will use version 1 of wovenpay api

To get Token

let response = await wovenpay.getAuthToken(merchantEmail: string, merchantPassword: string)
token = await response.json();

To refresh Token

let response = await wovenpay.refreshAuthToken(token: string)
token = await response.json();

To verify Token

let response = await wovenpay.verifyAuthToken(token: string)
is_valid = await response.json();

Customer

To Create a new customer

wovenpay.Customers.create(json payload)

let response = await wovenpay.Customers.create({email: email});
customer = await response.json();
To Edit a customer

wovenpay.Customers.edit(customer id, json payload)

let response = wovenpay.Customers.edit(customer.id, {email: email});
customer = await response.json();
To Delete a customer

wovenpay.Customers.delete(customer id)

let response = wovenpay.Customers.delete(customer.id);
customer = await response.json();
Retrieve all customers

wovenpay.Customers.all()

let response = wovenpay.Customers.all();
customers = await response.json();
Retrieve Specific customer

wovenpay.Customers.get(customer id)

let response = wovenpay.Customers.get(customer.id);
customer = await response.json();

Plan

To Create a new plan

wovenpay.Plans.create(json payload)

let response = await wovenpay.Plans.create({name:planName, business: Business, price:1000});
plan = await response.json();
To Edit a plan

wovenpay.Plans.edit(plan id, json payload)

let response = wovenpay.Plans.create({name:planName, business: Business, price:2000});
plan = await response.json();
To Delete a plan

wovenpay.Plans.delete(plan id)

let response = wovenpay.Plans.delete(plan.id);
plan = await response.json();

Payments

To Create a new Payments Charge

wovenpay.Payments.charge(json payload)

payload = {
  "method": "mobile.mpesa",
  "amount": 10,
  "mobile":phone,
  "customer": {
    "email":test
  },
  "order": {
    "description": "Payment of Dockerfest Ticket"
  },
  "reference": "myuniquereference"
}
let response = await wovenpay.Payments.charge(payload);
charge = await response.json();
Get list of Payment transactions

You should probably want to use graphql query wovenpay.Payments.transactions()

let response = wovenpay.Payments.transactions();
transactions = await response.json();
To Transaction Status

wovenpay.Payments.status(transaction id)

let response = wovenpay.Payments.status(transaction.id);
status = await response.json();

Webhook

To Create a new webhook

wovenpay.Webhooks.create(json payload)

let response = await wovenpay.Webhooks.create({event: event, target:url, key:"notsecretkey"});
hook = await response.json();
To Edit a webhook

wovenpay.Webhooks.edit(hook id, json payload)

let response = wovenpay.Webhooks.create({event:"customer.created", target: url, key:"secretkey"});
hook = await response.json();
To Delete a webhook

wovenpay.Webhooks.delete(hook id)

let response = wovenpay.Webhooks.delete(hook.id);
hook = await response.json();

GraphQl Query

Query Graph

One can use both string or template literals wovenpay.Graph.query(json payload)

let response = await wovenpay.Graph.query(`{ allBusinesses {edges{node{id name }}} }`)
let response2 = await wovenpay.Graph.query`{ allBusinesses {edges{node{id name }}} }`

FAQs

Package last updated on 24 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc