browserWeb Widget

Web Widget enables your users to buy or sell crypto from your app or website.

AhoraCrypto Web Widget is a developer integration to onboard global users from fiat to crypto and back, using credit cards, debit, and local payment methods.

  • Accept credit card, debit card, bank transfer, Apple Pay and Google Pay

  • +40 cryptocurrencies and tokens supported

  • More than 162 countries and territories supported

  • Continuously adding new currencies, blockchains, digital assets and protocols

Installation

Using the JavaScript Widget

  1. Include the script in your HTML page (at header section):

  1. Create a container element:

  1. Initialize the widget:

  1. Interact with the widget (e.g. set a wallet address):

Try it by yourself at https://webwidget.ahoracrypto.comarrow-up-right

Configuration Parameters

All parameters are optional except for containerId. The widget will use default values for any parameters not explicitly provided.

Parameter
Type
Required
Description

containerId

string

Yes

ID of the HTML element where the widget will be rendered

language

string

No

Language for the widget (e.g., 'en', 'es'). If not specified or set to 'auto', will use browser default

cryptoCurrency

string

No

The default cryptocurrency to select (e.g., 'BTC')

fiatCurrency

string

No

The default fiat currency to select (e.g., 'USD', 'EUR'). If not specified or set to 'auto', will detect user's region

logoUrl

string

No

URL to a custom logo image to display at the top of the widget

backgroundColor

string

No

Background color for the widget (HEX without #)

buttonColor

string

No

Color for buttons (HEX without #)

borderRadius

number

No

Widget border radius (in pixels)

borderWithShadow

boolean

No

Whether to show a shadow around the widget border

theme

string

No

The theme for the widget ('light', 'dark', or 'auto'). If set to 'auto', it will follow the user's system settings

iframeWidth

number

No

Width of the iframe (default: 416px)

iframeHeight

number

No

Height of the iframe (default: 510px)

paymentIntentId

string

No

Optional payment intent ID to initialize the widget with

referral

string

No

Referral code or ID for tracking and attribution purposes. This allows you to identify transactions originating from your integration

cryptos

string

No

Comma-separated list of cryptocurrency symbols to display (e.g., 'ETH,BTC,USDC'). If not specified, all available cryptocurrencies will be shown

defaultNetwork

string

No

Default network to be selected (e.g., 'BSC', 'ETH'). If specified, this network will be selected by default

Try it by yourself at https://webwidget.ahoracrypto.comarrow-up-right

Widget Controller Methods

The renderWebwidget function returns a controller object that provides methods to interact with the widget:

Method
Description
Parameters

setWalletAddress

Sets a wallet address in the widget

walletAddress (string): The crypto wallet address to use

setPaymentIntentId

Updates the payment intent ID in the widget

paymentIntentId (string): The payment intent ID to use

sendSignedMessage

Sends a signed message to the widget

signature (string): The signed message address (string): The address that signed the message messageHash (string, optional): Hash of the original message

requestMessageToSign

Requests a message to sign from the widget

None

connectWeb3Wallet

Connects a Web3 wallet to the widget

provider (object): The Web3 provider (e.g., from MetaMask) accountAddress (string): Current wallet address chainId (number): Current blockchain network ID

onReady

Registers a callback function to be executed when the widget is fully loaded

callback (function): Function to execute when ready

ready

Returns a Promise that resolves when the widget is fully loaded

None

isReady

Returns whether the widget is fully loaded

None

Ready State Handling

It's important to wait for the widget to be fully loaded before interacting with it. There are three ways to do this:

1. Using the callback approach:

2. Using the Promise-based approach with async/await:

3. Checking the ready state:

Examples

Example of using widget methods

Web3 Wallet Integration Example

Customization example

Real-world examples

Examples from other websites:

Last updated