Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

iOS SDK malfunction/ request feature unavailable? #71

Closed
sudov opened this issue Apr 15, 2015 · 13 comments
Closed

iOS SDK malfunction/ request feature unavailable? #71

sudov opened this issue Apr 15, 2015 · 13 comments

Comments

@sudov
Copy link

sudov commented Apr 15, 2015

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?

@sudov
Copy link
Author

sudov commented Apr 15, 2015

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&note=SplitPEAAAAAS&audience=private

Not sure how to proceed. Help?

@sudov
Copy link
Author

sudov commented Apr 15, 2015

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.

@diogeneshamilton
Copy link
Contributor

@sudov I'm pretty sure setting the amount to something negative will send a request.

@sudov
Copy link
Author

sudov commented Apr 15, 2015

@diogeneshamilton no the datatype is NSUInteger (cant remember of the top of my head exaclty) and only takes positive values

@sudov
Copy link
Author

sudov commented Apr 16, 2015

Yup, just checked, the error that shows up when using a negative number is "Integer literal overflows when stored into UInt"

@sudov
Copy link
Author

sudov commented Apr 23, 2015

@eliperkins is this a bug in the way Swift interprets the Objective C function?

@eliperkins
Copy link

@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

@sudov
Copy link
Author

sudov commented Apr 28, 2015

@eliperkins yup thats exactly what I did (My app is in Swift and I'm using a bridging header, could that be a problem?)

@sudov
Copy link
Author

sudov commented Apr 28, 2015

@eliperkins Notice the datatype is NSUInteger not NSInteger!!! (so unsigned!!! how could an unsigned number be negative (in the case of a charge)

@eliperkins
Copy link

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.

@sudov
Copy link
Author

sudov commented Apr 28, 2015

But then how do you differentiate between a charge and a payment?

@eliperkins
Copy link

Payments are created via sendPaymentTo:, where as charges are created via sendRequestTo:.

@sudov
Copy link
Author

sudov commented Apr 28, 2015

Oh boy, my bad. Thanks man.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants