C Stripe: List all Disputes

Back to Index

Returns a list of your disputes.

Documentation: https://stripe.com/docs/api/curl#list_disputes

CURL Command

curl https://api.stripe.com/v1/disputes?limit=3 \
   -u STRIPE_SECRET_KEY: \
   -G

C Example

#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkRest rest;
    BOOL success;
    BOOL bTls;
    int port;
    BOOL bAutoReconnect;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jsonResponse;
    const char *object;
    const char *url;
    BOOL has_more;
    int i;
    int count_i;
    const char *id;
    int amount;
    const char *balance_transaction;
    const char *charge;
    int created;
    const char *currency;
    BOOL evidenceAccess_activity_log;
    BOOL evidenceBilling_address;
    BOOL evidenceCancellation_policy;
    BOOL evidenceCancellation_policy_disclosure;
    BOOL evidenceCancellation_rebuttal;
    BOOL evidenceCustomer_communication;
    BOOL evidenceCustomer_email_address;
    BOOL evidenceCustomer_name;
    BOOL evidenceCustomer_purchase_ip;
    BOOL evidenceCustomer_signature;
    BOOL evidenceDuplicate_charge_documentation;
    BOOL evidenceDuplicate_charge_explanation;
    BOOL evidenceDuplicate_charge_id;
    BOOL evidenceProduct_description;
    BOOL evidenceReceipt;
    BOOL evidenceRefund_policy;
    BOOL evidenceRefund_policy_disclosure;
    BOOL evidenceRefund_refusal_explanation;
    BOOL evidenceService_date;
    BOOL evidenceService_documentation;
    BOOL evidenceShipping_address;
    BOOL evidenceShipping_carrier;
    BOOL evidenceShipping_date;
    BOOL evidenceShipping_documentation;
    BOOL evidenceShipping_tracking_number;
    BOOL evidenceUncategorized_file;
    BOOL evidenceUncategorized_text;
    int evidence_detailsDue_by;
    BOOL evidence_detailsHas_evidence;
    BOOL evidence_detailsPast_due;
    int evidence_detailsSubmission_count;
    BOOL is_charge_refundable;
    BOOL livemode;
    const char *reason;
    const char *status;
    int j;
    int count_j;

    rest = CkRest_Create();

    //  URL: https://api.stripe.com/v1/disputes?limit=3
    bTls = TRUE;
    port = 443;
    bAutoReconnect = TRUE;
    success = CkRest_Connect(rest,"api.stripe.com",port,bTls,bAutoReconnect);
    if (success != TRUE) {
        printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        return;
    }

    CkRest_SetAuthBasic(rest,"STRIPE_SECRET_KEY","");

    sbResponseBody = CkStringBuilder_Create();
    success = CkRest_FullRequestNoBodySb(rest,"GET","/v1/disputes?limit=3",sbResponseBody);
    if (success != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    jsonResponse = CkJsonObject_Create();
    CkJsonObject_LoadSb(jsonResponse,sbResponseBody);

    object = CkJsonObject_stringOf(jsonResponse,"object");
    url = CkJsonObject_stringOf(jsonResponse,"url");
    has_more = CkJsonObject_BoolOf(jsonResponse,"has_more");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(jsonResponse,"data");
    while (i < count_i) {
        CkJsonObject_putI(jsonResponse,i);
        id = CkJsonObject_stringOf(jsonResponse,"data[i].id");
        object = CkJsonObject_stringOf(jsonResponse,"data[i].object");
        amount = CkJsonObject_IntOf(jsonResponse,"data[i].amount");
        balance_transaction = CkJsonObject_stringOf(jsonResponse,"data[i].balance_transaction");
        charge = CkJsonObject_stringOf(jsonResponse,"data[i].charge");
        created = CkJsonObject_IntOf(jsonResponse,"data[i].created");
        currency = CkJsonObject_stringOf(jsonResponse,"data[i].currency");
        evidenceAccess_activity_log = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.access_activity_log");
        evidenceBilling_address = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.billing_address");
        evidenceCancellation_policy = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.cancellation_policy");
        evidenceCancellation_policy_disclosure = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.cancellation_policy_disclosure");
        evidenceCancellation_rebuttal = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.cancellation_rebuttal");
        evidenceCustomer_communication = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.customer_communication");
        evidenceCustomer_email_address = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.customer_email_address");
        evidenceCustomer_name = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.customer_name");
        evidenceCustomer_purchase_ip = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.customer_purchase_ip");
        evidenceCustomer_signature = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.customer_signature");
        evidenceDuplicate_charge_documentation = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.duplicate_charge_documentation");
        evidenceDuplicate_charge_explanation = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.duplicate_charge_explanation");
        evidenceDuplicate_charge_id = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.duplicate_charge_id");
        evidenceProduct_description = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.product_description");
        evidenceReceipt = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.receipt");
        evidenceRefund_policy = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.refund_policy");
        evidenceRefund_policy_disclosure = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.refund_policy_disclosure");
        evidenceRefund_refusal_explanation = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.refund_refusal_explanation");
        evidenceService_date = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.service_date");
        evidenceService_documentation = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.service_documentation");
        evidenceShipping_address = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.shipping_address");
        evidenceShipping_carrier = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.shipping_carrier");
        evidenceShipping_date = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.shipping_date");
        evidenceShipping_documentation = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.shipping_documentation");
        evidenceShipping_tracking_number = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.shipping_tracking_number");
        evidenceUncategorized_file = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.uncategorized_file");
        evidenceUncategorized_text = CkJsonObject_IsNullOf(jsonResponse,"data[i].evidence.uncategorized_text");
        evidence_detailsDue_by = CkJsonObject_IntOf(jsonResponse,"data[i].evidence_details.due_by");
        evidence_detailsHas_evidence = CkJsonObject_BoolOf(jsonResponse,"data[i].evidence_details.has_evidence");
        evidence_detailsPast_due = CkJsonObject_BoolOf(jsonResponse,"data[i].evidence_details.past_due");
        evidence_detailsSubmission_count = CkJsonObject_IntOf(jsonResponse,"data[i].evidence_details.submission_count");
        is_charge_refundable = CkJsonObject_BoolOf(jsonResponse,"data[i].is_charge_refundable");
        livemode = CkJsonObject_BoolOf(jsonResponse,"data[i].livemode");
        reason = CkJsonObject_stringOf(jsonResponse,"data[i].reason");
        status = CkJsonObject_stringOf(jsonResponse,"data[i].status");
        j = 0;
        count_j = CkJsonObject_SizeOfArray(jsonResponse,"data[i].balance_transactions");
        while (j < count_j) {
            CkJsonObject_putJ(jsonResponse,j);
            j = j + 1;
        }

        i = i + 1;
    }



    CkRest_Dispose(rest);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jsonResponse);

    }

