Retrieves the token with the given ID.
curl https://api.stripe.com/v1/tokens/tok_1BnETKGswQrCoh0XcX6WAG5q \
-u STRIPE_SECRET_KEY:
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkStringBuilder sbResponseBody;
HCkJsonObject jsonResponse;
const char *id;
const char *object;
const char *cardId;
const char *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 char *cardBrand;
const char *cardCountry;
BOOL cardCvc_check;
BOOL cardDynamic_last4;
int cardExp_month;
int cardExp_year;
const char *cardFingerprint;
const char *cardFunding;
const char *cardLast4;
BOOL cardName;
BOOL cardTokenization_method;
BOOL client_ip;
int created;
BOOL livemode;
const char *type;
BOOL used;
rest = CkRest_Create();
// URL: https://api.stripe.com/v1/tokens/tok_1BnETKGswQrCoh0XcX6WAG5q
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","");
sbResponseBody = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"GET","/v1/tokens/tok_1BnETKGswQrCoh0XcX6WAG5q",sbResponseBody);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
id = CkJsonObject_stringOf(jsonResponse,"id");
object = CkJsonObject_stringOf(jsonResponse,"object");
cardId = CkJsonObject_stringOf(jsonResponse,"card.id");
cardObject = CkJsonObject_stringOf(jsonResponse,"card.object");
cardAddress_city = CkJsonObject_IsNullOf(jsonResponse,"card.address_city");
cardAddress_country = CkJsonObject_IsNullOf(jsonResponse,"card.address_country");
cardAddress_line1 = CkJsonObject_IsNullOf(jsonResponse,"card.address_line1");
cardAddress_line1_check = CkJsonObject_IsNullOf(jsonResponse,"card.address_line1_check");
cardAddress_line2 = CkJsonObject_IsNullOf(jsonResponse,"card.address_line2");
cardAddress_state = CkJsonObject_IsNullOf(jsonResponse,"card.address_state");
cardAddress_zip = CkJsonObject_IsNullOf(jsonResponse,"card.address_zip");
cardAddress_zip_check = CkJsonObject_IsNullOf(jsonResponse,"card.address_zip_check");
cardBrand = CkJsonObject_stringOf(jsonResponse,"card.brand");
cardCountry = CkJsonObject_stringOf(jsonResponse,"card.country");
cardCvc_check = CkJsonObject_IsNullOf(jsonResponse,"card.cvc_check");
cardDynamic_last4 = CkJsonObject_IsNullOf(jsonResponse,"card.dynamic_last4");
cardExp_month = CkJsonObject_IntOf(jsonResponse,"card.exp_month");
cardExp_year = CkJsonObject_IntOf(jsonResponse,"card.exp_year");
cardFingerprint = CkJsonObject_stringOf(jsonResponse,"card.fingerprint");
cardFunding = CkJsonObject_stringOf(jsonResponse,"card.funding");
cardLast4 = CkJsonObject_stringOf(jsonResponse,"card.last4");
cardName = CkJsonObject_IsNullOf(jsonResponse,"card.name");
cardTokenization_method = CkJsonObject_IsNullOf(jsonResponse,"card.tokenization_method");
client_ip = CkJsonObject_IsNullOf(jsonResponse,"client_ip");
created = CkJsonObject_IntOf(jsonResponse,"created");
livemode = CkJsonObject_BoolOf(jsonResponse,"livemode");
type = CkJsonObject_stringOf(jsonResponse,"type");
used = CkJsonObject_BoolOf(jsonResponse,"used");
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_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
}