Visual Basic 6.0 Stripe: Retrieve an Event

Back to Index

Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook.

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

CURL Command

curl https://api.stripe.com/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB \
   -u STRIPE_SECRET_KEY:

Visual Basic 6.0 Example

Dim rest As New ChilkatRest
Dim success As Long

'  URL: https://api.stripe.com/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB
Dim bTls As Long
bTls = 1
Dim port As Long
port = 443
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> 1) Then
    Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
    Debug.Print rest.LastErrorText
    Exit Sub
End If

success = rest.SetAuthBasic("STRIPE_SECRET_KEY","")

Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("GET","/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB",sbResponseBody)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim jsonResponse As New ChilkatJsonObject
success = jsonResponse.LoadSb(sbResponseBody)

Dim id As String
Dim object As String
Dim api_version As Long
Dim created As Long
Dim dataObjectId As String
Dim dataObjectObject As String
Dim dataObjectAmount As Long
Dim dataObjectCreated As Long
Dim dataObjectCurrency As String
Dim dataObjectInterval As String
Dim dataObjectInterval_count As Long
Dim dataObjectLivemode As Long
Dim dataObjectName As String
Dim dataObjectStatement_descriptor As Long
Dim dataObjectTrial_period_days As Long
Dim livemode As Long
Dim pending_webhooks As Long
Dim requestId As Long
Dim requestIdempotency_key As Long
Dim type As String

id = jsonResponse.StringOf("id")
object = jsonResponse.StringOf("object")
api_version = jsonResponse.IsNullOf("api_version")
created = jsonResponse.IntOf("created")
dataObjectId = jsonResponse.StringOf("data.object.id")
dataObjectObject = jsonResponse.StringOf("data.object.object")
dataObjectAmount = jsonResponse.IntOf("data.object.amount")
dataObjectCreated = jsonResponse.IntOf("data.object.created")
dataObjectCurrency = jsonResponse.StringOf("data.object.currency")
dataObjectInterval = jsonResponse.StringOf("data.object.interval")
dataObjectInterval_count = jsonResponse.IntOf("data.object.interval_count")
dataObjectLivemode = jsonResponse.BoolOf("data.object.livemode")
dataObjectName = jsonResponse.StringOf("data.object.name")
dataObjectStatement_descriptor = jsonResponse.IsNullOf("data.object.statement_descriptor")
dataObjectTrial_period_days = jsonResponse.IsNullOf("data.object.trial_period_days")
livemode = jsonResponse.BoolOf("livemode")
pending_webhooks = jsonResponse.IntOf("pending_webhooks")
requestId = jsonResponse.IsNullOf("request.id")
requestIdempotency_key = jsonResponse.IsNullOf("request.idempotency_key")
type = jsonResponse.StringOf("type")

Sample JSON Response Body

{
  "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"
}