Objective-C Stripe: Retrieve a Dispute

Back to Index

Retrieves the dispute with the given ID.

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

CURL Command

curl https://api.stripe.com/v1/disputes/dp_1BnETJGswQrCoh0Xefx4zP2a \
   -u STRIPE_SECRET_KEY:

Objective-C Example

#import <CkoRest.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>

CkoRest *rest = [[CkoRest alloc] init];
BOOL success;

//  URL: https://api.stripe.com/v1/disputes/dp_1BnETJGswQrCoh0Xefx4zP2a
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"api.stripe.com" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
    NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
    NSLog(@"%@",rest.LastErrorText);
    return;
}

[rest SetAuthBasic: @"STRIPE_SECRET_KEY" password: @""];

CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/v1/disputes/dp_1BnETJGswQrCoh0Xefx4zP2a" sb: sbResponseBody];
if (success != YES) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init];
[jsonResponse LoadSb: sbResponseBody];

NSString *id = 0;
NSString *object = 0;
int amount;
NSString *balance_transaction = 0;
NSString *charge = 0;
int created;
NSString *currency = 0;
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;
NSString *reason = 0;
NSString *status = 0;
int i;
int count_i;

id = [jsonResponse StringOf: @"id"];
object = [jsonResponse StringOf: @"object"];
amount = [[jsonResponse IntOf: @"amount"] intValue];
balance_transaction = [jsonResponse StringOf: @"balance_transaction"];
charge = [jsonResponse StringOf: @"charge"];
created = [[jsonResponse IntOf: @"created"] intValue];
currency = [jsonResponse StringOf: @"currency"];
evidenceAccess_activity_log = [jsonResponse IsNullOf: @"evidence.access_activity_log"];
evidenceBilling_address = [jsonResponse IsNullOf: @"evidence.billing_address"];
evidenceCancellation_policy = [jsonResponse IsNullOf: @"evidence.cancellation_policy"];
evidenceCancellation_policy_disclosure = [jsonResponse IsNullOf: @"evidence.cancellation_policy_disclosure"];
evidenceCancellation_rebuttal = [jsonResponse IsNullOf: @"evidence.cancellation_rebuttal"];
evidenceCustomer_communication = [jsonResponse IsNullOf: @"evidence.customer_communication"];
evidenceCustomer_email_address = [jsonResponse IsNullOf: @"evidence.customer_email_address"];
evidenceCustomer_name = [jsonResponse IsNullOf: @"evidence.customer_name"];
evidenceCustomer_purchase_ip = [jsonResponse IsNullOf: @"evidence.customer_purchase_ip"];
evidenceCustomer_signature = [jsonResponse IsNullOf: @"evidence.customer_signature"];
evidenceDuplicate_charge_documentation = [jsonResponse IsNullOf: @"evidence.duplicate_charge_documentation"];
evidenceDuplicate_charge_explanation = [jsonResponse IsNullOf: @"evidence.duplicate_charge_explanation"];
evidenceDuplicate_charge_id = [jsonResponse IsNullOf: @"evidence.duplicate_charge_id"];
evidenceProduct_description = [jsonResponse IsNullOf: @"evidence.product_description"];
evidenceReceipt = [jsonResponse IsNullOf: @"evidence.receipt"];
evidenceRefund_policy = [jsonResponse IsNullOf: @"evidence.refund_policy"];
evidenceRefund_policy_disclosure = [jsonResponse IsNullOf: @"evidence.refund_policy_disclosure"];
evidenceRefund_refusal_explanation = [jsonResponse IsNullOf: @"evidence.refund_refusal_explanation"];
evidenceService_date = [jsonResponse IsNullOf: @"evidence.service_date"];
evidenceService_documentation = [jsonResponse IsNullOf: @"evidence.service_documentation"];
evidenceShipping_address = [jsonResponse IsNullOf: @"evidence.shipping_address"];
evidenceShipping_carrier = [jsonResponse IsNullOf: @"evidence.shipping_carrier"];
evidenceShipping_date = [jsonResponse IsNullOf: @"evidence.shipping_date"];
evidenceShipping_documentation = [jsonResponse IsNullOf: @"evidence.shipping_documentation"];
evidenceShipping_tracking_number = [jsonResponse IsNullOf: @"evidence.shipping_tracking_number"];
evidenceUncategorized_file = [jsonResponse IsNullOf: @"evidence.uncategorized_file"];
evidenceUncategorized_text = [jsonResponse IsNullOf: @"evidence.uncategorized_text"];
evidence_detailsDue_by = [[jsonResponse IntOf: @"evidence_details.due_by"] intValue];
evidence_detailsHas_evidence = [jsonResponse BoolOf: @"evidence_details.has_evidence"];
evidence_detailsPast_due = [jsonResponse BoolOf: @"evidence_details.past_due"];
evidence_detailsSubmission_count = [[jsonResponse IntOf: @"evidence_details.submission_count"] intValue];
is_charge_refundable = [jsonResponse BoolOf: @"is_charge_refundable"];
livemode = [jsonResponse BoolOf: @"livemode"];
reason = [jsonResponse StringOf: @"reason"];
status = [jsonResponse StringOf: @"status"];
i = 0;
count_i = [[jsonResponse SizeOfArray: @"balance_transactions"] intValue];
while (i < count_i) {
    jsonResponse.I = [NSNumber numberWithInt: i];
    i = i + 1;
}

Sample JSON Response Body

{
  "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"
}