Tcl Stripe: Verify a Bank Account

Back to Index

Verifies a customer's bank account.

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

CURL Command

curl https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify \
   -u STRIPE_SECRET_KEY: \
   -d amounts[]=32 \
   -d amounts[]=45 \
   -X POST

Tcl Example


load ./chilkat.dll

set rest [new_CkRest]

#  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify
set bTls 1
set port 443
set bAutoReconnect 1
set success [CkRest_Connect $rest "api.stripe.com" $port $bTls $bAutoReconnect]
if {[expr $success != 1]} then {
    puts "ConnectFailReason: [CkRest_ConnectFailReason $rest]"
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

CkRest_SetAuthBasic $rest "STRIPE_SECRET_KEY" ""

CkRest_AddQueryParam $rest "amounts[]" "32"
CkRest_AddQueryParam $rest "amounts[]" "45"

set strResponseBody [CkRest_fullRequestFormUrlEncoded $rest "POST" "/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify"]
if {[expr [CkRest_LastMethodSuccess $rest] != 1]} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

set jsonResponse [new_CkJsonObject]

CkJsonObject_Load $jsonResponse $strResponseBody

set id [CkJsonObject_stringOf $jsonResponse "id"]
set object [CkJsonObject_stringOf $jsonResponse "object"]
set account [CkJsonObject_stringOf $jsonResponse "account"]
set account_holder_name [CkJsonObject_stringOf $jsonResponse "account_holder_name"]
set account_holder_type [CkJsonObject_stringOf $jsonResponse "account_holder_type"]
set bank_name [CkJsonObject_stringOf $jsonResponse "bank_name"]
set country [CkJsonObject_stringOf $jsonResponse "country"]
set currency [CkJsonObject_stringOf $jsonResponse "currency"]
set default_for_currency [CkJsonObject_BoolOf $jsonResponse "default_for_currency"]
set fingerprint [CkJsonObject_stringOf $jsonResponse "fingerprint"]
set last4 [CkJsonObject_stringOf $jsonResponse "last4"]
set routing_number [CkJsonObject_stringOf $jsonResponse "routing_number"]
set status [CkJsonObject_stringOf $jsonResponse "status"]
set customer [CkJsonObject_stringOf $jsonResponse "customer"]
set name [CkJsonObject_stringOf $jsonResponse "name"]

delete_CkRest $rest
delete_CkJsonObject $jsonResponse

Sample JSON Response Body

{
  "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",
  "name": "Liam Thomas"
}