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 <CkRestW.h>
#include <CkJsonObjectW.h>

void ChilkatSample(void)
    {
    CkRestW rest;
    bool success;

    //  URL: https://api.stripe.com/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR
    bool bTls = true;
    int port = 443;
    bool bAutoReconnect = true;
    success = rest.Connect(L"api.stripe.com",port,bTls,bAutoReconnect);
    if (success != true) {
        wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    rest.SetAuthBasic(L"STRIPE_SECRET_KEY",L"");

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

    const wchar_t *strResponseBody = rest.fullRequestFormUrlEncoded(L"POST",L"/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR");
    if (rest.get_LastMethodSuccess() != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    CkJsonObjectW jsonResponse;
    jsonResponse.Load(strResponseBody);

    const wchar_t *id = 0;
    const wchar_t *object = 0;
    int amount;
    int arrival_date;
    bool automatic;
    const wchar_t *balance_transaction = 0;
    int created;
    const wchar_t *currency = 0;
    const wchar_t *description = 0;
    const wchar_t *destination = 0;
    bool failure_balance_transaction;
    bool failure_code;
    bool failure_message;
    bool livemode;
    const wchar_t *method = 0;
    const wchar_t *source_type = 0;
    bool statement_descriptor;
    const wchar_t *status = 0;
    const wchar_t *type = 0;

    id = jsonResponse.stringOf(L"id");
    object = jsonResponse.stringOf(L"object");
    amount = jsonResponse.IntOf(L"amount");
    arrival_date = jsonResponse.IntOf(L"arrival_date");
    automatic = jsonResponse.BoolOf(L"automatic");
    balance_transaction = jsonResponse.stringOf(L"balance_transaction");
    created = jsonResponse.IntOf(L"created");
    currency = jsonResponse.stringOf(L"currency");
    description = jsonResponse.stringOf(L"description");
    destination = jsonResponse.stringOf(L"destination");
    failure_balance_transaction = jsonResponse.IsNullOf(L"failure_balance_transaction");
    failure_code = jsonResponse.IsNullOf(L"failure_code");
    failure_message = jsonResponse.IsNullOf(L"failure_message");
    livemode = jsonResponse.BoolOf(L"livemode");
    method = jsonResponse.stringOf(L"method");
    source_type = jsonResponse.stringOf(L"source_type");
    statement_descriptor = jsonResponse.IsNullOf(L"statement_descriptor");
    status = jsonResponse.stringOf(L"status");
    type = jsonResponse.stringOf(L"type");
    }

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