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

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;
    int arrival_date;
    BOOL automatic;
    const char *balance_transaction;
    int created;
    const char *currency;
    const char *description;
    const char *destination;
    BOOL failure_balance_transaction;
    BOOL failure_code;
    BOOL failure_message;
    BOOL livemode;
    const char *method;
    const char *source_type;
    BOOL statement_descriptor;
    const char *status;
    const char *type;

    rest = CkRest_Create();

    //  URL: https://api.stripe.com/v1/payouts?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/payouts?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");
        arrival_date = CkJsonObject_IntOf(jsonResponse,"data[i].arrival_date");
        automatic = CkJsonObject_BoolOf(jsonResponse,"data[i].automatic");
        balance_transaction = CkJsonObject_stringOf(jsonResponse,"data[i].balance_transaction");
        created = CkJsonObject_IntOf(jsonResponse,"data[i].created");
        currency = CkJsonObject_stringOf(jsonResponse,"data[i].currency");
        description = CkJsonObject_stringOf(jsonResponse,"data[i].description");
        destination = CkJsonObject_stringOf(jsonResponse,"data[i].destination");
        failure_balance_transaction = CkJsonObject_IsNullOf(jsonResponse,"data[i].failure_balance_transaction");
        failure_code = CkJsonObject_IsNullOf(jsonResponse,"data[i].failure_code");
        failure_message = CkJsonObject_IsNullOf(jsonResponse,"data[i].failure_message");
        livemode = CkJsonObject_BoolOf(jsonResponse,"data[i].livemode");
        method = CkJsonObject_stringOf(jsonResponse,"data[i].method");
        source_type = CkJsonObject_stringOf(jsonResponse,"data[i].source_type");
        statement_descriptor = CkJsonObject_IsNullOf(jsonResponse,"data[i].statement_descriptor");
        status = CkJsonObject_stringOf(jsonResponse,"data[i].status");
        type = CkJsonObject_stringOf(jsonResponse,"data[i].type");
        i = i + 1;
    }



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

    }

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