Chilkat Online Tools

C# / GP-API Collection / TRA_12.2 EBT Refund

Back to Collection Items

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

Chilkat.Http http = new Chilkat.Http();
bool success;

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

Chilkat.HttpResponse resp = http.QuickRequest("POST","https://{{url}}/ucp/transactions/{{trn_id}}/refund");
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine(Convert.ToString(resp.StatusCode));
Debug.WriteLine(resp.BodyStr);

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": [
  ]
}