Visual FoxPro 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

Visual FoxPro Example

LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL lcStrResponseBody
LOCAL loJsonResponse
LOCAL lcId
LOCAL lcObject
LOCAL lnAmount
LOCAL lnArrival_date
LOCAL lnAutomatic
LOCAL lcBalance_transaction
LOCAL lnCreated
LOCAL lcCurrency
LOCAL lcDescription
LOCAL lcDestination
LOCAL lnFailure_balance_transaction
LOCAL lnFailure_code
LOCAL lnFailure_message
LOCAL lnLivemode
LOCAL lcMethod
LOCAL lcSource_type
LOCAL lnStatement_descriptor
LOCAL lcStatus
LOCAL lcType

loRest = CreateObject('Chilkat_9_5_0.Rest')

*  URL: https://api.stripe.com/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("api.stripe.com",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess <> 1) THEN
    ? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
    ? loRest.LastErrorText
    RELEASE loRest
    CANCEL
ENDIF

loRest.SetAuthBasic("STRIPE_SECRET_KEY","")

loRest.AddQueryParam("metadata[order_id]","6735")

lcStrResponseBody = loRest.FullRequestFormUrlEncoded("POST","/v1/payouts/po_1BnETKGswQrCoh0XeUopRyDR")
IF (loRest.LastMethodSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    CANCEL
ENDIF

loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse.Load(lcStrResponseBody)

lcId = loJsonResponse.StringOf("id")
lcObject = loJsonResponse.StringOf("object")
lnAmount = loJsonResponse.IntOf("amount")
lnArrival_date = loJsonResponse.IntOf("arrival_date")
lnAutomatic = loJsonResponse.BoolOf("automatic")
lcBalance_transaction = loJsonResponse.StringOf("balance_transaction")
lnCreated = loJsonResponse.IntOf("created")
lcCurrency = loJsonResponse.StringOf("currency")
lcDescription = loJsonResponse.StringOf("description")
lcDestination = loJsonResponse.StringOf("destination")
lnFailure_balance_transaction = loJsonResponse.IsNullOf("failure_balance_transaction")
lnFailure_code = loJsonResponse.IsNullOf("failure_code")
lnFailure_message = loJsonResponse.IsNullOf("failure_message")
lnLivemode = loJsonResponse.BoolOf("livemode")
lcMethod = loJsonResponse.StringOf("method")
lcSource_type = loJsonResponse.StringOf("source_type")
lnStatement_descriptor = loJsonResponse.IsNullOf("statement_descriptor")
lcStatus = loJsonResponse.StringOf("status")
lcType = loJsonResponse.StringOf("type")

RELEASE loRest
RELEASE loJsonResponse

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