Excel Stripe: Delete a Customer Subscription Discount

Back to Index

Removes the currently applied discount on a subscription.

Documentation: https://stripe.com/docs/api/curl#delete_subscription_discount

CURL Command

curl https://api.stripe.com/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount \
   -u STRIPE_SECRET_KEY: \
   -X DELETE

Excel Example

Dim rest As Chilkat.Rest
Set rest = Chilkat.NewRest

'  URL: https://api.stripe.com/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount

bTls = True

port = 443

bAutoReconnect = True
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> True) Then
    Debug.Print "ConnectFailReason: "; rest.ConnectFailReason
    Debug.Print rest.LastErrorText
    Exit Sub
End If

success = rest.SetAuthBasic("STRIPE_SECRET_KEY","")

Dim sbResponseBody As Chilkat.StringBuilder
Set sbResponseBody = Chilkat.NewStringBuilder
success = rest.FullRequestNoBodySb("DELETE","/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount",sbResponseBody)
If (success <> True) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim jsonResponse As Chilkat.JsonObject
Set jsonResponse = Chilkat.NewJsonObject
success = jsonResponse.LoadSb(sbResponseBody)

deleted = jsonResponse.BoolOf("deleted")
id = jsonResponse.StringOf("id")

Sample JSON Response Body

{
  "deleted": true,
  "id": "di_1BnETLGswQrCoh0Xe991uMc7"
}