IFrame Usage
Iframe Link
https://n.exchange/iframe
Query Parameters
-
ref: Referral code of the partner.
Example:
?ref=partner123 -
pair: Exact pair symbol.
Example:
?pair=BTCETH -
from: The currency from (deposit currency).
Example:
?from=ETH -
to: The currency to (withdraw currency).
Example:
?to=BTC -
address: The address where the swap resulting funds will be sent.
Example:
?withdraw_address=your_btc_address_here -
hide-brand: Boolean flag to hide the footer displaying “Powered by n.exchange”.
Example:
?hide-brand=trueDefault:
false
Example URL:
Notes
- All parameters are optional, but using the referral code helps with tracking partners.
- Ensure the
addressis valid for the chosen deposit currency.
Events
The iframe emits certain events to the parent window. Below is the list of events currently supported:
orderCreated Event
This event is emitted when a new order is successfully created. The event sends the order ID to the parent window.
Event Data:
- event:
"orderCreated" - orderId: The ID of the created order.
Example of Listening for the Event in the Parent Window:
// Listen for messages from the iframe
window.addEventListener('message', function(event) {
// Ensure the message is coming from the expected iframe origin
if (event.origin !== 'https://n.exchange') {
return;
}
// Ensure the event data is properly formatted
const { event: eventName, orderId } = event.data;
if (eventName === 'orderCreated' && orderId) {
console.log('Order created with ID:', orderId);
// Handle the order ID (e.g., redirect, show confirmation)
} else {
console.error('Order ID not found or invalid event.');
}
});