Creates a new bank account object.
curl https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources \
-u STRIPE_SECRET_KEY: \
-d source=btok_1BnETKGswQrCoh0X43GQEzjM \
-X POST
IncludeFile "CkRest.pb"
IncludeFile "CkJsonObject.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
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","")
CkRest::ckAddQueryParam(rest,"source","btok_1BnETKGswQrCoh0X43GQEzjM")
strResponseBody.s = CkRest::ckFullRequestFormUrlEncoded(rest,"POST","/v1/customers/cus_CBbg3iRMzWBjoe/sources")
If CkRest::ckLastMethodSuccess(rest) <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
ProcedureReturn
EndIf
jsonResponse.i = CkJsonObject::ckCreate()
If jsonResponse.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoad(jsonResponse,strResponseBody)
id.s
object.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
id = CkJsonObject::ckStringOf(jsonResponse,"id")
object = CkJsonObject::ckStringOf(jsonResponse,"object")
account = CkJsonObject::ckStringOf(jsonResponse,"account")
account_holder_name = CkJsonObject::ckStringOf(jsonResponse,"account_holder_name")
account_holder_type = CkJsonObject::ckStringOf(jsonResponse,"account_holder_type")
bank_name = CkJsonObject::ckStringOf(jsonResponse,"bank_name")
country = CkJsonObject::ckStringOf(jsonResponse,"country")
currency = CkJsonObject::ckStringOf(jsonResponse,"currency")
default_for_currency = CkJsonObject::ckBoolOf(jsonResponse,"default_for_currency")
fingerprint = CkJsonObject::ckStringOf(jsonResponse,"fingerprint")
last4 = CkJsonObject::ckStringOf(jsonResponse,"last4")
routing_number = CkJsonObject::ckStringOf(jsonResponse,"routing_number")
status = CkJsonObject::ckStringOf(jsonResponse,"status")
customer = CkJsonObject::ckStringOf(jsonResponse,"customer")
CkRest::ckDispose(rest)
CkJsonObject::ckDispose(jsonResponse)
ProcedureReturn
EndProcedure
{
"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"
}