Retrieves the coupon with the given ID.
curl https://api.stripe.com/v1/coupons/25OFF \
-u STRIPE_SECRET_KEY:
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_SbResponseBody
oleobject loo_JsonResponse
string ls_Id
string ls_Object
integer li_Amount_off
integer li_Created
integer li_Currency
string ls_Duration
integer li_Duration_in_months
integer li_Livemode
integer li_Max_redemptions
integer li_Percent_off
integer li_Redeem_by
integer li_Times_redeemed
integer li_Valid
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://api.stripe.com/v1/coupons/25OFF
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("api.stripe.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_Rest.SetAuthBasic("STRIPE_SECRET_KEY","")
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestNoBodySb("GET","/v1/coupons/25OFF",loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_SbResponseBody
return
end if
loo_JsonResponse = create oleobject
li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JsonResponse.LoadSb(loo_SbResponseBody)
ls_Id = loo_JsonResponse.StringOf("id")
ls_Object = loo_JsonResponse.StringOf("object")
li_Amount_off = loo_JsonResponse.IsNullOf("amount_off")
li_Created = loo_JsonResponse.IntOf("created")
li_Currency = loo_JsonResponse.IsNullOf("currency")
ls_Duration = loo_JsonResponse.StringOf("duration")
li_Duration_in_months = loo_JsonResponse.IntOf("duration_in_months")
li_Livemode = loo_JsonResponse.BoolOf("livemode")
li_Max_redemptions = loo_JsonResponse.IsNullOf("max_redemptions")
li_Percent_off = loo_JsonResponse.IntOf("percent_off")
li_Redeem_by = loo_JsonResponse.IsNullOf("redeem_by")
li_Times_redeemed = loo_JsonResponse.IntOf("times_redeemed")
li_Valid = loo_JsonResponse.BoolOf("valid")
destroy loo_Rest
destroy loo_SbResponseBody
destroy loo_JsonResponse
{
"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
}