Unicode C++ 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:

Unicode C++ Example

#include <CkRestW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>

void ChilkatSample(void)
    {
    CkRestW rest;
    bool success;

    //  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99
    bool bTls = true;
    int port = 443;
    bool bAutoReconnect = true;
    success = rest.Connect(L"api.stripe.com",port,bTls,bAutoReconnect);
    if (success != true) {
        wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    rest.SetAuthBasic(L"STRIPE_SECRET_KEY",L"");

    CkStringBuilderW sbResponseBody;
    success = rest.FullRequestNoBodySb(L"GET",L"/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99",sbResponseBody);
    if (success != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    CkJsonObjectW jsonResponse;
    jsonResponse.LoadSb(sbResponseBody);

    const wchar_t *id = 0;
    const wchar_t *object = 0;
    const wchar_t *account = 0;
    const wchar_t *account_holder_name = 0;
    const wchar_t *account_holder_type = 0;
    const wchar_t *bank_name = 0;
    const wchar_t *country = 0;
    const wchar_t *currency = 0;
    bool default_for_currency;
    const wchar_t *fingerprint = 0;
    const wchar_t *last4 = 0;
    const wchar_t *routing_number = 0;
    const wchar_t *status = 0;
    const wchar_t *customer = 0;

    id = jsonResponse.stringOf(L"id");
    object = jsonResponse.stringOf(L"object");
    account = jsonResponse.stringOf(L"account");
    account_holder_name = jsonResponse.stringOf(L"account_holder_name");
    account_holder_type = jsonResponse.stringOf(L"account_holder_type");
    bank_name = jsonResponse.stringOf(L"bank_name");
    country = jsonResponse.stringOf(L"country");
    currency = jsonResponse.stringOf(L"currency");
    default_for_currency = jsonResponse.BoolOf(L"default_for_currency");
    fingerprint = jsonResponse.stringOf(L"fingerprint");
    last4 = jsonResponse.stringOf(L"last4");
    routing_number = jsonResponse.stringOf(L"routing_number");
    status = jsonResponse.stringOf(L"status");
    customer = jsonResponse.stringOf(L"customer");
    }

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