Android / Bond APIs / create a dispute
Back to Collection Items
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
boolean success;
// 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=="
// }
// ]
// }
CkJsonObject json = new CkJsonObject();
json.UpdateString("customer_id","{{customer_id}}");
json.UpdateString("transaction_id","{{transaction_id}}");
json.UpdateString("email","no-reply@bond.tech");
json.UpdateString("phone","1234567890");
json.UpdateString("dispute_reason","FRAUD");
json.UpdateString("dispute_details","card stolen");
json.UpdateString("file_attachments[0].filename","screenshot");
json.UpdateString("file_attachments[0].file","ewogICJkaXNwdXRlX2lkIjogIjA2YzMzZTMxLTA4MTEtNDZhZC05NTg4LTljNWQwOTUzNzM3MiIsCiAgImRpc3B1dGVfc3RhdHVzIjogInN1Ym1pdHRlZCIKfQ==");
http.SetRequestHeader("Authorization","{{authorization}}");
http.SetRequestHeader("Identity","{{identity}}");
CkHttpResponse resp = http.PostJson3("https://{{environment}}.bond.tech/api/v0/disputes","application/json",json);
if (http.get_LastMethodSuccess() == false) {
Log.i(TAG, http.lastErrorText());
return;
}
Log.i(TAG, String.valueOf(resp.get_StatusCode()));
Log.i(TAG, resp.bodyStr());
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
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}"
}
]
}