Vanilla JavaScript
The tag installs window.ripper synchronously. collect and track return Promises; init and
setEmail return nothing; getTraceId and getDeviceId answer synchronously from the first line,
before the runtime has loaded.
<script src="https://js.ripper.dev/r.js" data-key="rip_pk_EXAMPLE-KEY_00000000abcZ" data-integration="default"></script>
<div data-ripper-checkout></div>
<script>
ripper.collect({ amount: 4200, currency: 'GBP' }).then(function (result) { console.log(result.status); });
</script>await ripper.track('page', { type: 'checkout' }); // recorded locally; does nothing else yet
const result = await ripper.collect({ amount: 4200, currency: 'GBP' });
const traceId = ripper.getTraceId(); // 'rip_sess_…' per page load
const deviceId = ripper.getDeviceId(); // null until the integration enables signals capture
const result = await ripper.collect({ amount: 4200, currency: 'GBP' });
Formatting an amount the way the checkout does:
import { formatAmount } from 'ripperpay';
console.log(formatAmount(4200, 'GBP')); // '£42.00'