<div id="paymentContainer"></div>
<script>
const URL = 'https://Init';
const INIT_PARAMS = {
get OrderId() {
return `${Date.now()}${Math.floor(Math.random() * 100)}`;
},
TerminalKey: 'myTerminalKey',
Amount: 10000,
Description: 'test payment',
};
</script>
<script
async
onload="onPaymentIntegrationLoad()"
src="https://integrationjs.tbank.ru/integration.js"
></script>
<script>
const initConfig = {
terminalKey: 'myTerminalKey',
product: 'eacq',
features: {
iframe: {}
},
};
function onPaymentIntegrationLoad() {
PaymentIntegration.init(initConfig)
.then(async (integration) => {
const MAIN_INTEGRATION_NAME = 'main-integration-name';
const iframeConfig = {};
const mainPaymentIntegration = await integration.iframe.create(MAIN_INTEGRATION_NAME, iframeConfig);
const container = document.getElementById('paymentContainer');
const res = await integration.helpers.init(URL, 'POST', INIT_PARAMS);
await mainPaymentIntegration.mount(container, res.PaymentURL);
})
.catch();
}
</script>