Removes the currently applied discount on a subscription.
curl https://api.stripe.com/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount \
-u STRIPE_SECRET_KEY: \
-X DELETE
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkStringBuilder sbResponseBody;
HCkJsonObject jsonResponse;
BOOL deleted;
const char *id;
rest = CkRest_Create();
// URL: https://api.stripe.com/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRest_Connect(rest,"api.stripe.com",port,bTls,bAutoReconnect);
if (success != TRUE) {
printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
CkRest_SetAuthBasic(rest,"STRIPE_SECRET_KEY","");
sbResponseBody = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"DELETE","/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount",sbResponseBody);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jsonResponse = CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
deleted = CkJsonObject_BoolOf(jsonResponse,"deleted");
id = CkJsonObject_stringOf(jsonResponse,"id");
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
}
{
"deleted": true,
"id": "di_1BnETLGswQrCoh0Xe991uMc7"
}