SQL Server 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

SQL Server Example

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @rest int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    --  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify
    DECLARE @bTls int
    SELECT @bTls = 1
    DECLARE @port int
    SELECT @port = 443
    DECLARE @bAutoReconnect int
    SELECT @bAutoReconnect = 1
    EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'api.stripe.com', STR(@port), STR(@bTls), STR(@bAutoReconnect)
    IF STR(@success) <> 1
      BEGIN

        EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
        PRINT 'ConnectFailReason: ' + @iTmp0
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        RETURN
      END

    EXEC sp_OAMethod @rest, 'SetAuthBasic', @success OUT, 'STRIPE_SECRET_KEY', ''

    EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'amounts[]', '32'
    EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'amounts[]', '45'

    DECLARE @strResponseBody nvarchar(4000)
    EXEC sp_OAMethod @rest, 'FullRequestFormUrlEncoded', @strResponseBody OUT, 'POST', '/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99/verify'
    EXEC sp_OAGetProperty @rest, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        RETURN
      END

    DECLARE @jsonResponse int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jsonResponse OUT

    EXEC sp_OAMethod @jsonResponse, 'Load', @success OUT, @strResponseBody

    DECLARE @id nvarchar(4000)

    DECLARE @object nvarchar(4000)

    DECLARE @account nvarchar(4000)

    DECLARE @account_holder_name nvarchar(4000)

    DECLARE @account_holder_type nvarchar(4000)

    DECLARE @bank_name nvarchar(4000)

    DECLARE @country nvarchar(4000)

    DECLARE @currency nvarchar(4000)

    DECLARE @default_for_currency int

    DECLARE @fingerprint nvarchar(4000)

    DECLARE @last4 nvarchar(4000)

    DECLARE @routing_number nvarchar(4000)

    DECLARE @status nvarchar(4000)

    DECLARE @customer nvarchar(4000)

    DECLARE @name nvarchar(4000)

    EXEC sp_OAMethod @jsonResponse, 'StringOf', @id OUT, 'id'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @object OUT, 'object'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @account OUT, 'account'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @account_holder_name OUT, 'account_holder_name'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @account_holder_type OUT, 'account_holder_type'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @bank_name OUT, 'bank_name'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @country OUT, 'country'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @currency OUT, 'currency'
    EXEC sp_OAMethod @jsonResponse, 'BoolOf', @default_for_currency OUT, 'default_for_currency'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @fingerprint OUT, 'fingerprint'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @last4 OUT, 'last4'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @routing_number OUT, 'routing_number'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @status OUT, 'status'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @customer OUT, 'customer'
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @name OUT, 'name'

    EXEC @hr = sp_OADestroy @rest
    EXEC @hr = sp_OADestroy @jsonResponse


END
GO

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