PureBasic
PureBasic
CardConnect Delete Profile
See more CardConnect Examples
Demonstrates how to delete a profile.A DELETE request to the profile endpoint deletes the stored data for the specified profile ID. ...
See https://developer.cardconnect.com/cardconnect-api?lang=json#delete-profile-request
Chilkat PureBasic Downloads
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
success.i = 0
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttp::setCkBasicAuth(http, 1)
CkHttp::setCkLogin(http, "API_USERNAME")
CkHttp::setCkPassword(http, "API_PASSWORD")
url.s = "https://<site>.cardconnect.com:<port>/cardconnect/rest/profile/<profile ID>/<account ID>/<merchid>"
responseStr.s = CkHttp::ckQuickDeleteStr(http,url)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
; A response status of 200 indicates potential success. The JSON response body
; must be examined to determine if it was truly successful or an error.
Debug "response status code = " + Str(CkHttp::ckLastStatus(http))
jsonResp.i = CkJsonObject::ckCreate()
If jsonResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoad(jsonResp,responseStr)
CkJsonObject::setCkEmitCompact(jsonResp, 0)
Debug "response JSON:"
Debug CkJsonObject::ckEmit(jsonResp)
; A successful response looks like this:
; {
; "respproc": "PPS",
; "resptext": "Profile Deleted",
; "respstat": "A",
; "respcode": "08"
; }
;
;
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(jsonResp)
ProcedureReturn
EndProcedure