实时事件流(SSE)
curl --request GET \
--url https://api.qbank.cl/platform/v1/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qbank.cl/platform/v1/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qbank.cl/platform/v1/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qbank.cl/platform/v1/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.qbank.cl/platform/v1/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.qbank.cl/platform/v1/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qbank.cl/platform/v1/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body: cbpay event stream
retry: 3000
id: 4822
event: payin_credited
data: {"event_id":"7c1f0b2a-5c3d-4e6f-9a1b-2c3d4e5f6a7b","type":"payin_credited","account_id":"c57f05b6-8f2e-4d51-9a0c-5b7e2d3f4a10","created_at":"2026-07-25T18:04:11Z","cursor":"4822","data":{"payin_id":"9b8a7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","usdt_credited":"99.700000"}}
: ping
实时事件流(SSE)
打开 text/event-stream 连接,实时推送账户的全部事件——与 webhook 推送的是同一批事件,但你无需对外暴露任何公开端点。
每条事件包含 id:(单调游标)、event:(事件类型)和 data:(JSON,其 event_id 与 webhook 完全一致,便于两个通道相互对照)。
使用 Last-Event-ID 请求头(或 ?last_event_id=)重连,服务端会先重放你错过的事件,再继续实时推送。浏览器原生 EventSource 无法发送 Authorization 请求头:请使用 fetch 配合 ReadableStream。
可见范围由凭证决定:账户凭证只接收自己的事件;具备 ops:read 的组织管理员凭证接收全组织通道,并可用 ?account_id= 缩小范围。
连接每 20 秒发送 : ping,每 60 秒重新校验会话(会话被吊销时以 unauthorized 控制事件关闭流),并在 30 分钟后以 reconnect 控制事件关闭。
GET
/
v1
/
events
实时事件流(SSE)
curl --request GET \
--url https://api.qbank.cl/platform/v1/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qbank.cl/platform/v1/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qbank.cl/platform/v1/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qbank.cl/platform/v1/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.qbank.cl/platform/v1/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.qbank.cl/platform/v1/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qbank.cl/platform/v1/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body: cbpay event stream
retry: 3000
id: 4822
event: payin_credited
data: {"event_id":"7c1f0b2a-5c3d-4e6f-9a1b-2c3d4e5f6a7b","type":"payin_credited","account_id":"c57f05b6-8f2e-4d51-9a0c-5b7e2d3f4a10","created_at":"2026-07-25T18:04:11Z","cursor":"4822","data":{"payin_id":"9b8a7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","usdt_credited":"99.700000"}}
: ping
查询参数
响应
事件流已打开。响应体保持打开状态并持续增量写入。
The response is of type string.