Objective-C Stripe: List all Payouts

Back to Index

Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent you. The payouts are returned in sorted order, with the most recently created payouts appearing first.

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

CURL Command

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

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/payouts?limit=3
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/payouts?limit=3" sb: sbResponseBody];
if (success != YES) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

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

NSString *object = 0;
NSString *url = 0;
BOOL has_more;
int i;
int count_i;
NSString *id = 0;
int amount;
int arrival_date;
BOOL automatic;
NSString *balance_transaction = 0;
int created;
NSString *currency = 0;
NSString *description = 0;
NSString *destination = 0;
BOOL failure_balance_transaction;
BOOL failure_code;
BOOL failure_message;
BOOL livemode;
NSString *method = 0;
NSString *source_type = 0;
BOOL statement_descriptor;
NSString *status = 0;
NSString *type = 0;

object = [jsonResponse StringOf: @"object"];
url = [jsonResponse StringOf: @"url"];
has_more = [jsonResponse BoolOf: @"has_more"];
i = 0;
count_i = [[jsonResponse SizeOfArray: @"data"] intValue];
while (i < count_i) {
    jsonResponse.I = [NSNumber numberWithInt: i];
    id = [jsonResponse StringOf: @"data[i].id"];
    object = [jsonResponse StringOf: @"data[i].object"];
    amount = [[jsonResponse IntOf: @"data[i].amount"] intValue];
    arrival_date = [[jsonResponse IntOf: @"data[i].arrival_date"] intValue];
    automatic = [jsonResponse BoolOf: @"data[i].automatic"];
    balance_transaction = [jsonResponse StringOf: @"data[i].balance_transaction"];
    created = [[jsonResponse IntOf: @"data[i].created"] intValue];
    currency = [jsonResponse StringOf: @"data[i].currency"];
    description = [jsonResponse StringOf: @"data[i].description"];
    destination = [jsonResponse StringOf: @"data[i].destination"];
    failure_balance_transaction = [jsonResponse IsNullOf: @"data[i].failure_balance_transaction"];
    failure_code = [jsonResponse IsNullOf: @"data[i].failure_code"];
    failure_message = [jsonResponse IsNullOf: @"data[i].failure_message"];
    livemode = [jsonResponse BoolOf: @"data[i].livemode"];
    method = [jsonResponse StringOf: @"data[i].method"];
    source_type = [jsonResponse StringOf: @"data[i].source_type"];
    statement_descriptor = [jsonResponse IsNullOf: @"data[i].statement_descriptor"];
    status = [jsonResponse StringOf: @"data[i].status"];
    type = [jsonResponse StringOf: @"data[i].type"];
    i = i + 1;
}

Sample JSON Response Body

{
  "object": "list",
  "url": "/v1/payouts",
  "has_more": false,
  "data": [
    {
      "id": "po_1BnETKGswQrCoh0XeUopRyDR",
      "object": "payout",
      "amount": 1100,
      "arrival_date": 1516662782,
      "automatic": true,
      "balance_transaction": "txn_1BnETKGswQrCoh0X762wrMpF",
      "created": 1516662782,
      "currency": "usd",
      "description": "STRIPE TRANSFER",
      "destination": "ba_1BnETKGswQrCoh0XO5G2kEG5",
      "failure_balance_transaction": null,
      "failure_code": null,
      "failure_message": null,
      "livemode": false,
      "metadata": {},
      "method": "standard",
      "source_type": "card",
      "statement_descriptor": null,
      "status": "in_transit",
      "type": "bank_account"
    }
  ]
}