Open akkshay opened 8 years ago
Are you calling [Venmo startWithAppId:@"VENMO_APP_ID" secret:@"VENMO_APP_SECRET" name:@"VENMO_APP_NAME"];
anywhere? In order to be able to authenticate new users, we need a way to associate the app that is requesting the access token on their behalf.
Yes, I'm calling that in my App Delegate didFinishLaunchingWithOptions. Should I be calling it right before the sendPaymentTo function in my viewcontroller?
I tried calling that method in my view controller right after the pay button is pressed and before the request permission and sendPaymenTo methods are called. Still got the same errors (error code 7 & error code 1)
In my ViewDidLoad, I have the following code:
when the view is loaded, i am taken to the venmo app, and I press allow, and then im redirected back to my app. In my app, I then press a button that executes the following code:
Venmo.sharedInstance().sendPaymentTo("TestingNum", amount: 1, note: "Testing", completionHandler: {(transaction: VENTransaction!, success: Bool, error: NSError!) -> Void in if error != nil { print(error) } else { print("no error") } })
Once the button, is pressed, I get this error:
Error Domain=com.venmo.VenmoSDK.ErrorDomain Code=7 "The current session is not open." UserInfo={NSLocalizedDescription=The current session is not open., NSLocalizedRecoverySuggestion=If the session is closed, call requestPermissions:withCompletionHandler: to open a new session} Error Domain=com.venmo.VENCore.ErrorDomain.VENCore Code=1 "No access token" UserInfo={NSLocalizedDescription=No access token, NSLocalizedRecoverySuggestion=Set the default core's access token.}
How can I fix this? When I tried setting the defaultCore's accessToken, it worked, but in order to do that, I had to get the access token from my account on venmo's developer page and copy and paste it in my xcode project. That venmo token expires every 30 minutes, so how can I write code so that I get the access token from my app and don't have to go into Venmo's developer site and press "get token" every time?