PureBasic 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

PureBasic Example

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/ba_1BnETKGswQrCoh0XzgjB3t99/verify
    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,"amounts[]","32")
    CkRest::ckAddQueryParam(rest,"amounts[]","45")

    strResponseBody.s = CkRest::ckFullRequestFormUrlEncoded(rest,"POST","/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify")
    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
    name.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")
    name = CkJsonObject::ckStringOf(jsonResponse,"name")


    CkRest::ckDispose(rest)
    CkJsonObject::ckDispose(jsonResponse)


    ProcedureReturn
EndProcedure

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