Deletes a coupon.
curl https://api.stripe.com/v1/coupons/25OFF \
-u STRIPE_SECRET_KEY: \
-X DELETE
var
rest: TChilkatRest;
success: Integer;
bTls: Integer;
port: Integer;
bAutoReconnect: Integer;
sbResponseBody: TChilkatStringBuilder;
jsonResponse: TChilkatJsonObject;
deleted: Integer;
id: WideString;
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('DELETE','/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);
deleted := jsonResponse.BoolOf('deleted');
id := jsonResponse.StringOf('id');
{
"deleted": true,
"id": "25OFF"
}