Returns a list of all refunds you’ve previously created.
curl https://api.stripe.com/v1/refunds?limit=3 \
-u STRIPE_SECRET_KEY: \
-G
#include <CkRestW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
CkRestW rest;
bool success;
// URL: https://api.stripe.com/v1/refunds?limit=3
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect(L"api.stripe.com",port,bTls,bAutoReconnect);
if (success != true) {
wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
wprintf(L"%s\n",rest.lastErrorText());
return;
}
rest.SetAuthBasic(L"STRIPE_SECRET_KEY",L"");
CkStringBuilderW sbResponseBody;
success = rest.FullRequestNoBodySb(L"GET",L"/v1/refunds?limit=3",sbResponseBody);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
CkJsonObjectW jsonResponse;
jsonResponse.LoadSb(sbResponseBody);
const wchar_t *object = 0;
const wchar_t *url = 0;
bool has_more;
int i;
int count_i;
const wchar_t *id = 0;
int amount;
bool balance_transaction;
const wchar_t *charge = 0;
int created;
const wchar_t *currency = 0;
bool reason;
bool receipt_number;
const wchar_t *status = 0;
object = jsonResponse.stringOf(L"object");
url = jsonResponse.stringOf(L"url");
has_more = jsonResponse.BoolOf(L"has_more");
i = 0;
count_i = jsonResponse.SizeOfArray(L"data");
while (i < count_i) {
jsonResponse.put_I(i);
id = jsonResponse.stringOf(L"data[i].id");
object = jsonResponse.stringOf(L"data[i].object");
amount = jsonResponse.IntOf(L"data[i].amount");
balance_transaction = jsonResponse.IsNullOf(L"data[i].balance_transaction");
charge = jsonResponse.stringOf(L"data[i].charge");
created = jsonResponse.IntOf(L"data[i].created");
currency = jsonResponse.stringOf(L"data[i].currency");
reason = jsonResponse.IsNullOf(L"data[i].reason");
receipt_number = jsonResponse.IsNullOf(L"data[i].receipt_number");
status = jsonResponse.stringOf(L"data[i].status");
i = i + 1;
}
}
{
"object": "list",
"url": "/v1/refunds",
"has_more": false,
"data": [
{
"id": "re_1BnETKGswQrCoh0XT2qLx7S0",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_1BnETKGswQrCoh0XE7kJI2wj",
"created": 1516662782,
"currency": "usd",
"metadata": {},
"reason": null,
"receipt_number": null,
"status": "succeeded"
}
]
}