<div id="paymentContainer"></div>
<script>
const URL = 'https://Init';
const INIT_PARAMS = {
get OrderId() {
return `${Date.now()}${Math.floor(Math.random() * 100)}`;
}
};
</script>
<script
async
onload="onPaymentIntegrationLoad()"
src="https://integrationjs.tbank.ru/integration.js"
></script>
<script>
const initConfig = {
terminalKey: 'myTerminalKey',
product: 'eacq',
features: {
payment: {},
},
};
function onPaymentIntegrationLoad() {
PaymentIntegration.init(initConfig)
.then(async (integration) => {
const MAIN_INTEGRATION_NAME = 'main-integration-name';
const MAIN_INTEGRATION_CONFIG = {};
const mainPaymentIntegration = await integration.payments.create(
MAIN_INTEGRATION_NAME,
MAIN_INTEGRATION_CONFIG,
);
const container = document.getElementById('paymentContainer');
await mainPaymentIntegration.mount(container);
await integration.payments.setPaymentStartCallback(async () => {
const res = await new PaymentIntegration.Helpers().request(URL, 'POST', INIT_PARAMS);
return res.paymentUrl;
});
const widgetTypes = ['mirpay', 'sbp', 'tpay'];
await mainPaymentIntegration.updateWidgetTypes(widgetTypes);
})
.catch();
}
</script>