VB.NET UWP/WinRT Stripe: Delete a Customer Discount

Back to Index

Removes the currently applied discount on a customer.

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

CURL Command

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

VB.NET UWP/WinRT Example

Dim rest As New Chilkat.Rest
Dim success As Boolean

'  URL: https://api.stripe.com/v1/customers/cus_CBbg9PmQ9sLbmo/discount
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
success = Await rest.ConnectAsync("api.stripe.com",port,bTls,bAutoReconnect)
If (success <> True) Then
    Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


rest.SetAuthBasic("STRIPE_SECRET_KEY","")


Dim sbResponseBody As New Chilkat.StringBuilder
success = Await rest.FullRequestNoBodySbAsync("DELETE","/v1/customers/cus_CBbg9PmQ9sLbmo/discount",sbResponseBody)
If (success <> True) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


Dim jsonResponse As New Chilkat.JsonObject
jsonResponse.LoadSb(sbResponseBody)

Dim deleted As Boolean
Dim id As String

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

Sample JSON Response Body

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