C 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

C Example

#include <C_CkRest.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkRest rest;
    BOOL success;
    BOOL bTls;
    int port;
    BOOL bAutoReconnect;
    const char *strResponseBody;
    HCkJsonObject jsonResponse;
    const char *id;
    const char *object;
    const char *account;
    const char *account_holder_name;
    const char *account_holder_type;
    const char *bank_name;
    const char *country;
    const char *currency;
    BOOL default_for_currency;
    const char *fingerprint;
    const char *last4;
    const char *routing_number;
    const char *status;
    const char *customer;
    const char *name;

    rest = CkRest_Create();

    //  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify
    bTls = TRUE;
    port = 443;
    bAutoReconnect = TRUE;
    success = CkRest_Connect(rest,"api.stripe.com",port,bTls,bAutoReconnect);
    if (success != TRUE) {
        printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        return;
    }

    CkRest_SetAuthBasic(rest,"STRIPE_SECRET_KEY","");

    CkRest_AddQueryParam(rest,"amounts[]","32");
    CkRest_AddQueryParam(rest,"amounts[]","45");

    strResponseBody = CkRest_fullRequestFormUrlEncoded(rest,"POST","/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify");
    if (CkRest_getLastMethodSuccess(rest) != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        return;
    }

    jsonResponse = CkJsonObject_Create();
    CkJsonObject_Load(jsonResponse,strResponseBody);

    id = CkJsonObject_stringOf(jsonResponse,"id");
    object = CkJsonObject_stringOf(jsonResponse,"object");
    account = CkJsonObject_stringOf(jsonResponse,"account");
    account_holder_name = CkJsonObject_stringOf(jsonResponse,"account_holder_name");
    account_holder_type = CkJsonObject_stringOf(jsonResponse,"account_holder_type");
    bank_name = CkJsonObject_stringOf(jsonResponse,"bank_name");
    country = CkJsonObject_stringOf(jsonResponse,"country");
    currency = CkJsonObject_stringOf(jsonResponse,"currency");
    default_for_currency = CkJsonObject_BoolOf(jsonResponse,"default_for_currency");
    fingerprint = CkJsonObject_stringOf(jsonResponse,"fingerprint");
    last4 = CkJsonObject_stringOf(jsonResponse,"last4");
    routing_number = CkJsonObject_stringOf(jsonResponse,"routing_number");
    status = CkJsonObject_stringOf(jsonResponse,"status");
    customer = CkJsonObject_stringOf(jsonResponse,"customer");
    name = CkJsonObject_stringOf(jsonResponse,"name");


    CkRest_Dispose(rest);
    CkJsonObject_Dispose(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"
}