Skip to content

Treasury Events

Treasury operations emit webhook events when the status of deposits, withdrawals, and transfers changes.

EventFires when
treasury.deposit.completedDeposit funds have been credited to a wallet.
treasury.deposit.failedDeposit processing failed.
treasury.withdrawal.completedWithdrawal has been sent to the bank account.
treasury.withdrawal.failedWithdrawal processing failed.
treasury.transfer.completedInter-wallet transfer completed.
treasury.transfer.failedTransfer processing failed.
treasury.payout.completedPayout to a beneficiary completed.
treasury.payout.failedPayout processing failed.
{
"type": "treasury.deposit.completed",
"data": {
"object": {
"id": "dep_abc123",
"wallet_id": "wal_xyz789",
"from_amount": 100000,
"from_currency_id": "ZAR",
"to_amount": 100000,
"to_currency_id": "ZAR",
"status": "completed",
"reference": "DEP-001",
"created_at": "2026-06-01T10:30:00Z"
}
}
}
@app.route("/webhooks/turnstay", methods=["POST"])
def turnstay_webhook():
event = request.get_json()
event_type = event["type"]
if event_type == "treasury.deposit.completed":
deposit = event["data"]["object"]
update_deposit_status(deposit["id"], "completed")
elif event_type == "treasury.withdrawal.completed":
withdrawal = event["data"]["object"]
update_withdrawal_status(withdrawal["id"], "completed")
return jsonify({"ok": True}), 200