Subscriptions
Register an HTTPS endpoint and Treasury sends your events to it, each one signed.
A subscription names an HTTPS endpoint of yours and the event types you want. Create a subscription registers one, and the answer carries the signing secret, shown once: the same request sent again omits it.
curl
curl -X POST "$RDC_BASE_URL/banking/v1/subscriptions" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
"companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"url": "https://erp.brumar.example/banking/events",
"eventTypes": [
"com.rdcopilot.banking.statement.imported.v1",
"com.rdcopilot.banking.match.suggested.v1",
"com.rdcopilot.banking.match.accepted.v1",
"com.rdcopilot.banking.payment.approved.v1",
"com.rdcopilot.banking.payment.exported.v1",
"com.rdcopilot.banking.payment.confirmed.v1",
"com.rdcopilot.banking.payment.rejected.v1"
]
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/subscriptions`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
"companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"url": "https://erp.brumar.example/banking/events",
"eventTypes": [
"com.rdcopilot.banking.statement.imported.v1",
"com.rdcopilot.banking.match.suggested.v1",
"com.rdcopilot.banking.match.accepted.v1",
"com.rdcopilot.banking.payment.approved.v1",
"com.rdcopilot.banking.payment.exported.v1",
"com.rdcopilot.banking.payment.confirmed.v1",
"com.rdcopilot.banking.payment.rejected.v1"
]
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/subscriptions',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '256c79a3-7eb8-4b3f-b46f-0fd60d92987c',
'companyId': '3e738c06-3df7-4eb7-bfe2-259b8ba481f9',
'url': 'https://erp.brumar.example/banking/events',
'eventTypes': [
'com.rdcopilot.banking.statement.imported.v1',
'com.rdcopilot.banking.match.suggested.v1',
'com.rdcopilot.banking.match.accepted.v1',
'com.rdcopilot.banking.payment.approved.v1',
'com.rdcopilot.banking.payment.exported.v1',
'com.rdcopilot.banking.payment.confirmed.v1',
'com.rdcopilot.banking.payment.rejected.v1',
],
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
"companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"url": "https://erp.brumar.example/banking/events",
"eventTypes": [
"com.rdcopilot.banking.statement.imported.v1",
"com.rdcopilot.banking.match.suggested.v1",
"com.rdcopilot.banking.match.accepted.v1",
"com.rdcopilot.banking.payment.approved.v1",
"com.rdcopilot.banking.payment.exported.v1",
"com.rdcopilot.banking.payment.confirmed.v1",
"com.rdcopilot.banking.payment.rejected.v1"
]
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/subscriptions');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
"companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"url": "https://erp.brumar.example/banking/events",
"eventTypes": [
"com.rdcopilot.banking.statement.imported.v1",
"com.rdcopilot.banking.match.suggested.v1",
"com.rdcopilot.banking.match.accepted.v1",
"com.rdcopilot.banking.payment.approved.v1",
"com.rdcopilot.banking.payment.exported.v1",
"com.rdcopilot.banking.payment.confirmed.v1",
"com.rdcopilot.banking.payment.rejected.v1"
]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
"status": "accepted",
"aggregateId": "a907adea-68a7-492e-94b1-0fe38c5ff793",
"aggregateRevision": 1,
"secret": "whsec_T7mQ2vLx0bNf5RcYd9HsJe3KpWa8UgZo"
} What your endpoint receives
- A
POSTwith the event as JSON, in the envelope described in Event envelope. - The headers
webhook-id,webhook-timestampandwebhook-signature. Verify signatures shows how to check them. - Your answer: any 2xx status within 10 seconds confirms the delivery.
Delivery and retries says what happens when your endpoint does not answer.
The full rule: Developer guide