Objective-C Stripe: Retrieve an Event

Back to Index

Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook.

Documentation: https://stripe.com/docs/api/curl#retrieve_event

CURL Command

curl https://api.stripe.com/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB \

Objective-C Example

#import <CkoRest.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>

CkoRest *rest = [[CkoRest alloc] init];
BOOL success;

//  URL: https://api.stripe.com/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"api.stripe.com" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
    NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);

[rest SetAuthBasic: @"STRIPE_SECRET_KEY" password: @""];

CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/v1/events/evt_1BnETJGswQrCoh0XAl7jSmFB" sb: sbResponseBody];
if (success != YES) {

CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init];
[jsonResponse LoadSb: sbResponseBody];

NSString *id = 0;
NSString *object = 0;
BOOL api_version;
int created;
NSString *dataObjectId = 0;
NSString *dataObjectObject = 0;
int dataObjectAmount;
int dataObjectCreated;
NSString *dataObjectCurrency = 0;
NSString *dataObjectInterval = 0;
int dataObjectInterval_count;
BOOL dataObjectLivemode;
NSString *dataObjectName = 0;
BOOL dataObjectStatement_descriptor;
BOOL dataObjectTrial_period_days;
BOOL livemode;
int pending_webhooks;
BOOL requestId;
BOOL requestIdempotency_key;
NSString *type = 0;

id = [jsonResponse StringOf: @"id"];
object = [jsonResponse StringOf: @"object"];
api_version = [jsonResponse IsNullOf: @"api_version"];
created = [[jsonResponse IntOf: @"created"] intValue];
dataObjectId = [jsonResponse StringOf: @"data.object.id"];
dataObjectObject = [jsonResponse StringOf: @"data.object.object"];
dataObjectAmount = [[jsonResponse IntOf: @"data.object.amount"] intValue];
dataObjectCreated = [[jsonResponse IntOf: @"data.object.created"] intValue];
dataObjectCurrency = [jsonResponse StringOf: @"data.object.currency"];
dataObjectInterval = [jsonResponse StringOf: @"data.object.interval"];
dataObjectInterval_count = [[jsonResponse IntOf: @"data.object.interval_count"] intValue];
dataObjectLivemode = [jsonResponse BoolOf: @"data.object.livemode"];
dataObjectName = [jsonResponse StringOf: @"data.object.name"];
dataObjectStatement_descriptor = [jsonResponse IsNullOf: @"data.object.statement_descriptor"];
dataObjectTrial_period_days = [jsonResponse IsNullOf: @"data.object.trial_period_days"];
livemode = [jsonResponse BoolOf: @"livemode"];
pending_webhooks = [[jsonResponse IntOf: @"pending_webhooks"] intValue];
requestId = [jsonResponse IsNullOf: @"request.id"];
requestIdempotency_key = [jsonResponse IsNullOf: @"request.idempotency_key"];
type = [jsonResponse StringOf: @"type"];

Sample JSON Response Body

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