Chilkat Online Tools

Foxpro / GP-API Collection / TRA_12.2 EBT Refund

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loResp

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

loHttp = CreateObject('Chilkat_9_5_0.Http')

loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("X-GP-Version","{{version}}")
* Adds the "Authorization: Bearer {{token}}" header.
loHttp.AuthToken = "{{token}}"
loHttp.SetRequestHeader("Accept","application/json")

loResp = loHttp.QuickRequest("POST","https://{{url}}/ucp/transactions/{{trn_id}}/refund")
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    CANCEL
ENDIF

? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp

RELEASE loHttp

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Authorization: Bearer {{token}}"
	-H "Accept: application/json"
	-H "X-GP-Version: {{version}}"
https://{{url}}/ucp/transactions/{{trn_id}}/refund

Postman Collection Item JSON

{
  "name": "TRA_12.2 EBT Refund",
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          "var str = String(\"00000000\"+ Math.floor(Math.random()*100000000) + 1).slice(-8);\r",
          "\r",
          "pm.environment.set(\"reference\",str);"
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "auth": {
      "type": "noauth"
    },
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      },
      {
        "key": "Accept",
        "value": "application/json",
        "type": "text"
      },
      {
        "key": "X-GP-Version",
        "value": "{{version}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://{{url}}/ucp/transactions/{{trn_id}}/refund",
      "protocol": "https",
      "host": [
        "{{url}}"
      ],
      "path": [
        "ucp",
        "transactions",
        "{{trn_id}}",
        "refund"
      ]
    }
  },
  "response": [
  ]
}