Skip to main content

SDK Documentation

The JavaScript SDK allows you to securely accept card payments in your checkout flow with a few lines of code. This guide covers setup, initialization, payment creation, callback handling.


๐Ÿ”ง Environmentsโ€‹

EnvironmentScript URL
Sandboxhttps://cdn.lightningpay.me/media/getkollo-sdk/1.1.0/sandbox/getkollo.js
Productionhttps://cdn.lightningpay.me/media/getkollo-sdk/1.1.0/prod/getkollo.js

๐Ÿ‘‰ View Demo Website


โœ… Integration Stepsโ€‹

Step 1: Register Your App ID & Domainโ€‹

  • Contact the Hello Clever team to register your domain and receive your app_id.

Step 2: Include SDK Script in Checkout Pageโ€‹

<script
src="https://cdn.lightningpay.me/media/getkollo-sdk/1.1.0/sandbox/getkollo.js"
async
></script>

Step 3: Add Mount Element in HTMLโ€‹

<div class="get-kollo"></div>

This is where the payment iframe will be injected. It must exist before calling createPayment().

Step 4: Initialize SDK and Create Paymentโ€‹

async function createGetKollo() {
const getKolloSDK = new GetKollo({
app_id: "your-app-id",
});

const init = await getKolloSDK.initialize();
if (!init?.success) return alert(init?.error);

const order = {
external_id: "order-001",
customer_name: "John Doe",
customer_email: "john_doe@gmail.com",
amount: 1000,
currency: "USD",
return_url: "https://yourdomain.com/success"
};

const options = {
mountElement: ".get-kollo",
styleProps: {
frame: {
width: "100%",
height: "100%"
}
}
};

const resp = await getKolloSDK.createPayment(order, options);
if (!resp?.success) return alert(resp?.error);

window.getkolloCardCallback = (message) => {
if (message?.status !== "succeeded") {
alert(message?.error);
}
};
}

๐Ÿงพ SDK Configuration Referenceโ€‹

GetKollo({ app_id })โ€‹

  • app_id: Your unique application identifier (required)
const getKolloSDK = new GetKollo({
app_id: [YOUR_APP_ID],
});

const init = await getKolloSDK.initialize();

createPayment(order, options)โ€‹

๐Ÿงพ order (required)โ€‹

FieldTypeRequiredDescription
external_idstringโœ…Unique identifier for the order
customer_namestringโœ…Name of the customer
customer_emailstringโœ…Email of the customer
amountnumberโœ…Transaction amount in cents
currencystringโœ…"USD"
return_urlstringโŒURL to redirect after success/failure

โš™๏ธ options (required)โ€‹

FieldTypeRequiredDescription
mountElementstringโœ…CSS selector for mounting the iframe
styleProps.frame.widthstringโŒWidth of iframe (default: 500px)
styleProps.frame.heightstringโŒHeight of iframe (default: 500px)
const order = {
external_id: [EXTERNAL_ID],
customer_name: [CUSTOMER_NAME],
customer_email: [CUSTOMER_EMAIL],
amount: [ORDER_AMOUNT],
currency: [CURRENCY], // USD
return_url: [RETURN_URL], // optional redirect URL
};

const options = {
mountElement: ".get-kollo", // Element classname or ID
styleProps: {
frame: {
width: "100%",
height: "100%",
},
},
};

const resp = await getKolloSDK.createPayment(order, options);

Listener Payment statusโ€‹

After the payment is submitted, the SDK will call:

window.getkolloCardCallback = (response) => {
if (response?.status !== "succeeded") {
alert(response?.error?.message);
}
};

Response Fields

FieldDescription
status"succeeded" or "failed"
errorError object (message, code)
orderOrder object as provided in the SDK call
type"callback"

๐Ÿ“Š Payment Statusesโ€‹

StatusMeaning
pendingCustomer has not completed payment yet
authorisedPayment authorised, need capture to succeeded
waitingPayment succeeded, awaiting payout
receivedPayment settled
expiredPayment link expired
return_pendingRefund initiated
partially_refundedPayment has been refunded partially.
return_receivedRefund completed
return_expiredRefund expired (after 10 days)
return_rejectedRefund failed (e.g. due to destination account issue)
failedPayment canceled
in_disputePayment is disputing
dispute_lostPayment dispute resolved, amount not returned to merchant