Retrieves the line items for a given invoice.
curl https://api.stripe.com/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines?limit=5 \
-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 *object;
const char *url;
BOOL has_more;
int i;
int count_i;
const char *id;
int amount;
const char *currency;
const char *description;
BOOL discountable;
BOOL livemode;
int periodStart;
int periodEnd;
BOOL plan;
BOOL proration;
BOOL quantity;
BOOL subscription;
const char *type;
rest = CkRest_Create();
// URL: https://api.stripe.com/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines?limit=5
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/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines?limit=5",sbResponseBody);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
object = CkJsonObject_stringOf(jsonResponse,"object");
url = CkJsonObject_stringOf(jsonResponse,"url");
has_more = CkJsonObject_BoolOf(jsonResponse,"has_more");
i = 0;
count_i = CkJsonObject_SizeOfArray(jsonResponse,"data");
while (i < count_i) {
CkJsonObject_putI(jsonResponse,i);
id = CkJsonObject_stringOf(jsonResponse,"data[i].id");
object = CkJsonObject_stringOf(jsonResponse,"data[i].object");
amount = CkJsonObject_IntOf(jsonResponse,"data[i].amount");
currency = CkJsonObject_stringOf(jsonResponse,"data[i].currency");
description = CkJsonObject_stringOf(jsonResponse,"data[i].description");
discountable = CkJsonObject_BoolOf(jsonResponse,"data[i].discountable");
livemode = CkJsonObject_BoolOf(jsonResponse,"data[i].livemode");
periodStart = CkJsonObject_IntOf(jsonResponse,"data[i].period.start");
periodEnd = CkJsonObject_IntOf(jsonResponse,"data[i].period.end");
plan = CkJsonObject_IsNullOf(jsonResponse,"data[i].plan");
proration = CkJsonObject_BoolOf(jsonResponse,"data[i].proration");
quantity = CkJsonObject_IsNullOf(jsonResponse,"data[i].quantity");
subscription = CkJsonObject_IsNullOf(jsonResponse,"data[i].subscription");
type = CkJsonObject_stringOf(jsonResponse,"data[i].type");
i = i + 1;
}
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
}
{
"object": "list",
"url": "/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines",
"has_more": false,
"data": [
{
"id": "ii_1BnETLGswQrCoh0XhmXYb8CY",
"object": "line_item",
"amount": 1000,
"currency": "usd",
"description": "My First Invoice Item (created for API docs)",
"discountable": true,
"livemode": false,
"metadata": {},
"period": {
"start": 1516662783,
"end": 1516662783
},
"plan": null,
"proration": false,
"quantity": null,
"subscription": null,
"type": "invoiceitem"
}
]
}