Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook.
curl https://api.stripe.com/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB \
-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;
BOOL api_version;
int created;
const wchar_t *dataObjectId;
const wchar_t *dataObjectObject;
int dataObjectAmount;
int dataObjectCreated;
const wchar_t *dataObjectCurrency;
const wchar_t *dataObjectInterval;
int dataObjectInterval_count;
BOOL dataObjectLivemode;
const wchar_t *dataObjectName;
BOOL dataObjectStatement_descriptor;
BOOL dataObjectTrial_period_days;
BOOL livemode;
int pending_webhooks;
BOOL requestId;
BOOL requestIdempotency_key;
const wchar_t *type;
rest = CkRestW_Create();
// URL: https://api.stripe.com/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB
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/events/evt_1BnETJGswQrCoh0XAl7jSmFB",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");
api_version = CkJsonObjectW_IsNullOf(jsonResponse,L"api_version");
created = CkJsonObjectW_IntOf(jsonResponse,L"created");
dataObjectId = CkJsonObjectW_stringOf(jsonResponse,L"data.object.id");
dataObjectObject = CkJsonObjectW_stringOf(jsonResponse,L"data.object.object");
dataObjectAmount = CkJsonObjectW_IntOf(jsonResponse,L"data.object.amount");
dataObjectCreated = CkJsonObjectW_IntOf(jsonResponse,L"data.object.created");
dataObjectCurrency = CkJsonObjectW_stringOf(jsonResponse,L"data.object.currency");
dataObjectInterval = CkJsonObjectW_stringOf(jsonResponse,L"data.object.interval");
dataObjectInterval_count = CkJsonObjectW_IntOf(jsonResponse,L"data.object.interval_count");
dataObjectLivemode = CkJsonObjectW_BoolOf(jsonResponse,L"data.object.livemode");
dataObjectName = CkJsonObjectW_stringOf(jsonResponse,L"data.object.name");
dataObjectStatement_descriptor = CkJsonObjectW_IsNullOf(jsonResponse,L"data.object.statement_descriptor");
dataObjectTrial_period_days = CkJsonObjectW_IsNullOf(jsonResponse,L"data.object.trial_period_days");
livemode = CkJsonObjectW_BoolOf(jsonResponse,L"livemode");
pending_webhooks = CkJsonObjectW_IntOf(jsonResponse,L"pending_webhooks");
requestId = CkJsonObjectW_IsNullOf(jsonResponse,L"request.id");
requestIdempotency_key = CkJsonObjectW_IsNullOf(jsonResponse,L"request.idempotency_key");
type = CkJsonObjectW_stringOf(jsonResponse,L"type");
CkRestW_Dispose(rest);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jsonResponse);
}
{
"id": "evt_1BnETJGswQrCoh0XAl7jSmFB",
"object": "event",
"api_version": null,
"created": 1516662781,
"data": {
"object": {
"id": "gold",
"object": "plan",
"amount": 2000,
"created": 1516662781,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"name": "T-shirt",
"statement_descriptor": null,
"trial_period_days": null
}
},
"livemode": false,
"pending_webhooks": 0,
"request": {
"id": null,
"idempotency_key": null
},
"type": "plan.created"
}