Appearance
Quick Start Guide
Get up and running with the Kore Payment SDK in 5 minutes.
Installation
- Download the SDK (zip) from this documentation site.
- Unzip the file and include the script in your project.
Using a script tag (browser):
html
<script src="path/to/kore-sdk.js"></script>
<script>
const kore = new Kore({ apiKey: 'pk_test_xxxxxxxxxxxxx', environment: 'sandbox' });
</script>Using a bundler (ES module):
javascript
import Kore from './path/to/kore-sdk.esm.js';
const kore = new Kore({
apiKey: 'pk_test_xxxxxxxxxxxxx',
environment: 'sandbox'
});Unified Payment Integration
The SDK uses a single integration path that works for all gateways. The backend decides whether the customer is sent to a redirect payment page or sees an embedded form on your site. Your code stays the same either way.
Step 1: Create a payment session
Always use createEmbeddedSession. The same session data is used whether the gateway uses redirect or embedded.
javascript
const session = await kore.createEmbeddedSession({
order_id: 'order_12345',
amount: 10000, // $100.00 in cents
currency: 'USD',
capture_mode: 'auto',
payer: {
email: '[email protected]',
name: 'John Doe',
phone: '+1234567890'
},
billing: {
address_line_1: '123 Main St',
address_line_2: 'Apt 4B',
city: 'New York',
state: 'NY',
postal_code: '10001',
country: 'US'
},
return_url: 'https://yourstore.com/success',
cancel_url: 'https://yourstore.com/cancel',
// Optional: For Checkout.com only
processing_channel_id: 'pc_xxxxx'
});Step 2: Initialize payment (redirect or embedded)
Call initializePayment with the session and a container. The SDK will:
- Redirect flow: If the backend returns a redirect URL, the SDK redirects the customer to the gateway payment page.
- Embedded flow: If the backend returns an embedded gateway (Checkout.com, Adyen, or QiCard), the SDK renders the payment form inside your container.
javascript
await kore.initializePayment({
session: session,
container: '#payment-form-container',
onSuccess: (result) => {
console.log('Payment successful!', result);
// Handle success
},
onError: (error) => {
console.error('Payment failed:', error);
// Handle error
}
});Step 3: Add a container (for embedded flow)
When the gateway is embedded, the form is rendered in this element. For redirect flow the container is not used (the user is redirected away).
html
<div id="payment-form-container"></div>That’s all you need. One integration handles both redirect and embedded flows.
Step 4: Handle return from redirect (if applicable)
If the customer was redirected to the gateway, they will return to your return_url. On that page, verify the redirect and show the result:
javascript
// On your return URL page (e.g. /success)
const urlParams = new URLSearchParams(window.location.search);
const result = await kore.handleRedirectReturn(urlParams, apiSecret);
if (result.success) {
console.log('Payment successful!', result.data);
} else {
console.error('Payment failed:', result.error);
}Use your API secret only on the server; in production, call your backend to verify the redirect instead of passing the secret to the client.
Next Steps
- Full guide: Integration Guide
- API reference: API Reference
- Examples: Examples or Download examples zip
- API keys: From your Kore / merchant dashboard
Need help? Contact [email protected]