Returns a list of charges you’ve previously created. The charges are returned in sorted order, with the most recent charges appearing first.
curl https://api.stripe.com/v1/charges?limit=3 \
-u STRIPE_SECRET_KEY: \
-G
var
rest: HCkRest;
success: Boolean;
bTls: Boolean;
port: Integer;
bAutoReconnect: Boolean;
sbResponseBody: HCkStringBuilder;
jsonResponse: HCkJsonObject;
object: PWideChar;
url: PWideChar;
has_more: Boolean;
i: Integer;
count_i: Integer;
id: PWideChar;
amount: Integer;
amount_refunded: Integer;
application: Boolean;
application_fee: Boolean;
balance_transaction: PWideChar;
captured: Boolean;
created: Integer;
currency: PWideChar;
customer: Boolean;
description: PWideChar;
destination: Boolean;
dispute: Boolean;
failure_code: Boolean;
failure_message: Boolean;
invoice: Boolean;
livemode: Boolean;
on_behalf_of: Boolean;
order: Boolean;
outcome: Boolean;
paid: Boolean;
receipt_email: Boolean;
receipt_number: Boolean;
refunded: Boolean;
refundsObject: PWideChar;
refundsHas_more: Boolean;
refundsTotal_count: Integer;
refundsUrl: PWideChar;
review: Boolean;
shipping: Boolean;
sourceId: PWideChar;
sourceObject: PWideChar;
sourceAddress_city: Boolean;
sourceAddress_country: Boolean;
sourceAddress_line1: Boolean;
sourceAddress_line1_check: Boolean;
sourceAddress_line2: Boolean;
sourceAddress_state: Boolean;
sourceAddress_zip: Boolean;
sourceAddress_zip_check: Boolean;
sourceBrand: PWideChar;
sourceCountry: PWideChar;
sourceCustomer: Boolean;
sourceCvc_check: Boolean;
sourceDynamic_last4: Boolean;
sourceExp_month: Integer;
sourceExp_year: Integer;
sourceFingerprint: PWideChar;
sourceFunding: PWideChar;
sourceLast4: PWideChar;
sourceName: Boolean;
sourceTokenization_method: Boolean;
source_transfer: Boolean;
statement_descriptor: Boolean;
status: PWideChar;
transfer_group: Boolean;
j: Integer;
count_j: Integer;
begin
rest := CkRest_Create();
// URL: https://api.stripe.com/v1/charges?limit=3
bTls := True;
port := 443;
bAutoReconnect := True;
success := CkRest_Connect(rest,'api.stripe.com',port,bTls,bAutoReconnect);
if (success <> True) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
CkRest_SetAuthBasic(rest,'STRIPE_SECRET_KEY','');
sbResponseBody := CkStringBuilder_Create();
success := CkRest_FullRequestNoBodySb(rest,'GET','/v1/charges?limit=3',sbResponseBody);
if (success <> True) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
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 do
begin
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');
amount_refunded := CkJsonObject_IntOf(jsonResponse,'data[i].amount_refunded');
application := CkJsonObject_IsNullOf(jsonResponse,'data[i].application');
application_fee := CkJsonObject_IsNullOf(jsonResponse,'data[i].application_fee');
balance_transaction := CkJsonObject__stringOf(jsonResponse,'data[i].balance_transaction');
captured := CkJsonObject_BoolOf(jsonResponse,'data[i].captured');
created := CkJsonObject_IntOf(jsonResponse,'data[i].created');
currency := CkJsonObject__stringOf(jsonResponse,'data[i].currency');
customer := CkJsonObject_IsNullOf(jsonResponse,'data[i].customer');
description := CkJsonObject__stringOf(jsonResponse,'data[i].description');
destination := CkJsonObject_IsNullOf(jsonResponse,'data[i].destination');
dispute := CkJsonObject_IsNullOf(jsonResponse,'data[i].dispute');
failure_code := CkJsonObject_IsNullOf(jsonResponse,'data[i].failure_code');
failure_message := CkJsonObject_IsNullOf(jsonResponse,'data[i].failure_message');
invoice := CkJsonObject_IsNullOf(jsonResponse,'data[i].invoice');
livemode := CkJsonObject_BoolOf(jsonResponse,'data[i].livemode');
on_behalf_of := CkJsonObject_IsNullOf(jsonResponse,'data[i].on_behalf_of');
order := CkJsonObject_IsNullOf(jsonResponse,'data[i].order');
outcome := CkJsonObject_IsNullOf(jsonResponse,'data[i].outcome');
paid := CkJsonObject_BoolOf(jsonResponse,'data[i].paid');
receipt_email := CkJsonObject_IsNullOf(jsonResponse,'data[i].receipt_email');
receipt_number := CkJsonObject_IsNullOf(jsonResponse,'data[i].receipt_number');
refunded := CkJsonObject_BoolOf(jsonResponse,'data[i].refunded');
refundsObject := CkJsonObject__stringOf(jsonResponse,'data[i].refunds.object');
refundsHas_more := CkJsonObject_BoolOf(jsonResponse,'data[i].refunds.has_more');
refundsTotal_count := CkJsonObject_IntOf(jsonResponse,'data[i].refunds.total_count');
refundsUrl := CkJsonObject__stringOf(jsonResponse,'data[i].refunds.url');
review := CkJsonObject_IsNullOf(jsonResponse,'data[i].review');
shipping := CkJsonObject_IsNullOf(jsonResponse,'data[i].shipping');
sourceId := CkJsonObject__stringOf(jsonResponse,'data[i].source.id');
sourceObject := CkJsonObject__stringOf(jsonResponse,'data[i].source.object');
sourceAddress_city := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_city');
sourceAddress_country := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_country');
sourceAddress_line1 := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_line1');
sourceAddress_line1_check := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_line1_check');
sourceAddress_line2 := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_line2');
sourceAddress_state := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_state');
sourceAddress_zip := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_zip');
sourceAddress_zip_check := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.address_zip_check');
sourceBrand := CkJsonObject__stringOf(jsonResponse,'data[i].source.brand');
sourceCountry := CkJsonObject__stringOf(jsonResponse,'data[i].source.country');
sourceCustomer := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.customer');
sourceCvc_check := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.cvc_check');
sourceDynamic_last4 := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.dynamic_last4');
sourceExp_month := CkJsonObject_IntOf(jsonResponse,'data[i].source.exp_month');
sourceExp_year := CkJsonObject_IntOf(jsonResponse,'data[i].source.exp_year');
sourceFingerprint := CkJsonObject__stringOf(jsonResponse,'data[i].source.fingerprint');
sourceFunding := CkJsonObject__stringOf(jsonResponse,'data[i].source.funding');
sourceLast4 := CkJsonObject__stringOf(jsonResponse,'data[i].source.last4');
sourceName := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.name');
sourceTokenization_method := CkJsonObject_IsNullOf(jsonResponse,'data[i].source.tokenization_method');
source_transfer := CkJsonObject_IsNullOf(jsonResponse,'data[i].source_transfer');
statement_descriptor := CkJsonObject_IsNullOf(jsonResponse,'data[i].statement_descriptor');
status := CkJsonObject__stringOf(jsonResponse,'data[i].status');
transfer_group := CkJsonObject_IsNullOf(jsonResponse,'data[i].transfer_group');
j := 0;
count_j := CkJsonObject_SizeOfArray(jsonResponse,'data[i].refunds.data');
while j < count_j do
begin
CkJsonObject_putJ(jsonResponse,j);
j := j + 1;
end;
i := i + 1;
end;
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
{
"object": "list",
"url": "/v1/charges",
"has_more": false,
"data": [
{
"id": "ch_1BnETJGswQrCoh0XTs0EERBj",
"object": "charge",
"amount": 100,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"balance_transaction": "txn_1BnETJGswQrCoh0XxO2tGYr7",
"captured": false,
"created": 1516662781,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"destination": null,
"dispute": null,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"receipt_email": null,
"receipt_number": null,
"refunded": false,
"refunds": {
"object": "list",
"data": [
],
"has_more": false,
"total_count": 0,
"url": "/v1/charges/ch_1BnETJGswQrCoh0XTs0EERBj/refunds"
},
"review": null,
"shipping": null,
"source": {
"id": "card_18ropuGswQrCoh0XjCJ5Zvma",
"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": null,
"cvc_check": null,
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2017,
"fingerprint": "F9mANtIt1TaukpRJ",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
"source_transfer": null,
"statement_descriptor": null,
"status": "succeeded",
"transfer_group": null
}
]
}