PureBasic / Broker API / Transfer Entity
Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
CkHttp::setCkBasicAuth(http, 1)
CkHttp::setCkLogin(http, "{{api_key}}")
CkHttp::setCkPassword(http, "{{api_secret}}")
; Use this online tool to generate code from sample JSON: Generate Code to Create JSON
; The following JSON is sent in the request body.
; {
; "transfer_type": "ach",
; "relationship_id": "32788c82-9f9d-407c-8e77-c981ac74a1c9",
; "amount": "500",
; "direction": "INCOMING"
; }
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(json,"transfer_type","ach")
CkJsonObject::ckUpdateString(json,"relationship_id","32788c82-9f9d-407c-8e77-c981ac74a1c9")
CkJsonObject::ckUpdateString(json,"amount","500")
CkJsonObject::ckUpdateString(json,"direction","INCOMING")
resp.i = CkHttp::ckPostJson3(http,"https://domain.com/v1/accounts/:account_id/transfers","application/json",json)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
ProcedureReturn
EndProcedure
Curl Command
curl -X POST
-u '{{api_key}}:{{api_secret}}'
-d '{
"transfer_type": "ach",
"relationship_id": "32788c82-9f9d-407c-8e77-c981ac74a1c9",
"amount": "500",
"direction": "INCOMING"
}'
https://domain.com/v1/accounts/:account_id/transfers
Postman Collection Item JSON
{
"name": "Transfer Entity",
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"transfer_type\": \"ach\",\n \"relationship_id\": \"32788c82-9f9d-407c-8e77-c981ac74a1c9\",\n \"amount\": \"500\",\n \"direction\": \"INCOMING\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{HOST}}/v1/accounts/:account_id/transfers",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"accounts",
":account_id",
"transfers"
],
"variable": [
{
"key": "account_id",
"value": null
}
]
},
"description": "| Parameter | Type | Required | Notes |\n|------------------------|------------------------|-------------------------|:-----:|\n| `transfer_type` | ENUM.TransferType | Required | Sandbox currently only supports `ach` |\n| `relationship_id` | string/UUID | Required if `type = ach` | The `ach_relationship` created for the `account_id` here |\n| `bank_id` | string/UUID | Required if `type = wire` | The `bank_relationship` created for the `account_id` here |\n| `amount` | string/decimal | Required | Must be > 0.00 |\n| `direction` | ENUM.TransferDirection | Required | |\n| `timing` | ENUM.TransferTiming | Required | Only `immediate` |\n| `additional_information` | string | Optional - Applies only to wires | Additional wire details |"
},
"response": [
]
}