Make and accept payments in your iOS app via Venmo

Overview

Venmo iOS SDK

Build Status

The Venmo iOS SDK lets you make and accept payments in your app using Venmo.

Installation

If you're using CocoaPods:

  1. If you don't have a Podfile, run pod init
  2. Add the following line to your Podfile:
pod 'Venmo-iOS-SDK', '~>1.3'

Make sure you run pod install to install all of your dependencies, and open your .xcworkspace file, not your .xcodeproj files!

If you don't use CocoaPods:

Clone this repository and add it to your project (this is a multi-step process, but it is possible). We recommend working with CocoaPods for now.

Usage

Using the Venmo iOS SDK is as easy as Venmo-ing a friend!

1. Create your app on Venmo

  1. Create a new application on the Venmo developer site.
  2. Make a note of your new app's app id and app secret.

2. Configure your Xcode project

  1. In your app target's Info section, scroll down to URL Types.

  2. Add a new URL Type with the following properties:

    Identifier: venmo<<YOUR_APP_ID>>

    URL Schemes: venmo<<YOUR_APP_ID>>

For example, if your app ID is 1234, put venmo1234.

Set URL Types

Note: If you are using the Parse SDK, and have issues, this gist should help you.

  1. You will need to update your application's plist to handle the changes to canOpenURL described in https://developer.apple.com/videos/wwdc/2015/?id=703

If you're recompiling with iOS SDK 9.0, add the following to your application's plist

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>venmo</string>
</array>

3. Initialize the Venmo iOS SDK

Add the Venmo SDK header file to your app delegate. Import this header in any of your implementation files to use the SDK.

#import <Venmo-iOS-SDK/Venmo.h>

Add the following code to initialize the SDK in your app delegate's application:didFinishLaunchingWithOptions: method.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [Venmo startWithAppId:@"VENMO_APP_ID" secret:@"VENMO_APP_SECRET" name:@"VENMO_APP_NAME"];

    return YES;
}
  • VENMO_APP_ID: ID from your registered app on the Venmo developer site
  • VENMO_APP_SECRET: Secret from your registered app on the Venmo developer site
  • VENMO_APP_NAME: The app name that will show up in the Venmo app (e.g. "sent via My Supercool App")

To allow the Venmo iOS SDK to handle responses from the Venmo app, add the following to your app delegate's application:openURL:sourceApplication:annotation: method:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    if ([[Venmo sharedInstance] handleOpenURL:url]) {
        return YES;
    }
    // You can add your app-specific url handling code here if needed
    return NO;
}

4. Choose a transaction method

The Venmo iOS SDK lets you send a payment in two ways:

  1. Switching to the Venmo app

    • [[Venmo sharedInstance] setDefaultTransactionMethod:VENTransactionMethodAppSwitch];
    • This transaction method will switch the user to a pre-filled payment screen in the Venmo app. After the user sends or cancels the payment, they'll be switched back to your app.
    • If the user doesn't have the Venmo app installed, the payment will fail with an appropriate error.
    • N.B. You should run your app on a device with the Venmo app installed to test switching to the Venmo app.
  2. Using the Venmo API

    • [[Venmo sharedInstance] setDefaultTransactionMethod:VENTransactionMethodAPI];
    • This transaction method won't switch the user to Venmo to make the payment, but will prompt the user to give your app access to their Venmo account. If you want to use this transaction method, you will need to request permissions from the user before attempting to send a transaction.

If the user doesn't have the Venmo app installed, we recommend sending transactions via the Venmo API.

if (![Venmo isVenmoAppInstalled]) {
    [[Venmo sharedInstance] setDefaultTransactionMethod:VENTransactionMethodAPI];
}
else {
    [[Venmo sharedInstance] setDefaultTransactionMethod:VENTransactionMethodAppSwitch];
}

5. Request permissions

You can request access to a user's Venmo account using requestPermissions:withCompletionHandler:. Permissions can be specified with these scopes. If the user has the Venmo app installed, requestPermissions:withCompletionHandler will switch the user to an authorization page in the Venmo app. Otherwise, the user will be directed to an authorization page in Safari. After granting or denying permissions, the user will be redirected back to your app.

[[Venmo sharedInstance] requestPermissions:@[VENPermissionMakePayments,
                                             VENPermissionAccessProfile]
                     withCompletionHandler:^(BOOL success, NSError *error) {
    if (success) {
        // :)
    }
    else {
        // :(
    }
}];

6. Send a payment

After setting the desired transaction method and requesting permissions (if you want to use the Venmo API), you can send payments using sendPaymentTo:amount:note:completionHandler:. To send a payment request (a.k.a. charge), use sendRequestTo:amount:note:completionHandler:.

