Venmo payment iOS integration issue

1.4k views Asked by At

I want to integrate venmo library for payment into an iOS app.

I created a demo of it by following venmo github project.

As per the description on github project below is the code to display venmo app/open venmo in browser:

- (IBAction)payButtonPressed:(UIButton *)sender
{
    // App crashes here. Does not crash if I comment this line.
    venmoClient = [VenmoClient clientWithAppId:AppId secret:AppSecret];

    VenmoTransaction *venmoTransaction = [[VenmoTransaction alloc] init];
    venmoTransaction.type = VenmoTransactionTypePay;
    venmoTransaction.amount = [NSDecimalNumber decimalNumberWithString:@"5"];
    venmoTransaction.note = @"Payment for something";
    venmoTransaction.toUserHandle = @"Name";

    VenmoViewController *venmoViewController = [venmoClient viewControllerWithTransaction:
                                                venmoTransaction];
    if (venmoViewController) {
        [self presentViewController:venmoViewController animated:YES completion:nil];
    }
}

When I run the project it crashes on first line of the method. If I comment it out then its not crashing.

Below is the error message it throws :

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSBundle name]: unrecognized selector sent to instance 0x17556e00'

Has anyone used venmo?

Update : I downloaded project from venmo-ios-sdk. Opened sample project and tried to run. But it does not even compile.

enter image description here

Also then I tried to create a new demo by adding venmo ios sdk. As per the gihub readme file, I have to add

pod 'venmo-ios-sdk', :git => 'https://github.com/venmo/venmo-ios-sdk'

to Podfile. But it throws error :

[!] The name of the given podspec Venmo-iOS-SDK doesn't match the expected one venmo-ios-sdk

Then I tried adding

pod 'Venmo-iOS-SDK', :git => 'https://github.com/venmo/venmo-ios-sdk'

and it allowed to install.

Now, as per the tutorial there are 2 ways to send payment.

  1. Switching to the Venmo app : Trying this throws error Transaction failed with error: The current session is not open.
  2. Using the Venmo API : This throws Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Venmo handleOpenURL:]: unrecognized selector sent to instance 0x8e8a410'. This is clear because there is no such method implemented in Venmo.m file. But it is declared in Venmo.h file.
2

There are 2 answers

3
benzguo On

iOS engineer at Venmo here – we're actually in the process of releasing the new Venmo iOS SDK, which you can start using now!

pod 'Venmo-iOS-SDK', :git => 'https://github.com/venmo/venmo-ios-sdk'

My apologies for the confusion. We'll mark the framework you're using as deprecated right away and point people to the new SDK.

If you have any trouble integrating the new sdk, please submit an issue!

Update

Sorry for all the integration issues you've been having! We're still in the process of polishing our documentation before we officially release, and your feedback has been extremely helpful. You should charge me on Venmo!

I've updated the docs with the correct Podfile line, and handleOpenURL: is no longer missing from Venmo.m. I've also updated the README to clarify how to use different transaction methods. Hopefully going through the tutorial is a better experience now – sorry you ended up as our guinea pig!

  • To send a payment using the Venmo app, you'll need to run your app on a device with the Venmo app installed.
  • To send a payment using the Venmo API, you'll need to first request permissions from the user.

Let us know if you have any more issues with the SDK!

0
dtcapp On

Probably a bit late to the party here but I noticed in :

venmoTransaction.amount = [NSDecimalNumber decimalNumberWithString:@"5"];

I know if you take a look @ the docs they need to be of type float.

I get the point of using the Decimal, but try casting it to a float or using something like:

NSDecimalNumber *someDecimalNumber = [NSDecimalNumber decimalNumberWithString:@"5"]
//then in the venmo piece 
venmoTransaction.amount = [self.someDecimalNumber floatvalue];

Let me know if that helps