venmo-typescript
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Venmo Typescript · npm version

Typescript/Javascript library for interacting with the Venmo API.

Examples

Payment

This example will login and request $1.00 from the users listed in USERNAMES.

- Negative amounts are payment requests.
+ Positive amounts are payments.

import { Venmo } from "venmo-typescript";

// Create a venmo client.
const v = new Venmo();
await v.easyLogin(process.env.EMAIL, process.env.PASSWORD);

const usernames = process.env.USERNAMES?.split(',') || [];
// For each recipient username
for (const username of usernames) {
  // Query user so we can get the id.
  const user = await v.userQuery(username)?.find(
    (user) => user.username.toLowerCase() === username.toLowerCase()
  );
  if (user) {
    // Request payment with the user id.
    const paymentRes = await v.pay(user.id, -1, 'Note for transaction.', 'private');
  }
}

Deal with 2FA OTP code

You can deal with 2FA by passing a callback function that returns the otp code. In this example we are using stdin to have the user manually type the code they get via SMS.

import { Venmo } from "venmo-typescript";
import readline from 'readline';

const v = new Venmo();
await v.easyLogin(process.env.EMAIL, process.env.PASSWORD, async () => {
  return await new Promise((res) => {
    readline.createInterface({
      input: process.stdin,
      output: process.stdout
    }).question('Enter OTP code:', (answer) => res(answer))
  });
});

Get My Profile

import { Venmo } from "venmo-typescript";

const v = new Venmo();
await v.easyLogin(process.env.EMAIL, process.env.PASSWORD);
console.log(await v.getUserProfile());

Manual Login

You can also manually login and manage the otp code yourself. See how easyLogin works.

Readme

Keywords

Package Sidebar

Install

npm i venmo-typescript

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

32.9 kB

Total Files

14

Last publish

Collaborators

  • austenstone