venmo / venmo-ios-sdk

Make and accept payments in your iOS app via Venmo
MIT License
178 stars 57 forks source link

Venmo API request fails with error 2 Invalid Recipient #70

Open scottrichards opened 9 years ago

scottrichards commented 9 years ago

I am using the iOS SDK and everything works fine when I use the VenMo App to make a payment. But when I try to make a payment with the VenMO API directly it fails with the following error:

error NSError * domain: @"com.venmo.VenmoSDK.ErrorDomain" - code: 2 0x7ae266e0 "Please enter a valid phone, email, username, or Venmo user ID" "Invalid recipient"

Following is how I am invoking the sendPaymentTo method:

 [[Venmo sharedInstance] sendPaymentTo:self.toTextField.text
                                       amount:self.amountTextField.text.floatValue*100
                                         note:self.noteTextField.text
                            completionHandler:handler];

I made sure that I had successfully requested permission before making this call as follows:

- (IBAction)doLogin:(id)sender {
    [[Venmo sharedInstance] requestPermissions:@[VENPermissionMakePayments,
                                                 VENPermissionAccessProfile]
                         withCompletionHandler:^(BOOL success, NSError *error) {
                             if (success) {
                                 NSLog(@"Permssion to VENMO Granted!!!");
                                 [self presentLoggedInVC];
                             }
                             else {
                                 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Authorization failed"
                                                                                     message:error.localizedDescription
                                                                                    delegate:self
                                                                           cancelButtonTitle:nil
                                                                           otherButtonTitles:@"OK", nil];
                                 [alertView show];

                             }
                         }];

}
eliperkins commented 9 years ago

Hm... what is the value of self.toTextField.text? This sounds like you're trying to send a payment to some user, email, phone number, etc., that does not exist.

scottrichards commented 9 years ago

The value of the self.toTextField.text is "winstonlw" this is a valid venmo user. It works fine doing a payment to this username when I use the Venmo application, just not using the Venmo API.

jykoko commented 8 years ago

Any update on this issue? I am having the same problem. Valid user name, and it only occurs using the API rather than App Switch. I am using Swift. It works when I pass a phone number, rather than a user.