Question How can I Show my PayPal balance on a textbox??

  1. Google "Paypal API"
  2. See if it's even possible to do (I assume you've seen it done elsewhere)
  3. Get some code run up
  4. Come back here if you run into issues with your code
 
Hang on a second here, you post a single sentence detailing a pretty vague request, and you have the nerve to say that I'm not being helpful? Go figure!

What are you expecting? someone to come forward with complete code on how to achieve what you're after? Very unlikely to happen here. What you will find folk here able (and willing) to help with, is when you run into issues with your own code.

So, post the problem you're having with your code, and you'll get a more 'helpful' response.
 
Trying to Paypal balance show up in textbox VB.NET

To be clear, what I am trying to acheive is:
Have my Paypal current balance show up in a textbox on VB.NET using the PayPal API
Not a VB.Net Webbrowser

I have followed the guide on this page
http://www.blog-dotnet.com/post/Usin...tarted%29.aspx

But I keep getting the error
Object reference not set to an instance of an object.

when I execute this code in VB.NET:
Imports PayPalAPITest.com.paypal.www

Public Class Form1

Private Sub btnGetBalance_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetBalance.Click
Dim credentials As New UserIdPasswordType
credentials.Username = "*********_api1.live.co.uk"
credentials.Password = "****************"
credentials.Signature = "****************.****************-****************"
credentials.Subject = "****************@********.co.uk"

Dim customSecurityHeader As New CustomSecurityHeaderType
customSecurityHeader.Credentials = credentials

Dim ServiceInterface As New PayPalAPISoapBinding
ServiceInterface.Url = "https://api-3t.paypal.com/2.0/"
ServiceInterface.RequesterCredentials = customSecurityHeader

Dim request As New GetBalanceRequestType
request.Version = "59.0"

Dim req As New GetBalanceReq
req.GetBalanceRequest = request

Dim response As GetBalanceResponseType
response = ServiceInterface.GetBalance(req)

Me.txtBalance.Text = response.Balance.Value
End Sub
End Class



Has anyone managed to get this to work??
If so, please lend a hand
 
Since I don't have a Paypal account I created a test one. I got the NullReferenceException on last line, and as debugger shows it relates to response.Balance being Nothing, why this code revealed (written by looking into what the response object contained):
        If response.Ack = AckCodeType.Failure Then
            With response.Errors(0)
                Debug.WriteLine(.ShortMessage & ": " & .LongMessage)
            End With
        Else
            Me.txtBalance.Text = response.Balance.Value
        End If

output was:
Authentication/Authorization Failed: You do not have permissions to make this API call
I was not able to check the balance for the test API account (A), not until I created another test API account (B), then I logged onto the Test Site with A and in Profile options granted API Access to B. Now I could use B credentials to get balance for A. The test site didn't have configuration options for "own API username and password", there was only "View API Signature". Options for specific access as described in the article you linked to were only for third party accounts. So for own account it should be full access as I see it, but that didn't work out for me.

Since you're not using the sandbox url you must have a real account, if you get the same error message you should go into Profile options for API Access and see what you can do there.
 
Oh, figured it out, you only set credentials.Subject when making requests on account of a third-party, don't set it for requests regarding own account.
Courtesy of PayPal SOAP API Overview.
 
JohnH thank you for spending your personal time trying to solve my issue :)
I know I will sound very stupid right now but
To be clear,
what do I have to do, to get this to work??

You seem to have solved it but, I don't really understand..
 
me said:
you only set credentials.Subject when making requests on account of a third-party, don't set it for requests regarding own account.
This means:
  • If you're requesting your own account DON'T set the credentials Subject.
  • If you're requesting a third party account DO set the credentials Subject.
 
Back
Top