Closed sudov closed 9 years ago
In the event that requesting through the API is not supported, I tried doing an NSURL based request and get the following error.
Optional({
error = {
code = 261;
message = "You did not pass a valid OAuth access token.";
};
})
My URL reads:
https://api.venmo.com/v1/payments?token=<super_long_token>&phone=<some_phone>&amount=0.01¬e=SplitPEAAAAAS&audience=private
Not sure how to proceed. Help?
EDIT: the NSURL approach works (swapped token= for access_token=). I would still like to know whether the SDK has a function to request money instead of paying.
@sudov I'm pretty sure setting the amount to something negative will send a request.
@diogeneshamilton no the datatype is NSUInteger (cant remember of the top of my head exaclty) and only takes positive values
Yup, just checked, the error that shows up when using a negative number is "Integer literal overflows when stored into UInt"
@eliperkins is this a bug in the way Swift interprets the Objective C function?
@sudov there are native ways to do this via the SDK. Please see [Venmo -sendRequestTo:amount:note:completionHandler:]
: https://github.com/venmo/venmo-ios-sdk/blob/master/venmo-sdk/Venmo.h#L143-L168
@eliperkins yup thats exactly what I did (My app is in Swift and I'm using a bridging header, could that be a problem?)
@eliperkins Notice the datatype is NSUInteger not NSInteger!!! (so unsigned!!! how could an unsigned number be negative (in the case of a charge)
Are you referring to the Integer literal overflows when stored into UInt
issue you discussed? This value should always be a positive number. We handle the value inside of the Venmo app upon app switch, internally. You should provide a positive integer here.
But then how do you differentiate between a charge and a payment?
Payments are created via sendPaymentTo:
, where as charges are created via sendRequestTo:
.
Oh boy, my bad. Thanks man.
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?
Secondly, I want to REQUEST money in my function not PAY. Is this not supported?