[[Venmo sharedInstance] sendPaymentTo:self.toTextField.text
                               amount:self.amountTextField.text.floatValue*100 // this is in cents!
                                 note:self.noteTextField.text
                    completionHandler:^(VENTransaction *transaction, BOOL success, NSError *error) {
    if (success) {
        NSLog(@"Transaction succeeded!");
    }
    else {
        NSLog(@"Transaction failed with error: %@", [error localizedDescription]);
    }
}];

Sample Application

Included in the sample directory is a sample application, MiniVenmo, which demonstrates how to log in with Venmo and send payments using the Venmo iOS SDK.

Contributing

We'd love to see your ideas for improving this library! The best way to contribute is by submitting a pull request – we'll do our best to respond to your patch as soon as possible. You can also submit an issue if you find bugs or have any questions. :octocat:

Please make sure to follow our general coding style and add test coverage for new features!

Comments
  • Method signatures for sending a transaction

    Method signatures for sending a transaction

    I'm thinking:

    1. Set defaults
    [[Venmo sharedInstance] setTransactionMethod:VENTransactionMethodAppSwitch];
    [[Venmo sharedInstance] setTransactionAudience:VENTransactionAudienceFriends];
    
    2. Send a payment or a request
    - (void)sendPaymentTo:(NSString *)recipientHandle
                   amount:(NSUInteger)amount
                     note:(NSString *)note
        completionHandler:(VENTransactionCompletionHandler)handler;
    
    - (void)sendRequestTo:(NSString *)recipientHandle
                   amount:(NSUInteger)amount
                     note:(NSString *)note
        completionHandler:(VENTransactionCompletionHandler)handler;
    

    Thoughts?

    question 
    opened by benzguo 14
  • iOS SDK malfunction/ request feature unavailable?

    iOS SDK malfunction/ request feature unavailable?

    Here is code for a payment through my app, the console says "Transaction successful" but I don't see that reflected ANYWHERE on my venmo account. What is going on?

    Venmo.sharedInstance().sendPaymentTo("15555555555", amount: 1, note: "Test", audience: VENTransactionAudience.Private) {
                        (transaction: VENTransaction!, success: Bool!, error:NSError!) -> Void in
                        if (success != nil) {
                            println("Transaction went through!")
                        } else {
                            println("Transaction failed")
                        }
                    }
    

    Secondly, I want to REQUEST money in my function not PAY. Is this not supported?

    opened by sudov 13
  • sendPaymentTo() Swift

    sendPaymentTo() Swift "Extra Argument 'audience' in call

    I keep getting a compile Error in Xcode: Extra Argument 'Audience' in call when I try to call my sendPaymentTo() method. Below is the code I have written

    var audienceType = VENTransactionAudience.Private
    Venmo.sharedInstance().sendPaymentTo(self.name?.text, amount: self.amount?.text.toInt(), note: self.note?.text, audience: audienceType, completionHandler: { (transaction,success,error) -> Void in
                if success {
                    println("success")
                }
                else
                {
                    prinln("Error")
                }
    
    })
    

    I have tried deleting Audience as a field and it says that I am lacking an argument 'audience' when I do so. I have also tried passing in nil and "private" as parameters for this argument.

    Has anyone else experienced the same problem or recognize my mistake?

    opened by sanjams2 8
  • Cannot request permissions to integrate venmo

    Cannot request permissions to integrate venmo

    So I have the following code in my view controller (SWIFT)

    Venmo.sharedInstance().requestPermissions([VENPermissionMakePayments,VENPermissionAccessProfile], withCompletionHandler: { (Bool success, NSError error) -> Void in if (success) { println(":)") } else { println(":(") } })

    This results in an 3 errors as below:

    1. "_VENPermissionAccessProfile", referenced from: _TFC8SplitPea24VenmoLoginViewController11viewDidLoadfS0_FT_T in VenmoLoginViewController.o

    2. "_VENPermissionMakePayments", referenced from: _TFC8SplitPea24VenmoLoginViewController11viewDidLoadfS0_FT_T in VenmoLoginViewController.o

    3. clang: error: linker command failed with exit code 1 (use -v to see invocation)

    How does one interpret these? The code only shows errors when i try to run (auto-compile is on in my xcode) and shows no errors when the snippet provided above is commented out. This view controller is connected to a blank view controller in the storyboard if that information helps.

    opened by sudov 7
  • api switch does not enter user email correctly

    api switch does not enter user email correctly

    In the App switch method, the prefilled user information does not display the user email correctly. For example. Send recipient to: [email protected], the Venmo app displays test%40test.com.

    opened by Dinhh1 7
  • Installation without cocoapods

    Installation without cocoapods

    I'm trying to add the venmo-ios-sdk to my project without using cocoapods. I've added the repo as a submodule and tried dragging in the xcodeproj, the entire folder, doing pod install and then dragging in the entire folder, the xcworkspace to no avail.

    No matter what I try, I cannot import the venmo-ios-sdk ("Venmo-iOS-SDK/Venmo.h file not found").

    The README is pretty sparse on how to include the venmo sdk without using cocoapods. Can someone direct me on how to add the venmo library to my project without using Cocoapods?

    opened by AndrewSB 5
  • Clarify how to run with CocoaPods, change formatting in part 2

    Clarify how to run with CocoaPods, change formatting in part 2

    After working at BattleHack, we had quite a few questions about how to actually start using CocoaPods, which led to this.

    Plus I just wanted to make section 2's formatting prettier, and section 3's section more active-voice.

    Review: @ayanonagon @diogeneshamilton

    opened by cassidoo 5
  • Minivenmo build issue

    Minivenmo build issue

    When I run "pod install" in the "sample" directory, I get the following error message:

    [!] Unable to satisfy the following requirements:

    • Venmo-iOS-SDK (from..) required by Podfile
    • Venmo-iOS-SDK (= 1.1.0) required by Podfile.lock

    Please help, thanks.

    opened by jhu247 4
  • Is this SDK still being supported?

    Is this SDK still being supported?

    I see that the latest version of the SDK is dated to over a year ago.

    Having issues integrating the SDK into our XCode 7 project with cocoapods 0.38.2 (a slew of linker errors as seen in this issue https://github.com/venmo/venmo-ios-sdk/issues/89)

    Are there any plans for an update?

    opened by adomanico 3
  • I spent more than a week, yet it still saying my account is not verified.

    I spent more than a week, yet it still saying my account is not verified.

    I asked two of my friends, and myself, we've already finished 100% of the checklist. However, it still saying our accounts are not verified, which we can't apply for Venmo's API at all! Cannot get in touch with anyone.

    opened by yumikohey 3
  • Venmo app crashes with VENTransactionMethodAppSwitch

    Venmo app crashes with VENTransactionMethodAppSwitch

    Running this code

    Venmo *venmo = [Venmo sharedInstance];
    venmo.defaultTransactionMethod = VENTransactionMethodAppSwitch;
    [venmo sendRequestTo:@"(415) 555-1234" amount:0 note:@"" audience:VENTransactionAudienceUserDefault completionHandler:nil];
    

    which translates to opening this URL

    venmosdk://venmo.com/?client=ios&app_name=Workflow&app_id=1809&device_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&amount=&txn=charge&recipients=(415)%20555-1234&note=&app_version=1.0.0
    

    causes the Venmo app to crash (report) with the following syslog:

    Venmo[11407] <Error>: -[NSNull floatValue]: unrecognized selector sent to instance 0x19321a6e0
    Venmo[11407] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull floatValue]: unrecognized selector sent to instance 0x19321a6e0'
        *** First throw call stack:
        (0x181e59e48 0x1925980e4 0x181e60f14 0x181e5dcc4 0x181d62c1c 0x1000ebf40 0x1000e8f0c 0x10006fc64 0x18689754c 0x186891524 0x1868939b0 0x186892048 0x18a0b5640 0x181e12124 0x181e1122c 0x181e0f850 0x181d3d1f4 0x18667378c 0x18666e784 0x10006cb9c 0x192c06a08)
    
    opened by conradev 3
  • 'Venmo-iOS-SDK/Venmo.h' file not found

    'Venmo-iOS-SDK/Venmo.h' file not found

    Pod 1.5.3 Xcode 10.1 I run pod file from pod 'Venmo-iOS-SDK', :git => 'https://github.com/venmo/venmo-ios-sdk.git', :branch => 'master' and then import in header file: #import <Venmo-iOS-SDK/Venmo.h>

    opened by ngduykhanh1707 1
  •  not receiving access code for login

    not receiving access code for login

    I've been working with my SO to log back into her venmo account. She restored her iPhone, reinstalled venmo, and reset her password. Upon logging in it she is prompted to enter an access code that is sent to her email (only email is available). She never recieves an access code at her email. Tried for a few hours today and a few yesterday.

    opened by kevingentile 0
  • Not able to build the sample

    Not able to build the sample

    After downloading project from git link https://github.com/venmo/venmo-ios-sdk. try to build but getting duplicate symbol error. Please revert back ASAP. screen shot 2017-05-16 at 7 00 01 pm

    opened by vikramsinghrajpoot 1
  • modify requestPermissions method to open SFSafariViewController

    modify requestPermissions method to open SFSafariViewController

    Pull request title: modify requestPermissions method to open SFSafariViewController to comply with AppStore requirements

    Comment: Apple testers rejected an app that uses Venmo API, because authorization request session currently opens in Safari browser. Apple testers think that it is a bad user experience and required to implement it using SFSafariViewController instead, so a user doesn't have to leave an app to authorize access to their Venmo account.

    opened by ayunav 0
