Chilkat Online Tools

DataFlex / GP-API Collection / TRA_9.1 Batch Close

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
    Send ComSetRequestHeader To hoHttp "X-GP-Version" "2020-12-22"
    // Adds the "Authorization: Bearer {{token}}" header.
    Set ComAuthToken Of hoHttp To "{{token}}"
    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get ComQuickRequest Of hoHttp "POST" "https://apis.sandbox.globalpay.com/ucp/batches/BAT_611718-215" To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1
    Send Destroy of hoResp


End_Procedure

Curl Command

curl -X POST
	-H "Authorization: Bearer {{token}}"
	-H "Accept: application/json"
	-H "X-GP-Version: 2020-12-22"
	-H "Content-Type: application/json"
https://apis.sandbox.globalpay.com/ucp/batches/BAT_611718-215

Postman Collection Item JSON

{
  "name": "TRA_9.1 Batch Close",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}"
      },
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "X-GP-Version",
        "value": "2020-12-22"
      },
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "https://apis.sandbox.globalpay.com/ucp/batches/BAT_611718-215",
      "protocol": "https",
      "host": [
        "apis",
        "sandbox",
        "globalpay",
        "com"
      ],
      "path": [
        "ucp",
        "batches",
        "BAT_611718-215"
      ]
    },
    "description": "This request closes a batch. It requires the batch id from the response to the authroized transaction. It is then inputed into Query URL."
  },
  "response": [
  ]
}