# Overview

> How Rapid records, at the moment they happen, the signals that back a sale: terms acceptance, device, access, delivery and usage.

Página: https://doc.rapidchargeback.com/en/canais/capture/visao-geral/

Capture records, at the moment they happen, the signals that back a sale: the terms acceptance at checkout, the device used for the purchase, access to the product, delivery confirmation, use of the service.

There are two channels for the same thing, and you can use both together:

| Channel | Who calls | Authentication |
|---|---|---|
| **Browser** | the snippet in your checkout, or your own code | publishable token in the URL |
| **Server** | your backend | Basic Auth, same as the other APIs |

## Flow in short

1. You enable the capture SDK in the dashboard and receive the merchant's publishable token
2. [Install the snippet](https://doc.rapidchargeback.com/en/canais/capture/instalar-o-snippet/) in the checkout, or call the endpoint directly
3. For each relevant fact, send an event with the order's `order_ref`
4. Rapid correlates the event with the transaction and stores the record
5. If that transaction becomes a dispute, the records go into the defense

## How the event becomes evidence

The event is **not** attached to anything when it arrives. It goes into a queue and only becomes evidence when it matches a real transaction of the merchant that owns the token, through the `order_ref` field.

This has a practical consequence worth understanding: a leaked token produces noise, never data. Whoever has your publishable token can send events, but they die in the queue if they do not match a real order of yours.

So:

- sending an event before the transaction exists is normal, correlation happens later, within a window of about 68 hours
- `order_ref` must be the same identifier you use in the transaction (`external_id`)
- the success response is `202 Accepted`, not `201`: Rapid accepted the event, processing is asynchronous
- a wrong `order_ref` does not return an error. The event is accepted and silently discarded later

## Difference between capture and evidence

| | Capture | [Evidence](https://doc.rapidchargeback.com/en/canais/evidence/visao-geral/) |
|---|---|---|
| When to use | at the moment of the fact, without knowing whether it becomes a dispute | when you already have the transaction at Rapid |
| Reference | `order_ref` (your identifier) | `transaction_id` or `transaction_ref` |
| Transaction must exist | no | yes, otherwise `404` |
| Payload fields | closed list | free format, 32 KB cap |
| Response | `202`, asynchronous | `201`, already stored |

## Authentication

- **Browser:** the token goes in the URL (`/capture/{token}/events`). It is publishable and can stay in the HTML.
- **Server:** Basic Auth with `client_id:client_secret`. See [Authentication](https://doc.rapidchargeback.com/en/referencia/autenticacao/).

The capture token is generated in the dashboard, under **Settings › Integrations**, when you enable the merchant's capture SDK.

## Endpoints

| Endpoint | Channel | What it does |
|---|---|---|
| [`POST /capture/{token}/events`](https://doc.rapidchargeback.com/en/canais/capture/enviar-evento-navegador/) | browser | Sends an event from the checkout |
| [`POST /capture/events`](https://doc.rapidchargeback.com/en/canais/capture/enviar-evento-servidor/) | server | Sends an event from your backend |
| [`GET /capture/{token}/config`](https://doc.rapidchargeback.com/en/canais/capture/config-do-snippet/) | browser | Configuration the snippet reads when it loads |

## Next steps

- [Install the snippet](https://doc.rapidchargeback.com/en/canais/capture/instalar-o-snippet/)
- [Types and payload](https://doc.rapidchargeback.com/en/canais/capture/payload/)
- [Send an event from the browser](https://doc.rapidchargeback.com/en/canais/capture/enviar-evento-navegador/)
- [Send an event from the server](https://doc.rapidchargeback.com/en/canais/capture/enviar-evento-servidor/)
