Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
string ls_Url
string ls_ResponseStr
oleobject loo_JsonResp

li_Success = 0

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.BasicAuth = 1
loo_Http.Login = "API_USERNAME"
loo_Http.Password = "API_PASSWORD"

ls_Url = "https://<site>.cardconnect.com:<port>/cardconnect/rest/profile/<profile ID>/<account ID>/<merchid>"
ls_ResponseStr = loo_Http.QuickDeleteStr(ls_Url)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

// 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.
Write-Debug "response status code = " + string(loo_Http.LastStatus)

loo_JsonResp = create oleobject
li_rc = loo_JsonResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JsonResp.Load(ls_ResponseStr)
loo_JsonResp.EmitCompact = 0

Write-Debug "response JSON:"
Write-Debug loo_JsonResp.Emit()

// A successful response looks like this:

// {
//   "respproc": "PPS",
//   "resptext": "Profile Deleted",
//   "respstat": "A",
//   "respcode": "08"
// }
// 
// 


destroy loo_Http
destroy loo_JsonResp