Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
String sTemp1
Integer iTemp1
// 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 "x-payments-os-env" "{{x-payments-os-env}}"
Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
Send ComSetRequestHeader To hoHttp "app_id" "{{app_id}}"
Send ComSetRequestHeader To hoHttp "private_key" "{{private_key}}"
Send ComSetRequestHeader To hoHttp "idempotency_key" "{{$randomInt}}"
Send ComSetRequestHeader To hoHttp "api-version" "1.3.0"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://api.paymentsos.com/payments/{{paymentid}}/refunds/{{refundid}}" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComLastStatus Of hoHttp To iTemp1
Showln "Response status code = " iTemp1
Get ComGetAsString Of hoSbResponseBody To sTemp1
Showln sTemp1
End_Procedure
Curl Command
curl -X GET
-H "app_id: {{app_id}}"
-H "private_key: {{private_key}}"
-H "Content-Type: application/json"
-H "api-version: 1.3.0"
-H "x-payments-os-env: {{x-payments-os-env}}"
-H "idempotency_key: {{$randomInt}}"
https://api.paymentsos.com/payments/{{paymentid}}/refunds/{{refundid}}
Postman Collection Item JSON
{
"name": "4. GET Refund",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"postman.setEnvironmentVariable(\"authorizationid\", jsonData.id);"
]
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "app_id",
"value": "{{app_id}}"
},
{
"key": "private_key",
"value": "{{private_key}}"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "api-version",
"value": "1.3.0"
},
{
"key": "x-payments-os-env",
"value": "{{x-payments-os-env}}"
},
{
"key": "idempotency_key",
"value": "{{$randomInt}}"
}
],
"url": {
"raw": "https://api.paymentsos.com/payments/{{paymentid}}/refunds/{{refundid}}",
"protocol": "https",
"host": [
"api",
"paymentsos",
"com"
],
"path": [
"payments",
"{{paymentid}}",
"refunds",
"{{refundid}}"
]
},
"description": "Create a new authorization"
},
"response": [
]
}