Sample code for 30+ languages & platforms
VB.NET Requires Chilkat v11.0.0+

PayPal: Find disputes awaiting a seller response

See more PayPal Examples

Scan cases updated in the past 30 days and page through the results. Show each case waiting on the seller and its response deadline when PayPal includes one in the summary.

PayPal documentation

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

'  See Unlock Chilkat before making requests.
'  For the merchant's internal backoffice application. Load the sandbox token
'  from the merchant's credential store. Keep it out of publicly distributed apps.
'  See Get a PayPal access token.
Dim http As New Chilkat.Http
http.AuthToken = "SANDBOX_ACCESS_TOKEN"
Dim resp As New Chilkat.HttpResponse
Dim since As New Chilkat.CkDateTime
since.SetFromCurrentSystemTime()
since.AddDays(-30)
Dim query As New Chilkat.JsonObject
query.UpdateString("update_time_after",since.GetAsTimestamp(False))
query.UpdateInt("page_size",50)
Dim page As Integer = 1
Dim more As Boolean = True
While (more = True)
    query.UpdateInt("page",page)
    success = http.HttpParams("GET","https://api-m.sandbox.paypal.com/v1/customer/disputes",query,resp)
    If (success <> True) Then
        Debug.WriteLine("No HTTP response: " & http.LastErrorText)
        Exit Sub
    End If

    If ((resp.StatusCode < 200) Or (resp.StatusCode >= 300)) Then
        Dim errorInfo As New Chilkat.JsonObject
        errorInfo.Load(resp.BodyStr)
        Debug.WriteLine("HTTP " & resp.StatusCode & " " & errorInfo.StringOf("name") & " " & errorInfo.StringOf("details[0].issue"))
        Debug.WriteLine("PayPal debug ID: " & errorInfo.StringOf("debug_id"))
        Exit Sub
    End If

    Dim result As New Chilkat.JsonObject
    Dim parsedResult As Boolean = result.Load(resp.BodyStr)
    If (parsedResult <> True) Then
        Debug.WriteLine("Expected a JSON response; HTTP " & resp.StatusCode)
        Exit Sub
    End If

    Dim i As Integer = 0
    While (i < result.SizeOfArray("items"))
        result.I = i
        If (result.StringOfEquals("items[i].status","WAITING_FOR_SELLER_RESPONSE",True) = True) Then
            Debug.WriteLine(result.StringOf("items[i].dispute_id") & "  " & result.StringOf("items[i].reason"))
            If (result.HasMember("items[i].seller_response_due_date") = True) Then
                Debug.WriteLine("Respond by " & result.StringOf("items[i].seller_response_due_date"))
            End If

        End If

        i = i + 1
    End While
    Dim hasNext As Boolean = False
    Dim linkIndex As Integer = 0
    While (linkIndex < result.SizeOfArray("links"))
        result.I = linkIndex
        If (result.StringOfEquals("links[i].rel","next",True) = True) Then
            hasNext = True
        End If

        linkIndex = linkIndex + 1
    End While
    more = hasNext
    page = page + 1
End While