@hariguru94/swirepay-sdk-core
v1.0.0
Published
Swirepay SDK Core for payment integration
Maintainers
Readme
Swirepay SDK Core
A framework-agnostic JavaScript SDK for integrating Swirepay payments into your web applications.
Installation
npm install @swirepay/sdk-coreUsage
Using the Web Component
The simplest way to use the SDK is via the built-in web component.
<script src="path/to/swirepay-sdk.js"></script>
<swirepay-checkout id="sp-checkout"></swirepay-checkout>
<script>
const checkout = document.getElementById('sp-checkout');
checkout.setApiKey('your-public-api-key');
checkout.on('payment_success', (data) => {
console.log('Payment Successful:', data);
});
</script>Using the JS API
import { init, SwirepayEvent } from '@swirepay/sdk-core';
const checkout = init('your-public-api-key');
document.body.appendChild(checkout);
checkout.on(SwirepayEvent.PAYMENT_SUCCESS, (data) => {
alert('Success!');
});Features
- Framework Agnostic: Built with native Web Components.
- Secure: Uses Shadow DOM for style and logic encapsulation.
- Flexible: Easy to integrate into any modern web stack.
- Card Payments: Simplified card checkout flow.
License
MIT
