Skip to main content

JS API

Deposit page sends the following events:

  • "height" event;
  • "status" event.

Height event

To get the Deposit page content height, you need to subscribe to the "height" event.

Example code:

function handleDepositSize(evt) {

if (evt.data.type === 'height') {
iframe.height = evt.data.height;
}
}

window.addEventListener('message', handleDepositSize);

Status event

To receive the deposit status (only SUCCESS is implemented as of now), you must subscribe to the “status” event.

Example code:

function handleDepositStatus(evt) {
if (evt.data.status === 'success') {
do something
}
}

window.addEventListener('message', handleDepositStatus);

Intent payment data event

Below is the example of post message for the payment intent with deposit status=SUCCESS and changed account info data, amount, status.

Example code:

parent.postMessage({
type: 'intentPaymentData',
accountInfo: {
address: "123 Main St"
block_deposit: false
block_deposit_reason: null
city_name: "Kyiv"
client_type: "Individual"
company_name: null
country_code: "UA"
country_phone_code: "+44"
email: "[email protected]"
first_name: "John"
has_deposits: true
is_dod_required: null
last_name: "Doe"
phone: "2073238000"
postal_code: ",
status: 'success',
amount: 100.00,
currency: 'USD',
intentId: 'original_transaction_id'
},
}, '*')

To check the payment intent data you need to add the following eventListener.

Example code:

window.addEventListener("message", (event) => {

if (event.data.type === 'intentPaymentData') {
console.log('intentPaymentData', event.data.accountInfo)
};

});