Chilkat Online Tools

DataFlex / Bond APIs / create a dispute

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vJson
    Handle hoJson
    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

    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "customer_id": "{{customer_id}}",
    //   "transaction_id": "{{transaction_id}}",
    //   "email": "no-reply@bond.tech",
    //   "phone": "1234567890",
    //   "dispute_reason": "FRAUD",
    //   "dispute_details": "card stolen",
    //   "file_attachments": [
    //     {
    //       "filename": "screenshot",
    //       "file": "ewogICJkaXNwdXRlX2lkIjogIjA2YzMzZTMxLTA4MTEtNDZhZC05NTg4LTljNWQwOTUzNzM3MiIsCiAgImRpc3B1dGVfc3RhdHVzIjogInN1Ym1pdHRlZCIKfQ=="
    //     }
    //   ]
    // }

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateString Of hoJson "customer_id" "{{customer_id}}" To iSuccess
    Get ComUpdateString Of hoJson "transaction_id" "{{transaction_id}}" To iSuccess
    Get ComUpdateString Of hoJson "email" "no-reply@bond.tech" To iSuccess
    Get ComUpdateString Of hoJson "phone" "1234567890" To iSuccess
    Get ComUpdateString Of hoJson "dispute_reason" "FRAUD" To iSuccess
    Get ComUpdateString Of hoJson "dispute_details" "card stolen" To iSuccess
    Get ComUpdateString Of hoJson "file_attachments[0].filename" "screenshot" To iSuccess
    Get ComUpdateString Of hoJson "file_attachments[0].file" "ewogICJkaXNwdXRlX2lkIjogIjA2YzMzZTMxLTA4MTEtNDZhZC05NTg4LTljNWQwOTUzNzM3MiIsCiAgImRpc3B1dGVfc3RhdHVzIjogInN1Ym1pdHRlZCIKfQ==" To iSuccess

    Send ComSetRequestHeader To hoHttp "Authorization" "{{authorization}}"
    Send ComSetRequestHeader To hoHttp "Identity" "{{identity}}"

    Get pvComObject of hoJson to vJson
    Get ComPostJson3 Of hoHttp "https://{{environment}}.bond.tech/api/v0/disputes" "application/json" vJson 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: {{authorization}}"
	-H "Identity: {{identity}}"
	-d '{
  "customer_id": "{{customer_id}}",
  "transaction_id": "{{transaction_id}}",
  "email": "no-reply@bond.tech",
  "phone": "1234567890",
  "dispute_reason": "FRAUD",
  "dispute_details": "card stolen",
  "file_attachments" :[
      {
      "filename": "screenshot",
      "file": "ewogICJkaXNwdXRlX2lkIjogIjA2YzMzZTMxLTA4MTEtNDZhZC05NTg4LTljNWQwOTUzNzM3MiIsCiAgImRpc3B1dGVfc3RhdHVzIjogInN1Ym1pdHRlZCIKfQ=="
        }
    ]
}'
https://{{environment}}.bond.tech/api/v0/disputes

Postman Collection Item JSON

{
  "name": "create a dispute",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Authorization",
        "value": "{{authorization}}",
        "type": "text"
      },
      {
        "key": "Identity",
        "value": "{{identity}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"customer_id\": \"{{customer_id}}\",\n  \"transaction_id\": \"{{transaction_id}}\",\n  \"email\": \"no-reply@bond.tech\",\n  \"phone\": \"1234567890\",\n  \"dispute_reason\": \"FRAUD\",\n  \"dispute_details\": \"card stolen\",\n  \"file_attachments\" :[\n      {\n      \"filename\": \"screenshot\",\n      \"file\": \"ewogICJkaXNwdXRlX2lkIjogIjA2YzMzZTMxLTA4MTEtNDZhZC05NTg4LTljNWQwOTUzNzM3MiIsCiAgImRpc3B1dGVfc3RhdHVzIjogInN1Ym1pdHRlZCIKfQ==\"\n        }\n    ]\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://{{environment}}.bond.tech/api/v0/disputes",
      "protocol": "https",
      "host": [
        "{{environment}}",
        "bond",
        "tech"
      ],
      "path": [
        "api",
        "v0",
        "disputes"
      ],
      "query": [
        {
          "key": "page",
          "value": "2",
          "disabled": true
        },
        {
          "key": "per_page",
          "value": "5",
          "disabled": true
        }
      ]
    },
    "description": "Retrieve Card to Card Transfer"
  },
  "response": [
    {
      "name": "example",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{authorization}}",
            "type": "text"
          },
          {
            "key": "Identity",
            "value": "{{identity}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"customer_id\": \"{{customer_id}}\",\n  \"transaction_id\": \"{{transaction_id}}\",\n  \"email\": \"no-reply@bond.tech\",\n  \"phone\": \"1234567890\",\n  \"dispute_reason\": \"FRAUD\",\n  \"dispute_details\": \"card stolen\",\n  \"file_attachments\" :[\n      {\n      \"filename\": \"screenshot\",\n      \"file\": \"ewogICJkaXNwdXRlX2lkIjogIjA2YzMzZTMxLTA4MTEtNDZhZC05NTg4LTljNWQwOTUzNzM3MiIsCiAgImRpc3B1dGVfc3RhdHVzIjogInN1Ym1pdHRlZCIKfQ==\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://{{environment}}.bond.tech/api/v0/disputes\n",
          "protocol": "https",
          "host": [
            "{{environment}}",
            "bond",
            "tech"
          ],
          "path": [
            "api",
            "v0",
            "disputes\n"
          ],
          "query": [
            {
              "key": "card_account_id",
              "value": "b18f94bc-0d7c-456e-a2e7-19e68393b64f",
              "disabled": true
            }
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n  \"dispute_id\": \"06c33e31-0811-46ad-9588-9c5d09537372\",\n  \"dispute_status\": \"submitted\"\n}"
    }
  ]
}