browser-sdk
npm i @aplazame/browser
import { AplazameIFrame } from '@aplazame/browser'
const apzIframe = new AplazameIFrame({
url: 'https://checkout.aplazame.com',
searchParams: {
order: 'checkout_id',
public_key: 'merchant_public_key',
},
})
.on('close', ({ details: { status, statusReason } }) => {
console.log('checkout has being closed with:', {
status,
statusReason,
})
apzIframe.unmount()
})
.mount(document.querySelector('#iframe_container'))
AplazameIFrame object
constructor
const apzIframe = new AplazameIFrame({
url,
searchParams,
})
methods
apzIframe.send(event: string, payload: unknown)
apzIframe.request(request: string, payload: unknown)
apzIframe.mount(el: HTMLElement)
apzIframe.setStyles(styles: string | { [key: string]: string })
apzIframe.addStylesPreset(name: string, styles: { [key: string]: string })
apzIframe.resetStyles()
apzIframe.unmount()
default styles presets
const defaulsIframeStylesPresets: {
fill_fixed: {
position: 'fixed',
top: '0',
left: '0',
width: '100%',
height: '100%',
border: 'none',
},
fill_absolute: {
position: 'absolute',
top: '0',
left: '0',
width: '100%',
height: '100%',
border: 'none',
},
}