Can someone please show me how to show my paypal balance in a textbox

Dani AI

Generated

As asked: the reliable, maintainable way to show a PayPal balance in a VB TextBox is to call PayPal's API, parse the returned data, and then update the UI — not to scrape a logged-in page with a WebBrowser as suggested (scraping is fragile and breaks when PayPal changes markup). High-level steps: obtain API credentials from your PayPal account, test against the sandbox endpoint, POST the API request (classic NVP/SOAP GetBalance), parse the name=value response, and update the TextBox on the UI thread. Use async HTTP calls so the UI does not freeze and never hardcode secrets.

Example VB outline (WinForms) — make the HTTP call, parse NVP, set TextBox safely:

' Async call (HttpClient + FormUrlEncodedContent)
Private Async Function QueryPayPalBalanceAsync(apiUser As String, apiPwd As String, apiSignature As String, useSandbox As Boolean) As Task(Of String)
    Dim endpoint = If(useSandbox, "https://api-3t.sandbox.paypal.com/nvp", "https://api-3t.paypal.com/nvp")
    Using client As New System.Net.Http.HttpClient()
        Dim pairs = New List(Of KeyValuePair(Of String, String)) From {
            New KeyValuePair(Of String, String)("METHOD", "GetBalance"),
            New KeyValuePair(Of String, String)("USER", apiUser),
            New KeyValuePair(Of String, String)("PWD", apiPwd),
            New KeyValuePair(Of String, String)("SIGNATURE", apiSignature),
            New KeyValuePair(Of String, String)("VERSION", "204.0")
        }
        Dim content = New System.Net.Http.FormUrlEncodedContent(pairs)
        Dim resp = Await client.PostAsync(endpoint, content).ConfigureAwait(False)
        Return Await resp.Content.ReadAsStringAsync().ConfigureAwait(False)
    End Using
End Function

' Parse NVP response into dictionary
Private Function ParseNvp(response As String) As Dictionary(Of String, String)
    Dim d As New Dictionary(Of String, String)(StringComparer.OrdinalIgnoreCase)
    For Each part In response.Split("&"c)
        Dim kv = part.Split("="c, 2)
        If kv.Length = 2 Then
            Dim k = Uri.UnescapeDataString(kv(0))
            Dim v = Uri.UnescapeDataString(kv(1))
            d(k) = v
        End If
    Next
    Return d
End Function

' Safe UI update (WinForms)
Private Sub SetTextSafe(txt As TextBox, value As String)
    If txt.InvokeRequired Then txt.Invoke(Sub() txt.Text = value) Else txt.Text = value
End Sub

Troubleshooting tips: test with sandbox credentials, verify you are posting to the correct endpoint, ensure TLS 1.2 is enabled in your runtime, and examine the API response for error codes.

Recommended Answers

All 3 Replies

Explain what you want clearly...

Can someone please show me how to show my paypal balance in a textbox what we need to understand from this?

You more than likely have to login into PayPal, navigate to the proper page, then extract data if the page has the balance on it.
.This can easily be done with a WebBrowser.

I do not know how to be anymore clear...

All I want is for my PayPal Balance to show up in a VB textbox. I don't know how you could mis interpret that.

And codeorder, I really don't want to have to use a VBwebbrowser to have to do this.


It was suggested that I visit this page
https://cms.paypal.c...ap_r_GetBalance

But upon visit of that page It shows me the outputs that will be given if I am able to make my paypal balance show up through VB.NET. Not how to do it...
I am still at a loss.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.