---
title: "Abonamente | Documentație | POS by R&D Copilot"
description: "Înregistrează un endpoint HTTPS și POS îi trimite evenimentele tale, fiecare semnat."
canonical: "https://pos.rdcopilot.com/ro/docs/events/subscriptions/"
language: ro
updated: 2026-11-22
---

# Abonamente

Înregistrează un endpoint HTTPS și POS îi trimite evenimentele tale, fiecare semnat.

Un abonament indică un endpoint HTTPS al tău și tipurile de evenimente dorite. [Creează un abonament](https://pos.rdcopilot.com/ro/docs/api-reference/subscriptions/#create-subscription) înregistrează unul, iar răspunsul conține secretul de semnare, afișat o singură dată: aceeași cerere trimisă din nou îl omite.

curl

```bash
curl -X POST "$RDC_BASE_URL/pos/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "9d34c981-fee8-42c4-805d-e0ff8c7f2b3f",
  "url": "https://erp.brumar.example/hooks/pos",
  "eventTypes": [
    "com.rdcopilot.pos.order.paid.v1",
    "com.rdcopilot.pos.order.refunded.v1",
    "com.rdcopilot.pos.order.voided.v1",
    "com.rdcopilot.pos.payment.declined.v1",
    "com.rdcopilot.pos.businessday.opened.v1",
    "com.rdcopilot.pos.businessday.closed.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "9d34c981-fee8-42c4-805d-e0ff8c7f2b3f",
    "url": "https://erp.brumar.example/hooks/pos",
    "eventTypes": [
      "com.rdcopilot.pos.order.paid.v1",
      "com.rdcopilot.pos.order.refunded.v1",
      "com.rdcopilot.pos.order.voided.v1",
      "com.rdcopilot.pos.payment.declined.v1",
      "com.rdcopilot.pos.businessday.opened.v1",
      "com.rdcopilot.pos.businessday.closed.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/pos/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '9d34c981-fee8-42c4-805d-e0ff8c7f2b3f',
        'url': 'https://erp.brumar.example/hooks/pos',
        'eventTypes': [
            'com.rdcopilot.pos.order.paid.v1',
            'com.rdcopilot.pos.order.refunded.v1',
            'com.rdcopilot.pos.order.voided.v1',
            'com.rdcopilot.pos.payment.declined.v1',
            'com.rdcopilot.pos.businessday.opened.v1',
            'com.rdcopilot.pos.businessday.closed.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "9d34c981-fee8-42c4-805d-e0ff8c7f2b3f",
  "url": "https://erp.brumar.example/hooks/pos",
  "eventTypes": [
    "com.rdcopilot.pos.order.paid.v1",
    "com.rdcopilot.pos.order.refunded.v1",
    "com.rdcopilot.pos.order.voided.v1",
    "com.rdcopilot.pos.payment.declined.v1",
    "com.rdcopilot.pos.businessday.opened.v1",
    "com.rdcopilot.pos.businessday.closed.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/pos/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "9d34c981-fee8-42c4-805d-e0ff8c7f2b3f",
  "url": "https://erp.brumar.example/hooks/pos",
  "eventTypes": [
    "com.rdcopilot.pos.order.paid.v1",
    "com.rdcopilot.pos.order.refunded.v1",
    "com.rdcopilot.pos.order.voided.v1",
    "com.rdcopilot.pos.payment.declined.v1",
    "com.rdcopilot.pos.businessday.opened.v1",
    "com.rdcopilot.pos.businessday.closed.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 202

```json
{
  "operationId": "9d34c981-fee8-42c4-805d-e0ff8c7f2b3f",
  "status": "accepted",
  "aggregateId": "47560dfc-c270-4991-9a05-c95f30161246",
  "aggregateRevision": 1,
  "secret": "whsec_XzqUQsvy8YdbmCI7sU1wJ518NC+J/8aC"
}
```

## Ce primește endpoint-ul tău

-   Un `POST` cu evenimentul ca JSON, în plicul descris în [Plicul evenimentului](https://pos.rdcopilot.com/ro/docs/events/event-envelope/).
-   Anteturile `webhook-id`, `webhook-timestamp` și `webhook-signature`. [Verificarea semnăturilor](https://pos.rdcopilot.com/ro/docs/events/signatures/) arată cum le verifici.
-   Răspunsul tău: orice cod de stare 2xx în cel mult 10 secunde confirmă livrarea.

Verifică semnătura fiecărei cereri către endpoint-ul tău, pe corpul brut, și refuză o cerere a cărei semnătură nu se potrivește.

[Livrare și reîncercări](https://pos.rdcopilot.com/ro/docs/events/delivery-and-retries/) spune ce se întâmplă când endpoint-ul tău nu răspunde.

Regula completă: [Ghidul dezvoltatorului](https://rdcopilot.com/ro/docs/webhooks/)
