DataFlex 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

DataFlex Example

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoRest
    Boolean iSuccess
    Boolean iBTls
    Integer iPort
    Boolean iBAutoReconnect
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJsonResponse
    String sObject
    String sUrl
    Boolean iHas_more
    Integer i
    Integer iCount_i
    String sId
    Integer iAmount
    Integer iArrival_date
    Boolean iAutomatic
    String sBalance_transaction
    Integer iCreated
    String sCurrency
    String sDescription
    String sDestination
    Boolean iFailure_balance_transaction
    Boolean iFailure_code
    Boolean iFailure_message
    Boolean iLivemode
    String sMethod
    String sSource_type
    Boolean iStatement_descriptor
    String sStatus
    String sType
    String sTemp1
    Integer iTemp1

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    //  URL: https://api.stripe.com/v1/payouts?limit=3
    Move True To iBTls
    Move 443 To iPort
    Move True To iBAutoReconnect
    Get ComConnect Of hoRest "api.stripe.com" iPort iBTls iBAutoReconnect To iSuccess
    If (iSuccess <> True) Begin
        Get ComConnectFailReason Of hoRest To iTemp1
        Showln "ConnectFailReason: " iTemp1
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComSetAuthBasic Of hoRest "STRIPE_SECRET_KEY" "" To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComFullRequestNoBodySb Of hoRest "GET" "/v1/payouts?limit=3" vSbResponseBody To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
    If (Not(IsComObjectCreated(hoJsonResponse))) Begin
        Send CreateComObject of hoJsonResponse
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJsonResponse vSbResponseBody To iSuccess

    Get ComStringOf Of hoJsonResponse "object" To sObject
    Get ComStringOf Of hoJsonResponse "url" To sUrl
    Get ComBoolOf Of hoJsonResponse "has_more" To iHas_more
    Move 0 To i
    Get ComSizeOfArray Of hoJsonResponse "data" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJsonResponse To i
        Get ComStringOf Of hoJsonResponse "data[i].id" To sId
        Get ComStringOf Of hoJsonResponse "data[i].object" To sObject
        Get ComIntOf Of hoJsonResponse "data[i].amount" To iAmount
        Get ComIntOf Of hoJsonResponse "data[i].arrival_date" To iArrival_date
        Get ComBoolOf Of hoJsonResponse "data[i].automatic" To iAutomatic
        Get ComStringOf Of hoJsonResponse "data[i].balance_transaction" To sBalance_transaction
        Get ComIntOf Of hoJsonResponse "data[i].created" To iCreated
        Get ComStringOf Of hoJsonResponse "data[i].currency" To sCurrency
        Get ComStringOf Of hoJsonResponse "data[i].description" To sDescription
        Get ComStringOf Of hoJsonResponse "data[i].destination" To sDestination
        Get ComIsNullOf Of hoJsonResponse "data[i].failure_balance_transaction" To iFailure_balance_transaction
        Get ComIsNullOf Of hoJsonResponse "data[i].failure_code" To iFailure_code
        Get ComIsNullOf Of hoJsonResponse "data[i].failure_message" To iFailure_message
        Get ComBoolOf Of hoJsonResponse "data[i].livemode" To iLivemode
        Get ComStringOf Of hoJsonResponse "data[i].method" To sMethod
        Get ComStringOf Of hoJsonResponse "data[i].source_type" To sSource_type
        Get ComIsNullOf Of hoJsonResponse "data[i].statement_descriptor" To iStatement_descriptor
        Get ComStringOf Of hoJsonResponse "data[i].status" To sStatus
        Get ComStringOf Of hoJsonResponse "data[i].type" To sType
        Move i + 1 To i
    Loop



End_Procedure

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