Visual Basic 6.0 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

Visual Basic 6.0 Example

Dim rest As New ChilkatRest
Dim success As Long

'  URL: https://api.stripe.com/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount
Dim bTls As Long
bTls = 1
Dim port As Long
port = 443
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> 1) Then
    Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
    Debug.Print rest.LastErrorText
    Exit Sub
End If

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

Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("DELETE","/v1/subscriptions/sub_CBbgnZGMJwa9ta/discount",sbResponseBody)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim jsonResponse As New ChilkatJsonObject
success = jsonResponse.LoadSb(sbResponseBody)

Dim deleted As Long
Dim id As String

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

Sample JSON Response Body

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