Delphi DLL 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

Delphi DLL Example

var
rest: HCkRest;
success: Boolean;
bTls: Boolean;
port: Integer;
bAutoReconnect: Boolean;
strResponseBody: PWideChar;
jsonResponse: HCkJsonObject;
id: PWideChar;
object: PWideChar;
amount: Integer;
arrival_date: Integer;
automatic: Boolean;
balance_transaction: PWideChar;
created: Integer;
currency: PWideChar;
description: PWideChar;
destination: PWideChar;
failure_balance_transaction: Boolean;
failure_code: Boolean;
failure_message: Boolean;
livemode: Boolean;
method: PWideChar;
source_type: PWideChar;
statement_descriptor: Boolean;
status: PWideChar;
type: PWideChar;

begin
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) then
  begin
    Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
    Memo1.Lines.Add(CkRest__lastErrorText(rest));
    Exit;
  end;

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) then
  begin
    Memo1.Lines.Add(CkRest__lastErrorText(rest));
    Exit;
  end;

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