Retrieves the coupon with the given ID.
curl https://api.stripe.com/v1/coupons/25OFF \
-u STRIPE_SECRET_KEY:
var
rest: TChilkatRest;
success: Integer;
bTls: Integer;
port: Integer;
bAutoReconnect: Integer;
sbResponseBody: TChilkatStringBuilder;
jsonResponse: TChilkatJsonObject;
id: WideString;
object: WideString;
amount_off: Integer;
created: Integer;
currency: Integer;
duration: WideString;
duration_in_months: Integer;
livemode: Integer;
max_redemptions: Integer;
percent_off: Integer;
redeem_by: Integer;
times_redeemed: Integer;
valid: Integer;
begin
rest := TChilkatRest.Create(Self);
// URL: https://api.stripe.com/v1/coupons/25OFF
bTls := 1;
port := 443;
bAutoReconnect := 1;
success := rest.Connect('api.stripe.com',port,bTls,bAutoReconnect);
if (success <> 1) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(rest.ConnectFailReason));
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
rest.SetAuthBasic('STRIPE_SECRET_KEY','');
sbResponseBody := TChilkatStringBuilder.Create(Self);
success := rest.FullRequestNoBodySb('GET','/v1/coupons/25OFF',sbResponseBody.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
jsonResponse := TChilkatJsonObject.Create(Self);
jsonResponse.LoadSb(sbResponseBody.ControlInterface);
id := jsonResponse.StringOf('id');
object := jsonResponse.StringOf('object');
amount_off := jsonResponse.IsNullOf('amount_off');
created := jsonResponse.IntOf('created');
currency := jsonResponse.IsNullOf('currency');
duration := jsonResponse.StringOf('duration');
duration_in_months := jsonResponse.IntOf('duration_in_months');
livemode := jsonResponse.BoolOf('livemode');
max_redemptions := jsonResponse.IsNullOf('max_redemptions');
percent_off := jsonResponse.IntOf('percent_off');
redeem_by := jsonResponse.IsNullOf('redeem_by');
times_redeemed := jsonResponse.IntOf('times_redeemed');
valid := jsonResponse.BoolOf('valid');
{
"id": "25OFF",
"object": "coupon",
"amount_off": null,
"created": 1516662783,
"currency": null,
"duration": "repeating",
"duration_in_months": 3,
"livemode": false,
"max_redemptions": null,
"metadata": {},
"percent_off": 25,
"redeem_by": null,
"times_redeemed": 0,
"valid": true
}