Skip to content

Latest commit

 

History

History
153 lines (92 loc) · 6.13 KB

README.md

File metadata and controls

153 lines (92 loc) · 6.13 KB

Venmo Your Friends iOS Library

This open-source Cocoa Touch Static Library allows users of your app to pay or charge with Venmo. It switches to the Venmo app if it's installed on the device. Otherwise, it opens Venmo in a web view. When the transaction is complete, it switches back to your app.

Create a Venmo Application

First, create a new Venmo Application by visiting https://venmo.com/

Login and go to: Account > Developers > New Application.

Create new application

Project Setup

NB: Follow these instructions exactly unless you know what you're doing.

Ensure you have the latest (released or beta) version of Xcode installed.

Add Venmo as a Git submodule to the Libraries directory.

This will help you pull in updates and make contributions.

cd ~/Projects/DrinksOnMe/ # sample project root directory

# Let's make a new directory called Libraries for third-party code.
git submodule add https://github.com/venmo/venmo-your-friends-ios.git Libraries/Venmo
git submodule update --init
git commit -m 'Add Libraries/Venmo Git submodule.'

Add the Libraries Directory to Your Xcode Project.

In Xcode, select your project (DrinksOnMe) at the top of the Project Navigator (⌘1), and press ⌥⌘A (File > Add Files to "DrinksOnMe"...). Select the Libraries directory (in ~/Projects/DrinksOnMe/), and confirm that "Copy items..." is unchecked, "Create groups..." is selected, and all targets are unchecked. Then, click Add. Finally, for finess, drag & drop the Libraries group before the Frameworks group.

In Terminal, review and commit your changes:

git diff -w -M --color-words HEAD
git commit -am 'Add Libraries/Venmo to Xcode project.'

Edit Your Target.

In Xcode, select your project (DrinksOnMe) at the top of the Project Navigator (⌘1), and then, select the target (DrinksOnMe) to which you want to add Venmo.

Add the Venmo URL Type

Select the "Info" tab. Add a URL Type with Identifier: Venmo, Role: Editor, and URL Schemes: venmo1234, where 1234 is your app ID.

Select the "Build Settings" tab. (Make sure "All" is selected in the top left.)

Select the "Build Phases" tab.

  • Add Venmo to the "Target Dependencies" build phase.
  • Add libVenmo.a to the "Link Binary With Libraries" build phase.

In Terminal, review and commit your changes:

git diff -w -M --color-words HEAD
git commit -am 'Edit target info, settings, and phases for Venmo.'

Using Venmo in Your App

Troubleshooting

  • #import <Venmo/Venmo.h> causes the compile-time error 'Venmo/Venmo.h' file not found.

    This means the Header Search Path build setting doesn't match the Git submodule path (in .gitmodules). Both should be Libraries/Venmo. The Project Navigator group structure is irrelevant because it can differ from the file system's directory structure, which is what really matters.

Venmo Sample Apps

Pull in remote updates by running these commands from your project root directory:

git submodule foreach 'git checkout master; git pull --rebase'
git commit -am 'Update submodules to latest commits.'

Some of us find it useful to add an alias (to ~/.gitconfig) for the first of the two commands above:

git config --global alias.sup "submodule foreach 'git checkout master; git pull --rebase'"

Then, to pull in remote updates, you can just do:

git sup
  • Commit your changes.

      cd ~/Projects/DrinksOnMe/Libraries/Venmo
      git add -A
      git commit
    
  • Fork this repo on GitHub, add your fork as a remote, and push.

      git remote add myusername [email protected]:myuser/venmo-your-friends-ios.git
      git push myusername master
    
  • Send Venmo a pull request on GitHub.