Skip to content

↑↓ navigate ↵ open Ctrl↵ new tab esc close

The snippet is the shortest way to capture evidence: two tags in your checkout and one call per event. It talks to the browser channel for you.

If your checkout is rendered on the server, or if you prefer not to load a third-party script, skip this page and call the endpoint directly.

In the dashboard, under Settings › Integrations, on the Rapid Capture row. Enable it and the dashboard shows the ready-made snippet on the Installation tab, already with the token of the store selected at the top. It can be enabled by those who have Prevention or Dispute active.

The token is publishable: it stays in your store’s HTML and needs no protection. With it you can only send events, never read data. An event that does not match one of your orders is discarded.

The token only works on the first site where it is used, on its subdomains and on the domain above it (store.com also covers www.store.com and checkout.store.com; locked on checkout.store.com, it also covers store.com). An event coming from another site is refused. This way, if someone copies the snippet to another page, the events from there do not mix with yours.

Tests on localhost, by IP or on an internal domain (.local, .test) do not count as the first site. The sites the token works on are shown in the Rapid Capture detail (Manage, Overview tab). If another site tries to use the code, it shows up there with an Authorize button: that is the path for stores with more than one domain (checkout on one, members area on another). Remove takes a site out; with none left, the token locks again on the next site that uses the code.

If the token leaks, Generate new code replaces it immediately. The previous one stops working and you paste the new code on your site. The panel goes back to waiting for the first event until an event arrives after the change.

<script>window.rapid=window.rapid||function(){(window.rapid.q=window.rapid.q||[]).push(arguments)};rapid('init',{token:'your_publishable_token'})</script>
<script async src="https://api.rapidchargeback.com/sdk/v1/rapid.js"></script>

The first tag creates a queue: calls to rapid(...) made before the script finishes loading are kept and sent when it arrives. That is why the script can be async, and if it does not load (ad blocker, unstable network, old browser) the calls on your page just wait, they never turn into an error in your checkout.

Place the snippet as early as possible on the page, preferably in the <head>: init already prepares the device identification, and the earlier it starts, the faster the identification comes out on checkout. The identification itself only happens on checkout: other pages with the snippet do not identify the device.

The old snippet (the script without async and init right after it) keeps working.

The script is about 8 KB, has no dependencies and does not block the page.

// Purchase completed. Also captures the device data.
rapid('checkout', { order_ref: 'TXN-2026-001' })
// Customer accepted the terms.
rapid('terms', { order_ref: 'TXN-2026-001' })
// Customer accessed the product.
rapid('track', 'access_log', { order_ref: 'TXN-2026-001' })
// Customer used the product or service.
rapid('track', 'usage_log', { order_ref: 'TXN-2026-001' })
CallEvent generatedPayload the snippet builds
rapid('checkout', …)checkoutdevice identification
rapid('terms', …)terms_acceptancethe page URL
rapid('track', 'access_log', …)access_logthe page URL
rapid('track', 'usage_log', …)usage_logthe page URL

order_ref is required in all of them, as text or number. It is the order identifier in your system, the same one you send in external_id when creating the transaction. See Types and payload.

A call without order_ref is ignored: it generates neither an event nor a visible error.

The snippet never breaks the checkout, and that has a cost worth knowing:

  • every call is silent. It throws no exception, returns no promise and does not read the response
  • validation errors (wrong type, order_ref too long) do not show up in the console
  • network failures are not retried in the browser

To test the integration, call the browser endpoint directly with curl, where you see the status and the message. Once validated, the snippet does the same in production.

Sending uses navigator.sendBeacon when available, with fetch in keepalive mode as the alternative. Both survive navigation to the next page, so the checkout event is not lost in the payment redirect. If the page leaves before the device identification finishes, the event goes out on exit with the snippet’s own identification. So if the page redirects right after checkout, prefer calling it on a page where the buyer stays for a few moments, such as the order confirmation page.

On checkout, the snippet identifies the device before sending the event. It tries Fingerprint, with a 2-second cap, and falls back to its own identification if it cannot (an identifier in localStorage plus a hash of browser attributes).

The result goes in the payload’s fp field:

fpMeaning
proFingerprint identification, validated on the server side
fallbackthe snippet’s own identification

The difference is practical: only the validated identification fills in the transaction’s device and IP and generates the verification record. See The checkout event.

If your site has a strict CSP, allow https://api.rapidchargeback.com in script-src and connect-src, and give the snippet’s inline <script> the same nonce as your other scripts. For Fingerprint, also allow https://fpjscdn.net in script-src, https://api.fpjs.io and https://*.api.fpjs.io in connect-src, and blob: in worker-src. Add these items to the directives your site already uses, without removing what is already there:

script-src 'self' 'nonce-YOUR_NONCE' https://api.rapidchargeback.com https://fpjscdn.net;
connect-src 'self' https://api.rapidchargeback.com https://api.fpjs.io https://*.api.fpjs.io;
worker-src 'self' blob:;

With everything allowed, identification improves. If any of these items is blocked, capture keeps working: events arrive, but the checkout may not fill in device or IP.

The same Rapid Capture detail in the dashboard shows whether the store has already received events and when the last one was. An event counts once its order’s transaction is in Rapid. After installing, make a test purchase and check there after its transaction reaches Rapid.