Onmeta Widget Integration
Widget Creation
Customizing widget
4min
Since widget has optional parameters that can be set during initialisation, let's see what are parameters that can be configured with it and how to enable OffRamp functionality as well.
By Default widget will be initialised with Onramp feature. And Default fiat is only INR , for PHP contact our sales team to enable it. and from widget initialize fiatType:php for PHP
Offramp can be enabled by setting the flag to offRamp: "enabled" as shown in below example.
JS
1<script>
2 let createWidget = new onMetaWidget({
3 elementId: "widget", // Mandatory (It should be an id of an element not a class)
4 apiKey: "api_key", // Mandatory
5 userEmail: "test@test.com", // Optional (if passed user don't have to register in meta platform)
6 chainId: "80001", // Optional (it should be passed along with the tokenAddress to show a particular token to the user)
7 tokenAddress: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // Optional
8 offRamp: "enabled", // to enable offRamp feature
9 onRamp: "disabled" // to disable onRamp feature
10});
11createWidget.init(); // it will initialize the widget inside the particular div element
12</script>
Both on and off ramp can be enabled by setting respective flags to a value as enabled as shown below.
JS
1<script>
2 let createWidget = new onMetaWidget({
3 elementId: "widget", // Mandatory (It should be an id of an element not a class)
4 apiKey: "api_key", // Mandatory
5 userEmail: "test@test.com", // Optional (if passed user don't have to register in meta platform)
6 chainId: "80001", // Optional (it should be passed along with the tokenAddress to show a particular token to the user)
7 tokenAddress: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // Optional
8 offRamp: "enabled", // to enable offRamp feature
9 onRamp: "enabled" // to enable onRamp feature
10});
11createWidget.init(); // it will initialize the widget inside the particular div element
12</script>
JS
1sellCryptoType: "coins" //initialise this parameter within widget object to get crypto as input by default
Updated 02 Dec 2023
Did this page help you?