Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
Dim queryParams As New ChilkatJsonObject
success = queryParams.UpdateInt("page_size",1000)
success = queryParams.UpdateString("order","ASC")
success = queryParams.UpdateString("stage","CHARGEBACK")
success = queryParams.UpdateString("from_stage_time_created","2020-06-09")
http.SetRequestHeader "Content-Type","application/json"
http.SetRequestHeader "X-GP-Version","{{version}}"
' Adds the "Authorization: Bearer {{token}}" header.
http.AuthToken = "{{token}}"
http.SetRequestHeader "idempotency-key","12345"
http.SetRequestHeader "Accept","application/json"
Dim resp As ChilkatHttpResponse
Set resp = http.QuickRequestParams("GET","https://{{url}}/ucp/disputes",queryParams)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Debug.Print resp.StatusCode
Debug.Print resp.BodyStr
Curl Command
curl -G -d "page_size=1000"
-d "order=ASC"
-d "stage=CHARGEBACK"
-d "from_stage_time_created=2020-06-09"
-H "Content-Type: application/json"
-H "Authorization: Bearer {{token}}"
-H "Accept: application/json"
-H "X-GP-Version: {{version}}"
-H "idempotency-key: 12345"
https://{{url}}/ucp/disputes
Postman Collection Item JSON
{
"name": "DIA_1.0 Get Disputes List",
"event": [
{
"listen": "test",
"script": {
"exec": [
"\r",
"var totalAdjDebitAmount=0;\r",
"var totalAdjCreditAmount=0;\r",
"var totalAdjEvenAmount=0;\r",
"var totalAdjDebitCount=0;\r",
"var totalAdjCreditCount=0;\r",
"var totalAdjEvenCount=0;\r",
"var totalRecordCount=0;\r",
"var i=0;\r",
"\r",
"var jsonData = JSON.parse(responseBody);\r",
"\r",
"\r",
"for(i = 0; i < jsonData.disputes.length; i++) {\r",
"\r",
" var obj = jsonData.disputes[i];\r",
" fundingType = String(obj.last_adjustment_funding);\r",
" \r",
" if (fundingType == \"DEBIT\"){\r",
" totalAdjDebitAmount += parseInt(obj.last_adjustment_amount);\r",
" totalAdjDebitCount++;\r",
" }else if(fundingType == \"CREDIT\") {\r",
" totalAdjCreditAmount += parseInt(obj.last_adjustment_amount);\r",
" totalAdjCreditCount++;\r",
" \r",
" }else {\r",
" totalAdjEvenAmount += parseInt(obj.last_adjustment_amount);\r",
" totalAdjEvenCount++;\r",
" \r",
" }\r",
" totalRecordCount++;\r",
"}\r",
"\r",
"totalAdjCreditAmount = 0 - totalAdjCreditAmount;\r",
"\r",
"console.log(\"dr amt: \" + totalAdjDebitAmount);\r",
"console.log(\"dr cnt: \" + totalAdjDebitCount);\r",
"\r",
"console.log(\"cr amt: \" + totalAdjCreditAmount);\r",
"console.log(\"cr cnt: \" + totalAdjCreditCount);\r",
"\r",
"console.log(\"ev amt: \" + totalAdjEvenAmount);\r",
"console.log(\"ev cnt: \" + totalAdjEvenCount);\r",
"\r",
"console.log(\"ttl cnt: \" + totalRecordCount);\r",
"console.log(\"ttl amt (sum): \" + (totalAdjDebitAmount + totalAdjCreditAmount + totalAdjEvenAmount));\r",
"\r",
"console.log(\"ttl cnt (sum): \" + (totalAdjDebitCount + totalAdjCreditCount + totalAdjEvenCount));\r",
"\r",
"console.log(\"ttl cnt: \" + totalRecordCount);\r",
"console.log(\"ttl amt (sum): \" + (totalAdjDebitAmount + totalAdjCreditAmount));\r",
"\r",
"console.log(\"ttl cnt (sum): \" + (totalAdjDebitCount + totalAdjCreditCount));\r",
"\r",
"console.log(\" ********** \");\r",
"\r",
"\r",
"tests[\"Response time is acceptable\"] = _.inRange(responseTime, 100, 1500); \r",
"\r",
"\r",
"pm.test(\"Successful POST request\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201,202]);\r",
"});\r",
"\r",
"pm.test(\"Status code name has string\", function () {\r",
" pm.response.to.have.status(\"OK\");\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "X-GP-Version",
"value": "{{version}}",
"type": "text"
},
{
"key": "idempotency-key",
"value": "12345",
"type": "text"
}
],
"url": {
"raw": "https://{{url}}/ucp/disputes?page_size=1000&order=ASC&stage=CHARGEBACK&from_stage_time_created=2020-06-09",
"protocol": "https",
"host": [
"{{url}}"
],
"path": [
"ucp",
"disputes"
],
"query": [
{
"key": "page_size",
"value": "1000"
},
{
"key": "to_stage_time_created",
"value": "2020-01-29",
"disabled": true
},
{
"key": "from_adjustment_time_created",
"value": "2020-01-01",
"disabled": true
},
{
"key": "to_adjustment_time_created",
"value": "2020-03-31",
"disabled": true
},
{
"key": "order_by",
"value": "id",
"disabled": true
},
{
"key": "order",
"value": "ASC"
},
{
"key": "last_adjustment_funding",
"value": "CREDIT",
"disabled": true
},
{
"key": "result",
"value": "WON",
"disabled": true
},
{
"key": "stage",
"value": "CHARGEBACK"
},
{
"key": "stage",
"value": "REVERSAL",
"disabled": true
},
{
"key": "stage",
"value": "SECOND_CHARGEBACK",
"disabled": true
},
{
"key": "id",
"value": "",
"disabled": true
},
{
"key": "system.mid",
"value": "",
"disabled": true
},
{
"key": "to_stage_time_created",
"value": "2020-03-31",
"disabled": true
},
{
"key": "system.hierarchy",
"value": "",
"disabled": true
},
{
"key": "from_stage_time_created",
"value": "2020-06-09"
},
{
"key": "from_status_time_created",
"value": "2020-07-25",
"disabled": true
},
{
"key": "order_by",
"value": "arn",
"disabled": true
}
]
},
"description": "This request retrieves all disputes from GP that have been made by a Payer or a Payer's Bank. User can pass in certain criteria in the query string in order to return specific types of disputes such as:\r\n- Chargebacks\r\n- Retrieval\r\n- Reversal\r\n- Arbitration\r\n- & more\r\n\r\nTo see further criteria, visit https://developer.globalpay.com/api/disputes#/Disputes/get_disputes\r\n\r\nAdditionally, the user can change page size, how the response is ordered and change the date from when the disputes date back too.\r\n\r\n\r\nIn the response received back, you will see the merchant_id along with the disputes and their reason code/description for the dispute."
},
"response": [
]
}