Xojo Plugin Stripe: List all Customers

Back to Index

Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.

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

CURL Command

curl https://api.stripe.com/v1/customers?limit=3 \

Xojo Plugin Example

Dim rest As New Chilkat.Rest
Dim success As Boolean

//  URL: https://api.stripe.com/v1/customers?limit=3
Dim bTls As Boolean
bTls = True
Dim port As Int32
port = 443
Dim bAutoReconnect As Boolean
bAutoReconnect = True
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> True) Then
    System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
End If


Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("GET","/v1/customers?limit=3",sbResponseBody)
If (success <> True) Then
End If

Dim jsonResponse As New Chilkat.JsonObject

Dim object As String
Dim url As String
Dim has_more As Boolean
Dim i As Int32
Dim count_i As Int32
Dim id As String
Dim account_balance As Int32
Dim created As Int32
Dim currency As String
Dim default_source As Boolean
Dim delinquent As Boolean
Dim description As Boolean
Dim discount As Boolean
Dim email As Boolean
Dim livemode As Boolean
Dim shipping As Boolean
Dim sourcesObject As String
Dim sourcesHas_more As Boolean
Dim sourcesTotal_count As Int32
Dim sourcesUrl As String
Dim subscriptionsObject As String
Dim subscriptionsHas_more As Boolean
Dim subscriptionsTotal_count As Int32
Dim subscriptionsUrl As String
Dim j As Int32
Dim count_j As Int32

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")
    account_balance = jsonResponse.IntOf("data[i].account_balance")
    created = jsonResponse.IntOf("data[i].created")
    currency = jsonResponse.StringOf("data[i].currency")
    default_source = jsonResponse.IsNullOf("data[i].default_source")
    delinquent = jsonResponse.BoolOf("data[i].delinquent")
    description = jsonResponse.IsNullOf("data[i].description")
    discount = jsonResponse.IsNullOf("data[i].discount")
    email = jsonResponse.IsNullOf("data[i].email")
    livemode = jsonResponse.BoolOf("data[i].livemode")
    shipping = jsonResponse.IsNullOf("data[i].shipping")
    sourcesObject = jsonResponse.StringOf("data[i].sources.object")
    sourcesHas_more = jsonResponse.BoolOf("data[i].sources.has_more")
    sourcesTotal_count = jsonResponse.IntOf("data[i].sources.total_count")
    sourcesUrl = jsonResponse.StringOf("data[i].sources.url")
    subscriptionsObject = jsonResponse.StringOf("data[i].subscriptions.object")
    subscriptionsHas_more = jsonResponse.BoolOf("data[i].subscriptions.has_more")
    subscriptionsTotal_count = jsonResponse.IntOf("data[i].subscriptions.total_count")
    subscriptionsUrl = jsonResponse.StringOf("data[i].subscriptions.url")
    j = 0
    count_j = jsonResponse.SizeOfArray("data[i].sources.data")
    While j < count_j
        jsonResponse.J = j
        j = j + 1
    j = 0
    count_j = jsonResponse.SizeOfArray("data[i].subscriptions.data")
    While j < count_j
        jsonResponse.J = j
        j = j + 1
    i = i + 1

Sample JSON Response Body

  "object": "list",
  "url": "/v1/customers",
  "has_more": false,
  "data": [
      "id": "cus_CBbgVLJqv487Oq",
      "object": "customer",
      "account_balance": 0,
      "created": 1516662781,
      "currency": "usd",
      "default_source": null,
      "delinquent": false,
      "description": null,
      "discount": null,
      "email": null,
      "livemode": false,
      "metadata": {},
      "shipping": null,
      "sources": {
        "object": "list",
        "data": [
        "has_more": false,
        "total_count": 0,
        "url": "/v1/customers/cus_CBbgVLJqv487Oq/sources"
      "subscriptions": {
        "object": "list",
        "data": [
        "has_more": false,
        "total_count": 0,
        "url": "/v1/customers/cus_CBbgVLJqv487Oq/subscriptions"