Web SDK
Load and initialize the DEUNA Web SDK.
The Web SDK is distributed through the DEUNA CDN. For the complete platform guide, supported experiences, and related integration pages, see Web SDK reference.
Load the SDK#
HTML
<script
crossorigin
src="https://cdn.deuna.io/web-sdk/v1.7/index.js">
</script>Initialize#
Use a public API key in browser code. Keep the private key on your backend, where you create the order and obtain its token.
JavaScript
await DeunaSDK.initialize({
publicApiKey: 'YOUR_PUBLIC_API_KEY',
env: 'sandbox',
});Open Payment Widget#
JavaScript
await DeunaSDK.initPaymentWidget({
orderToken,
callbacks: {
onSuccess: async (order) => {
await DeunaSDK.close();
showConfirmation(order);
},
onError: (error) => console.error(error),
onClosed: (action) => console.log('Widget closed', action),
},
});