Creates a single use token that wraps the details of a bank account. This token can be used in place of a bank account dictionary with any API method.
curl https://api.stripe.com/v1/tokens \
-u STRIPE_SECRET_KEY: \
-d bank_account[country]=US \
-d bank_account[currency]=usd \
-d bank_account[account_holder_name]="Chloe White" \
-d bank_account[account_holder_type]=individual \
-d bank_account[routing_number]=110000000 \
-d bank_account[account_number]=000123456789 \
-X POST
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)
set rest = CreateObject("Chilkat_9_5_0.Rest")
' URL: https://api.stripe.com/v1/tokens
bTls = 1
port = 443
bAutoReconnect = 1
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> 1) Then
outFile.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
success = rest.SetAuthBasic("STRIPE_SECRET_KEY","")
success = rest.AddQueryParam("bank_account[country]","US")
success = rest.AddQueryParam("bank_account[currency]","usd")
success = rest.AddQueryParam("bank_account[account_holder_name]","Chloe White")
success = rest.AddQueryParam("bank_account[account_holder_type]","individual")
success = rest.AddQueryParam("bank_account[routing_number]","110000000")
success = rest.AddQueryParam("bank_account[account_number]","000123456789")
strResponseBody = rest.FullRequestFormUrlEncoded("POST","/v1/tokens")
If (rest.LastMethodSuccess <> 1) Then
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
set jsonResponse = CreateObject("Chilkat_9_5_0.JsonObject")
success = jsonResponse.Load(strResponseBody)
id = jsonResponse.StringOf("id")
object = jsonResponse.StringOf("object")
bank_accountId = jsonResponse.StringOf("bank_account.id")
bank_accountObject = jsonResponse.StringOf("bank_account.object")
bank_accountAccount_holder_name = jsonResponse.StringOf("bank_account.account_holder_name")
bank_accountAccount_holder_type = jsonResponse.StringOf("bank_account.account_holder_type")
bank_accountBank_name = jsonResponse.StringOf("bank_account.bank_name")
bank_accountCountry = jsonResponse.StringOf("bank_account.country")
bank_accountCurrency = jsonResponse.StringOf("bank_account.currency")
bank_accountFingerprint = jsonResponse.StringOf("bank_account.fingerprint")
bank_accountLast4 = jsonResponse.StringOf("bank_account.last4")
bank_accountRouting_number = jsonResponse.StringOf("bank_account.routing_number")
bank_accountStatus = jsonResponse.StringOf("bank_account.status")
client_ip = jsonResponse.IsNullOf("client_ip")
created = jsonResponse.IntOf("created")
livemode = jsonResponse.BoolOf("livemode")
type = jsonResponse.StringOf("type")
used = jsonResponse.BoolOf("used")
outFile.Close
{
"id": "btok_1BnETKGswQrCoh0X86abg4gM",
"object": "token",
"bank_account": {
"id": "ba_1BnETKGswQrCoh0XptCSwzal",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "individual",
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"fingerprint": "L2j4aSuWk1MZMDZ5",
"last4": "6789",
"routing_number": "110000000",
"status": "new"
},
"client_ip": null,
"created": 1516662782,
"livemode": false,
"type": "bank_account",
"used": false
}