Releases(v1.2.0)
Owner
Venmo
Venmo
Easily integrate Credit Card payments module in iOS App. Swift 4.0

MFCard Buy me a coffee MFCard is an awesome looking Credit Card input & validation control. Written in Swift 3. YOoo, Now MFCard is on Swift 5. Swift

MobileFirst 359 Jul 6, 2022
Square In-App Payments iOS SDK SwiftUI

Square In-App Payments iOS SDK SwiftUI Build remarkable payments experiences in

Ashley Bailey 2 Mar 8, 2022
OnTime - OnTime App is for Scheduling your day and prioritizing your task and also for saving notes

OnTime OnTime App is for Scheduling your day and prioritizing your task and also

Mohammed Sulaiman 1 Jan 29, 2022
Implement donate to Ukraine inside your app, with Apple Pay

DonateToUkraine gives you a simple way to provide "donate to Ukraine" functionality in your app via an official donation service (endorsed here). The service will be opened inside the app, keeping a native feel. Apple Pay is supported.

Oleg Dreyman 22 Aug 2, 2022
Card Decks is a small utility application for your iPhone, iPod touch and iPad which brings you simple, configurable, colored, multi-line text cards that are grouped into card decks

Card Decks is a small utility application for your iPhone, iPod touch and iPad which brings you simple, configurable, colored, multi-line text cards that are grouped into card decks.

