List bank accounts belonging to a customer.
curl "https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources?object=bank_account&limit=3" \
-u STRIPE_SECRET_KEY: \
-G
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkRest.pb"
Procedure ChilkatExample()
rest.i = CkRest::ckCreate()
If rest.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources?object=bank_account&limit=3
bTls.i = 1
port.i = 443
bAutoReconnect.i = 1
success = CkRest::ckConnect(rest,"api.stripe.com",port,bTls,bAutoReconnect)
If success <> 1
Debug "ConnectFailReason: " + Str(CkRest::ckConnectFailReason(rest))
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
ProcedureReturn
EndIf
CkRest::ckSetAuthBasic(rest,"STRIPE_SECRET_KEY","")
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkRest::ckFullRequestNoBodySb(rest,"GET","/v1/customers/cus_CBbg3iRMzWBjoe/sources?object=bank_account&limit=3",sbResponseBody)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
jsonResponse.i = CkJsonObject::ckCreate()
If jsonResponse.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jsonResponse,sbResponseBody)
object.s
url.s
has_more.i
i.i
count_i.i
id.s
account.s
account_holder_name.s
account_holder_type.s
bank_name.s
country.s
currency.s
default_for_currency.i
fingerprint.s
last4.s
routing_number.s
status.s
customer.s
object = CkJsonObject::ckStringOf(jsonResponse,"object")
url = CkJsonObject::ckStringOf(jsonResponse,"url")
has_more = CkJsonObject::ckBoolOf(jsonResponse,"has_more")
i = 0
count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"data")
While i < count_i
CkJsonObject::setCkI(jsonResponse, i)
id = CkJsonObject::ckStringOf(jsonResponse,"data[i].id")
object = CkJsonObject::ckStringOf(jsonResponse,"data[i].object")
account = CkJsonObject::ckStringOf(jsonResponse,"data[i].account")
account_holder_name = CkJsonObject::ckStringOf(jsonResponse,"data[i].account_holder_name")
account_holder_type = CkJsonObject::ckStringOf(jsonResponse,"data[i].account_holder_type")
bank_name = CkJsonObject::ckStringOf(jsonResponse,"data[i].bank_name")
country = CkJsonObject::ckStringOf(jsonResponse,"data[i].country")
currency = CkJsonObject::ckStringOf(jsonResponse,"data[i].currency")
default_for_currency = CkJsonObject::ckBoolOf(jsonResponse,"data[i].default_for_currency")
fingerprint = CkJsonObject::ckStringOf(jsonResponse,"data[i].fingerprint")
last4 = CkJsonObject::ckStringOf(jsonResponse,"data[i].last4")
routing_number = CkJsonObject::ckStringOf(jsonResponse,"data[i].routing_number")
status = CkJsonObject::ckStringOf(jsonResponse,"data[i].status")
customer = CkJsonObject::ckStringOf(jsonResponse,"data[i].customer")
i = i + 1
Wend
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jsonResponse)
ProcedureReturn
EndProcedure
{
"object": "list",
"url": "/v1/customers/cus_CBbg3iRMzWBjoe/sources",
"has_more": false,
"data": [
{
"id": "ba_1BnETKGswQrCoh0XzgjB3t99",
"object": "bank_account",
"account": "acct_18qpKxGswQrCoh0X",
"account_holder_name": "Jane Austen",
"account_holder_type": "individual",
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"default_for_currency": false,
"fingerprint": "L2j4aSuWk1MZMDZ5",
"last4": "6789",
"metadata": {},
"routing_number": "110000000",
"status": "new",
"customer": "cus_CBbg3iRMzWBjoe"
}
]
}