List the cards belonging to a customer or recipient.
curl "https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources?object=card&limit=3" \
-u STRIPE_SECRET_KEY: \
-G
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/customers/cus_CBbg3iRMzWBjoe/sources?object=card&limit=3
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/customers/cus_CBbg3iRMzWBjoe/sources?object=card&limit=3",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;
boolean address_city;
boolean address_country;
boolean address_line1;
boolean address_line1_check;
boolean address_line2;
boolean address_state;
boolean address_zip;
boolean address_zip_check;
String brand;
String country;
String customer;
boolean cvc_check;
boolean dynamic_last4;
int exp_month;
int exp_year;
String fingerprint;
String funding;
String last4;
boolean name;
boolean tokenization_method;
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");
address_city = jsonResponse.IsNullOf("data[i].address_city");
address_country = jsonResponse.IsNullOf("data[i].address_country");
address_line1 = jsonResponse.IsNullOf("data[i].address_line1");
address_line1_check = jsonResponse.IsNullOf("data[i].address_line1_check");
address_line2 = jsonResponse.IsNullOf("data[i].address_line2");
address_state = jsonResponse.IsNullOf("data[i].address_state");
address_zip = jsonResponse.IsNullOf("data[i].address_zip");
address_zip_check = jsonResponse.IsNullOf("data[i].address_zip_check");
brand = jsonResponse.stringOf("data[i].brand");
country = jsonResponse.stringOf("data[i].country");
customer = jsonResponse.stringOf("data[i].customer");
cvc_check = jsonResponse.IsNullOf("data[i].cvc_check");
dynamic_last4 = jsonResponse.IsNullOf("data[i].dynamic_last4");
exp_month = jsonResponse.IntOf("data[i].exp_month");
exp_year = jsonResponse.IntOf("data[i].exp_year");
fingerprint = jsonResponse.stringOf("data[i].fingerprint");
funding = jsonResponse.stringOf("data[i].funding");
last4 = jsonResponse.stringOf("data[i].last4");
name = jsonResponse.IsNullOf("data[i].name");
tokenization_method = jsonResponse.IsNullOf("data[i].tokenization_method");
i = i+1;
}
}
}
{
"object": "list",
"url": "/v1/customers/cus_CBbg3iRMzWBjoe/sources",
"has_more": false,
"data": [
{
"id": "card_1BnETKGswQrCoh0Xhu1A6BfL",
"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",
"customer": "cus_CBbg3iRMzWBjoe",
"cvc_check": null,
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2019,
"fingerprint": "F9mANtIt1TaukpRJ",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
}
]
}