Visual FoxPro Stripe: Retrieve a Bank Account

Back to Index

Retrieve details about a specific bank account stored on the Stripe account.

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

CURL Command

curl https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99 \
   -u STRIPE_SECRET_KEY:

Visual FoxPro Example

LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL loSbResponseBody
LOCAL loJsonResponse
LOCAL lcId
LOCAL lcObject
LOCAL lcAccount
LOCAL lcAccount_holder_name
LOCAL lcAccount_holder_type
LOCAL lcBank_name
LOCAL lcCountry
LOCAL lcCurrency
LOCAL lnDefault_for_currency
LOCAL lcFingerprint
LOCAL lcLast4
LOCAL lcRouting_number
LOCAL lcStatus
LOCAL lcCustomer

loRest = CreateObject('Chilkat_9_5_0.Rest')

*  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("api.stripe.com",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess <> 1) THEN
    ? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
    ? loRest.LastErrorText
    RELEASE loRest
    CANCEL
ENDIF

loRest.SetAuthBasic("STRIPE_SECRET_KEY","")

loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99",loSbResponseBody)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loSbResponseBody
    CANCEL
ENDIF

loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse.LoadSb(loSbResponseBody)

lcId = loJsonResponse.StringOf("id")
lcObject = loJsonResponse.StringOf("object")
lcAccount = loJsonResponse.StringOf("account")
lcAccount_holder_name = loJsonResponse.StringOf("account_holder_name")
lcAccount_holder_type = loJsonResponse.StringOf("account_holder_type")
lcBank_name = loJsonResponse.StringOf("bank_name")
lcCountry = loJsonResponse.StringOf("country")
lcCurrency = loJsonResponse.StringOf("currency")
lnDefault_for_currency = loJsonResponse.BoolOf("default_for_currency")
lcFingerprint = loJsonResponse.StringOf("fingerprint")
lcLast4 = loJsonResponse.StringOf("last4")
lcRouting_number = loJsonResponse.StringOf("routing_number")
lcStatus = loJsonResponse.StringOf("status")
lcCustomer = loJsonResponse.StringOf("customer")

RELEASE loRest
RELEASE loSbResponseBody
RELEASE loJsonResponse

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