VB.NET UWP/WinRT Stripe: List all Events

Back to Index

List events, going back up to 30 days.

Documentation: https://stripe.com/docs/api/curl#list_events

CURL Command

curl https://api.stripe.com/v1/events?limit=3 \
   -u STRIPE_SECRET_KEY: \
   -G

VB.NET UWP/WinRT Example

Dim rest As New Chilkat.Rest
Dim success As Boolean

'  URL: https://api.stripe.com/v1/events?limit=3
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
success = Await rest.ConnectAsync("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> True) Then
    Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


rest.SetAuthBasic("STRIPE_SECRET_KEY","")


Dim sbResponseBody As New Chilkat.StringBuilder
success = Await rest.FullRequestNoBodySbAsync("GET","/v1/events?limit=3",sbResponseBody)
If (success <> True) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


Dim jsonResponse As New Chilkat.JsonObject
jsonResponse.LoadSb(sbResponseBody)

Dim object As String
Dim url As String
Dim has_more As Boolean
Dim i As Integer
Dim count_i As Integer
Dim id As String
Dim api_version As Boolean
Dim created As Integer
Dim dataObjectId As String
Dim dataObjectObject As String
Dim dataObjectAmount As Integer
Dim dataObjectCreated As Integer
Dim dataObjectCurrency As String
Dim dataObjectInterval As String
Dim dataObjectInterval_count As Integer
Dim dataObjectLivemode As Boolean
Dim dataObjectName As String
Dim dataObjectStatement_descriptor As Boolean
Dim dataObjectTrial_period_days As Boolean
Dim livemode As Boolean
Dim pending_webhooks As Integer
Dim requestId As Boolean
Dim requestIdempotency_key As Boolean
Dim type As String

object = jsonResponse.StringOf("object")
url = jsonResponse.StringOf("url")
has_more = jsonResponse.BoolOf("has_more")
i = 0
count_i = jsonResponse.SizeOfArray("data")
While i < count_i
    jsonResponse.I = i
    id = jsonResponse.StringOf("data[i].id")
    object = jsonResponse.StringOf("data[i].object")
    api_version = jsonResponse.IsNullOf("data[i].api_version")
    created = jsonResponse.IntOf("data[i].created")
    dataObjectId = jsonResponse.StringOf("data[i].data.object.id")
    dataObjectObject = jsonResponse.StringOf("data[i].data.object.object")
    dataObjectAmount = jsonResponse.IntOf("data[i].data.object.amount")
    dataObjectCreated = jsonResponse.IntOf("data[i].data.object.created")
    dataObjectCurrency = jsonResponse.StringOf("data[i].data.object.currency")
    dataObjectInterval = jsonResponse.StringOf("data[i].data.object.interval")
    dataObjectInterval_count = jsonResponse.IntOf("data[i].data.object.interval_count")
    dataObjectLivemode = jsonResponse.BoolOf("data[i].data.object.livemode")
    dataObjectName = jsonResponse.StringOf("data[i].data.object.name")
    dataObjectStatement_descriptor = jsonResponse.IsNullOf("data[i].data.object.statement_descriptor")
    dataObjectTrial_period_days = jsonResponse.IsNullOf("data[i].data.object.trial_period_days")
    livemode = jsonResponse.BoolOf("data[i].livemode")
    pending_webhooks = jsonResponse.IntOf("data[i].pending_webhooks")
    requestId = jsonResponse.IsNullOf("data[i].request.id")
    requestIdempotency_key = jsonResponse.IsNullOf("data[i].request.idempotency_key")
    type = jsonResponse.StringOf("data[i].type")
    i = i + 1
End While

Sample JSON Response Body

{
  "object": "list",
  "url": "/v1/events",
  "has_more": false,
  "data": [
    {
      "id": "evt_1BnETJGswQrCoh0XAl7jSmFB",
      "object": "event",
      "api_version": null,
      "created": 1516662781,
      "data": {
        "object": {
          "id": "gold",
          "object": "plan",
          "amount": 2000,
          "created": 1516662781,
          "currency": "usd",
          "interval": "month",
          "interval_count": 1,
          "livemode": false,
          "metadata": {},
          "name": "T-shirt",
          "statement_descriptor": null,
          "trial_period_days": null
        }
      },
      "livemode": false,
      "pending_webhooks": 0,
      "request": {
        "id": null,
        "idempotency_key": null
      },
      "type": "plan.created"
    }
  ]
}