Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

venmo

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

venmo

Venmo API client for node.js

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

venmo.js

venmo.js is a Venmo library for node.js, currently supporting the Payment Links API and the Venmo Application API. Future builds will support the Reciepts API and provide convenince functions for you to recieve and unsign responses to your callback url from the Venmo servers.

Installing

To install venmo.js from npm

npm install venmo

or include it in your package.json file

"dependencies": {
    "venmo": "0.0.1"
}

The Payment Links API is a simple interface for generating urls to serve as the entry point to make a Venmo payment or charge. Using it with venmo.js is quite straightforward. First, you'll need to register your app with Venmo. Then, start creating payment links:

var Venmo = require('venmo')
  , venmo = new Venmo(client_id, client_secret)

var object = {
    user: 'Zachary-Friedman'
  , amount: 1000
};

venmo.pay(object, function (error, link) {
  if (error) {
    console.log(error);
  } else {
    console.log(link) # => https://venmo.com/Zachary-Friedman?txn=pay&amount=1000
  }
});

Application API

The Application API is a slick interface from Venmo to associate emails, phone numbers, Facebook accounts, Foursquare accounts and Twitter accounts with Venmo users. The most general interface provided by venmo.js is the top-level, batch #find() function. Your instance of the Venmo object calls the function with an object that can contain any combination of the following parameters, each of which accepts a comma-separated list of values:

ParameterExamples
emailszafriedman@gmail.com, foo@bar.com
phone_numbers1234567890, 15555555555
facebook_ids123, 456, 789
foursquare_ids123, 456, 789
twitter_screen_names_kulte, aplusk, BarackObama

So if you'd like to make a payment, but you don't know the individual's Venmo username, you can do this:

var object = {
    "twitter_screen_names": "BarackObama"
};

venmo.find(object, function (error, results) {
  if (error) { console.log(error); } else {
    console.log(results); # => [{ username: 'barackonvenmo', twitter_screen_name: 'BarackObama' }]
    var query = {
        user: _.first(results).username /* _.first is a function from the wonderful underscore.js library */
      , amount: 2000
      , note: 'for automatic tax hikes'
    };

    venmo.pay(query, function (error, url) {
      if (error) { console.log(error); } else {
        console.log(url); # => https://venmo.com/barackonvenmo?txn=pay&amount=2000&note=for+automatic+tax+hikes
        /**
        * You can do many slick things with this url. You can redirect to it in an endpoint in an Express app,
        * you can respond with it as part of a JSON API with res.json(url) or do something else entirely.
        */
      }
    });
  }
});

venmo.js also provides convenience functions for when you have just a single query to run against the Application API. Let's say you would like to pay the developer of this library for his hard work in making a beautiful abstraction over the Venmo API :) It's as easy as the following:

venmo.findByTwitter("_kulte", function (error, result) {
  var payment = {
      user: result.username
    , amount: 100
    , note: 'for being awesome'
  };

  venmo.pay(payment, function (error, link) {
    if (error) { console.log(error); } else {
      console.log(link); # => https://venmo.com/Zachary-Friedman?txn=pay&amount=100&note=for+being+awesome
    }
  });
});

The other convenience functions are:

  • findByEmail()
  • findByPhoneNumber()
  • findByFacebookId()
  • findByFoursquareId()
  • findByTwitter()

Keywords

FAQs

Package last updated on 11 Jan 2013

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