Excel Stripe: Delete a Card

Back to Index

Deletes a customer credit card.

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

CURL Command

curl https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/card_1BnETKGswQrCoh0Xhu1A6BfL \
   -u STRIPE_SECRET_KEY: \
   -X DELETE

Excel Example

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

'  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/card_1BnETKGswQrCoh0Xhu1A6BfL

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/customers/cus_CBbg3iRMzWBjoe/sources/card_1BnETKGswQrCoh0Xhu1A6BfL",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": "card_1BnETKGswQrCoh0Xhu1A6BfL"
}