Retrieves the line items for a given invoice.
curl https://api.stripe.com/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines?limit=5 \
-u STRIPE_SECRET_KEY:
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkRest rest = new CkRest();
boolean success;
// URL: https://api.stripe.com/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines?limit=5
boolean bTls = true;
int port = 443;
boolean bAutoReconnect = true;
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect);
if (success != true) {
System.out.println("ConnectFailReason: " + rest.get_ConnectFailReason());
System.out.println(rest.lastErrorText());
return;
}
rest.SetAuthBasic("STRIPE_SECRET_KEY","");
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = rest.FullRequestNoBodySb("GET","/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines?limit=5",sbResponseBody);
if (success != true) {
System.out.println(rest.lastErrorText());
return;
}
CkJsonObject jsonResponse = new CkJsonObject();
jsonResponse.LoadSb(sbResponseBody);
String object;
String url;
boolean has_more;
int i;
int count_i;
String id;
int amount;
String currency;
String description;
boolean discountable;
boolean livemode;
int periodStart;
int periodEnd;
boolean plan;
boolean proration;
boolean quantity;
boolean subscription;
String type;
object = jsonResponse.stringOf("object");
url = jsonResponse.stringOf("url");
has_more = jsonResponse.BoolOf("has_more");
i = 0;
count_i = jsonResponse.SizeOfArray("data");
while (i < count_i) {
jsonResponse.put_I(i);
id = jsonResponse.stringOf("data[i].id");
object = jsonResponse.stringOf("data[i].object");
amount = jsonResponse.IntOf("data[i].amount");
currency = jsonResponse.stringOf("data[i].currency");
description = jsonResponse.stringOf("data[i].description");
discountable = jsonResponse.BoolOf("data[i].discountable");
livemode = jsonResponse.BoolOf("data[i].livemode");
periodStart = jsonResponse.IntOf("data[i].period.start");
periodEnd = jsonResponse.IntOf("data[i].period.end");
plan = jsonResponse.IsNullOf("data[i].plan");
proration = jsonResponse.BoolOf("data[i].proration");
quantity = jsonResponse.IsNullOf("data[i].quantity");
subscription = jsonResponse.IsNullOf("data[i].subscription");
type = jsonResponse.stringOf("data[i].type");
i = i+1;
}
}
}
{
"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"
}
]
}