Retrieves the token with the given ID.
curl https://api.stripe.com/v1/tokens/tok_1BnETKGswQrCoh0XcX6WAG5q \
-u STRIPE_SECRET_KEY:
#include <C_CkRestW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkStringBuilderW sbResponseBody;
HCkJsonObjectW jsonResponse;
const wchar_t *id;
const wchar_t *object;
const wchar_t *cardId;
const wchar_t *cardObject;
BOOL cardAddress_city;
BOOL cardAddress_country;
BOOL cardAddress_line1;
BOOL cardAddress_line1_check;
BOOL cardAddress_line2;
BOOL cardAddress_state;
BOOL cardAddress_zip;
BOOL cardAddress_zip_check;
const wchar_t *cardBrand;
const wchar_t *cardCountry;
BOOL cardCvc_check;
BOOL cardDynamic_last4;
int cardExp_month;
int cardExp_year;
const wchar_t *cardFingerprint;
const wchar_t *cardFunding;
const wchar_t *cardLast4;
BOOL cardName;
BOOL cardTokenization_method;
BOOL client_ip;
int created;
BOOL livemode;
const wchar_t *type;
BOOL used;
rest = CkRestW_Create();
// URL: https://api.stripe.com/v1/tokens/tok_1BnETKGswQrCoh0XcX6WAG5q
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRestW_Connect(rest,L"api.stripe.com",port,bTls,bAutoReconnect);
if (success != TRUE) {
wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
return;
}
CkRestW_SetAuthBasic(rest,L"STRIPE_SECRET_KEY",L"");
sbResponseBody = CkStringBuilderW_Create();
success = CkRestW_FullRequestNoBodySb(rest,L"GET",L"/v1/tokens/tok_1BnETKGswQrCoh0XcX6WAG5q",sbResponseBody);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jsonResponse,sbResponseBody);
id = CkJsonObjectW_stringOf(jsonResponse,L"id");
object = CkJsonObjectW_stringOf(jsonResponse,L"object");
cardId = CkJsonObjectW_stringOf(jsonResponse,L"card.id");
cardObject = CkJsonObjectW_stringOf(jsonResponse,L"card.object");
cardAddress_city = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_city");
cardAddress_country = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_country");
cardAddress_line1 = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_line1");
cardAddress_line1_check = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_line1_check");
cardAddress_line2 = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_line2");
cardAddress_state = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_state");
cardAddress_zip = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_zip");
cardAddress_zip_check = CkJsonObjectW_IsNullOf(jsonResponse,L"card.address_zip_check");
cardBrand = CkJsonObjectW_stringOf(jsonResponse,L"card.brand");
cardCountry = CkJsonObjectW_stringOf(jsonResponse,L"card.country");
cardCvc_check = CkJsonObjectW_IsNullOf(jsonResponse,L"card.cvc_check");
cardDynamic_last4 = CkJsonObjectW_IsNullOf(jsonResponse,L"card.dynamic_last4");
cardExp_month = CkJsonObjectW_IntOf(jsonResponse,L"card.exp_month");
cardExp_year = CkJsonObjectW_IntOf(jsonResponse,L"card.exp_year");
cardFingerprint = CkJsonObjectW_stringOf(jsonResponse,L"card.fingerprint");
cardFunding = CkJsonObjectW_stringOf(jsonResponse,L"card.funding");
cardLast4 = CkJsonObjectW_stringOf(jsonResponse,L"card.last4");
cardName = CkJsonObjectW_IsNullOf(jsonResponse,L"card.name");
cardTokenization_method = CkJsonObjectW_IsNullOf(jsonResponse,L"card.tokenization_method");
client_ip = CkJsonObjectW_IsNullOf(jsonResponse,L"client_ip");
created = CkJsonObjectW_IntOf(jsonResponse,L"created");
livemode = CkJsonObjectW_BoolOf(jsonResponse,L"livemode");
type = CkJsonObjectW_stringOf(jsonResponse,L"type");
used = CkJsonObjectW_BoolOf(jsonResponse,L"used");
CkRestW_Dispose(rest);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jsonResponse);
}
{
"id": "tok_1BnETKGswQrCoh0XcX6WAG5q",
"object": "token",
"card": {
"id": "card_1BnETKGswQrCoh0Xa7UvZihk",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": null,
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2019,
"fingerprint": "F9mANtIt1TaukpRJ",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1516662782,
"livemode": false,
"type": "card",
"used": false
}