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

C Example

#include <C_CkRest.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkRest rest;
    BOOL success;
    BOOL bTls;
    int port;
    BOOL bAutoReconnect;
    const char *strResponseBody;
    HCkJsonObject jsonResponse;
    const char *id;
    const char *object;
    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/po_1BnETKGswQrCoh0XeUopRyDR
    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","");

    CkRest_AddQueryParam(rest,"metadata[order_id]","6735");

    strResponseBody = CkRest_fullRequestFormUrlEncoded(rest,"POST","/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR");
    if (CkRest_getLastMethodSuccess(rest) != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        return;
    }

    jsonResponse = CkJsonObject_Create();
    CkJsonObject_Load(jsonResponse,strResponseBody);

    id = CkJsonObject_stringOf(jsonResponse,"id");
    object = CkJsonObject_stringOf(jsonResponse,"object");
    amount = CkJsonObject_IntOf(jsonResponse,"amount");
    arrival_date = CkJsonObject_IntOf(jsonResponse,"arrival_date");
    automatic = CkJsonObject_BoolOf(jsonResponse,"automatic");
    balance_transaction = CkJsonObject_stringOf(jsonResponse,"balance_transaction");
    created = CkJsonObject_IntOf(jsonResponse,"created");
    currency = CkJsonObject_stringOf(jsonResponse,"currency");
    description = CkJsonObject_stringOf(jsonResponse,"description");
    destination = CkJsonObject_stringOf(jsonResponse,"destination");
    failure_balance_transaction = CkJsonObject_IsNullOf(jsonResponse,"failure_balance_transaction");
    failure_code = CkJsonObject_IsNullOf(jsonResponse,"failure_code");
    failure_message = CkJsonObject_IsNullOf(jsonResponse,"failure_message");
    livemode = CkJsonObject_BoolOf(jsonResponse,"livemode");
    method = CkJsonObject_stringOf(jsonResponse,"method");
    source_type = CkJsonObject_stringOf(jsonResponse,"source_type");
    statement_descriptor = CkJsonObject_IsNullOf(jsonResponse,"statement_descriptor");
    status = CkJsonObject_stringOf(jsonResponse,"status");
    type = CkJsonObject_stringOf(jsonResponse,"type");


    CkRest_Dispose(rest);
    CkJsonObject_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"
}