Arne Harren 39 Jul 1, 2022
In-app purchases and subscriptions made easy. Support for iOS, iPadOS, watchOS, and Mac.

In-app purchases and subscriptions made easy. Support for iOS, iPadOS, watchOS, and Mac.

RevenueCat 1.4k Sep 23, 2022
iOS SDK for cross-platform in-app purchase and subscription infrastructure, revenue analytics, engagement automation, and integrations

Qonversion is the data platform to power in-app subscription revenue growth. fast in-app subscriptions implementation back-end infrastructure to valid

Qonversion 243 Sep 15, 2022
A framework to add patronage to your apps.

PatronKit A framework for add a patronage area to your apps. PatronKit uses CloudKit to record purchases, and then display tallies back to the user. I

Moshe 364 Sep 9, 2022
Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+ ⛺

SwiftyStoreKit is a lightweight In App Purchases framework for iOS, tvOS, watchOS, macOS, and Mac Catalyst. Features Super easy-to-use block-based API

Andrea Bizzotto 6.1k Sep 22, 2022
TPInAppReceipt is a lightweight, pure-Swift library for reading and validating Apple In App Purchase Receipt locally.

TPInAppReceipt is a lightweight, pure-Swift library for reading and validating Apple In App Purchase Receipt locally. Features Read all

Pavel T 492 Sep 20, 2022
In App Purchase Manager framework for iOS

InAppFramework In App Purchase Manager framework for iOS Disclaimer I know it's been too long since the last update, quite a few things happened in my

Sándor Gyulai 40 May 23, 2020
A lightweight iOS library for In-App Purchases

#RMStore A lightweight iOS library for In-App Purchases. RMStore adds blocks and notifications to StoreKit, plus receipt verification, content downloa

Robot Media 2.4k Sep 12, 2022
A modern In-App Purchases management framework for iOS.

MerchantKit A modern In-App Purchases management framework for iOS developers. MerchantKit dramatically simplifies the work indie developers have to d

Benjamin Mayo 1.1k Sep 27, 2022
SwiftUI BusinessCard - Created iOS Business card app to practice SwiftUI

SwiftUI_BusinessCard Created iOS Business card app to practice SwiftUI

null 0 Jan 29, 2022
Handle in-app purchases in iOS in a convenient way

InAppPurchases Handle in-app purchases in iOS in a convenient way. Overview InAppPurchases covers all the basic aspects of in-app purchases in swift i

Umar Awais 5 Jul 18, 2022
A jailed in-app purchase cracker for iOS 12.2-15.6

Satella Jailed For, um, educational purposes only or something. Definitely don't use this to pirate in-app purchases in apps to which you don't have l

Lilly 160 Sep 20, 2022
A credit card reader and parser for iOS Using Native Vision/VisionKit

card-reader-ios A credit card reader and parser for iOS Using Native Vision/VisionKit May-14-2021.00-43-17.mp4 Instructions Hold camera up to a card a

Khalid Asad 100 Jul 24, 2022
Ios-card-transition - iOS CocoaPod to create beautiful card transitions

CSCardTransition CSCardTransition is a small library allowing you to create wond

Creastel 11 Sep 28, 2022
Ruby Gem for Rails - Easy iTunes In-App Purchase Receipt validation, including auto-renewable subscriptions

Monza is a ruby gem that makes In-App Purchase receipt and Auto-Renewable subscription validation easy. You should always validate receipts on the ser

Gabriel 156 Jun 12, 2022