Sample JSON Response Body

{
  "object": "list",
  "url": "/v1/disputes",
  "has_more": false,
  "data": [
    {
      "id": "dp_1BnETJGswQrCoh0Xefx4zP2a",
      "object": "dispute",
      "amount": 1000,
      "balance_transaction": "txn_1BnETJGswQrCoh0XPNBs9uW2",
      "balance_transactions": [
      ],
      "charge": "ch_1BnETJGswQrCoh0XlANDK278",
      "created": 1516662781,
      "currency": "usd",
      "evidence": {
        "access_activity_log": null,
        "billing_address": null,
        "cancellation_policy": null,
        "cancellation_policy_disclosure": null,
        "cancellation_rebuttal": null,
        "customer_communication": null,
        "customer_email_address": null,
        "customer_name": null,
        "customer_purchase_ip": null,
        "customer_signature": null,
        "duplicate_charge_documentation": null,
        "duplicate_charge_explanation": null,
        "duplicate_charge_id": null,
        "product_description": null,
        "receipt": null,
        "refund_policy": null,
        "refund_policy_disclosure": null,
        "refund_refusal_explanation": null,
        "service_date": null,
        "service_documentation": null,
        "shipping_address": null,
        "shipping_carrier": null,
        "shipping_date": null,
        "shipping_documentation": null,
        "shipping_tracking_number": null,
        "uncategorized_file": null,
        "uncategorized_text": null
      },
      "evidence_details": {
        "due_by": 1518307199,
        "has_evidence": false,
        "past_due": false,
        "submission_count": 0
      },
      "is_charge_refundable": false,
      "livemode": false,
      "metadata": {},
      "reason": "general",
      "status": "needs_response"
    }
  ]
}