Retrieves the coupon with the given ID.
curl https://api.stripe.com/v1/coupons/25OFF \
-u STRIPE_SECRET_KEY:
var os = require('os');
if (os.platform() == 'win32') {
var chilkat = require('chilkat_node6_win32');
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('chilkat_node6_arm');
} else if (os.arch() == 'x86') {
var chilkat = require('chilkat_node6_linux32');
} else {
var chilkat = require('chilkat_node6_linux64');
}
} else if (os.platform() == 'darwin') {
var chilkat = require('chilkat_node6_macosx');
}
function chilkatExample() {
var rest = new chilkat.Rest();
var success;
// URL: https://api.stripe.com/v1/coupons/25OFF
var bTls = true;
var port = 443;
var bAutoReconnect = true;
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect);
if (success !== true) {
console.log("ConnectFailReason: " + rest.ConnectFailReason);
console.log(rest.LastErrorText);
return;
}
rest.SetAuthBasic("STRIPE_SECRET_KEY","");
var sbResponseBody = new chilkat.StringBuilder();
success = rest.FullRequestNoBodySb("GET","/v1/coupons/25OFF",sbResponseBody);
if (success !== true) {
console.log(rest.LastErrorText);
return;
}
var jsonResponse = new chilkat.JsonObject();
jsonResponse.LoadSb(sbResponseBody);
var id;
var object;
var amount_off;
var created;
var currency;
var duration;
var duration_in_months;
var livemode;
var max_redemptions;
var percent_off;
var redeem_by;
var times_redeemed;
var valid;
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");
}
chilkatExample();
{
"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
}