JavaScript SDK: installation and usage
The RahaKaitse SDK is a small JavaScript file that works on any website (WordPress, Shopify, custom HTML, React, Vue…).
1. Get an API key (see Partner API keys).
2. Add the script to your checkout page:
<script src="https://rahakaitse.ee/rahakaitse-sdk.js"></script>
3. Initialise it:
<script>
const rahakaitse = new RahaKaitse({
apiKey: "YOUR_API_KEY",
locale: "en", // "en" | "et" | "ru"
debug: false
});
</script>
4. Create a session when the buyer clicks "Pay with RahaKaitse":
const result = await rahakaitse.createSession({
amount: 149.99, // required
currency: "USDC", // "USDC" | "EURC"
description: "Order #1234",
orderRef: "ORDER-1234",
returnUrl: "https://myshop.com/thank-you"
});
rahakaitse.redirectToCheckout(result.checkoutUrl);
Main methods: createSession(orderData), redirectToCheckout(url), openCheckoutModal(url) (overlay on your page), openCheckoutTab(url) (new tab), getOrderStatus(sessionId) and verifyApiKey().
Download working examples from the Partner → API → JavaScript SDK page.