Back to Collection Items
Use ChilkatAx-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 "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 ComQuickRequest Of hoHttp "POST" "https://api.paymentsos.com/payments/{{paymentid}}/voids" 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 "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}}/voids
Postman Collection Item JSON
{
"name": "4. Create Void",
"request": {
"method": "POST",
"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}}"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://api.paymentsos.com/payments/{{paymentid}}/voids",
"protocol": "https",
"host": [
"api",
"paymentsos",
"com"
],
"path": [
"payments",
"{{paymentid}}",
"voids"
]
},
"description": "Create a void"
},
"response": [
]
}