Unicode C Stripe: Update a Payout

Back to Index

Updates the specified payout by setting the values of the parameters passed. Any parameters not provided will be left unchanged. This request accepts only the metadata as arguments.

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

CURL Command

curl -X POST https://api.stripe.com/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR \
   -u STRIPE_SECRET_KEY: \
   -d metadata[order_id]=6735

Unicode C Example

#include <C_CkRestW.h>
#include <C_CkJsonObjectW.h>

void ChilkatSample(void)
    {
    HCkRestW rest;
    BOOL success;
    BOOL bTls;
    int port;
    BOOL bAutoReconnect;
    const wchar_t *strResponseBody;
    HCkJsonObjectW jsonResponse;
    const wchar_t *id;
    const wchar_t *object;
    int amount;
    int arrival_date;
    BOOL automatic;
    const wchar_t *balance_transaction;
    int created;
    const wchar_t *currency;
    const wchar_t *description;
    const wchar_t *destination;
    BOOL failure_balance_transaction;
    BOOL failure_code;
    BOOL failure_message;
    BOOL livemode;
    const wchar_t *method;
    const wchar_t *source_type;
    BOOL statement_descriptor;
    const wchar_t *status;
    const wchar_t *type;

    rest = CkRestW_Create();

    //  URL: https://api.stripe.com/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR
    bTls = TRUE;
    port = 443;
    bAutoReconnect = TRUE;
    success = CkRestW_Connect(rest,L"api.stripe.com",port,bTls,bAutoReconnect);
    if (success != TRUE) {
        wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
        wprintf(L"%s\n",CkRestW_lastErrorText(rest));
        CkRestW_Dispose(rest);
        return;
    }

    CkRestW_SetAuthBasic(rest,L"STRIPE_SECRET_KEY",L"");

    CkRestW_AddQueryParam(rest,L"metadata[order_id]",L"6735");

    strResponseBody = CkRestW_fullRequestFormUrlEncoded(rest,L"POST",L"/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR");
    if (CkRestW_getLastMethodSuccess(rest) != TRUE) {
        wprintf(L"%s\n",CkRestW_lastErrorText(rest));
        CkRestW_Dispose(rest);
        return;
    }

    jsonResponse = CkJsonObjectW_Create();
    CkJsonObjectW_Load(jsonResponse,strResponseBody);

    id = CkJsonObjectW_stringOf(jsonResponse,L"id");
    object = CkJsonObjectW_stringOf(jsonResponse,L"object");
    amount = CkJsonObjectW_IntOf(jsonResponse,L"amount");
    arrival_date = CkJsonObjectW_IntOf(jsonResponse,L"arrival_date");
    automatic = CkJsonObjectW_BoolOf(jsonResponse,L"automatic");
    balance_transaction = CkJsonObjectW_stringOf(jsonResponse,L"balance_transaction");
    created = CkJsonObjectW_IntOf(jsonResponse,L"created");
    currency = CkJsonObjectW_stringOf(jsonResponse,L"currency");
    description = CkJsonObjectW_stringOf(jsonResponse,L"description");
    destination = CkJsonObjectW_stringOf(jsonResponse,L"destination");
    failure_balance_transaction = CkJsonObjectW_IsNullOf(jsonResponse,L"failure_balance_transaction");
    failure_code = CkJsonObjectW_IsNullOf(jsonResponse,L"failure_code");
    failure_message = CkJsonObjectW_IsNullOf(jsonResponse,L"failure_message");
    livemode = CkJsonObjectW_BoolOf(jsonResponse,L"livemode");
    method = CkJsonObjectW_stringOf(jsonResponse,L"method");
    source_type = CkJsonObjectW_stringOf(jsonResponse,L"source_type");
    statement_descriptor = CkJsonObjectW_IsNullOf(jsonResponse,L"statement_descriptor");
    status = CkJsonObjectW_stringOf(jsonResponse,L"status");
    type = CkJsonObjectW_stringOf(jsonResponse,L"type");


    CkRestW_Dispose(rest);
    CkJsonObjectW_Dispose(jsonResponse);

    }

Sample JSON Response Body

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