How-to

Step 1

  • Log in to your Cryptopay account

  • Navigate to Settings → Widget

  • Generate a widget key

Step 2

Add the following meta tags in your web page.

<head>
...
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
...
</head>

Step 3

Add the following code in your web page.

HTML
JavaScript
<script src="https://widget-business-sandbox.cryptopay.me/widget.js" />
const el = document.createElement('SCRIPT');
el.src = 'https://widget-business-sandbox.cryptopay.me/widget.js';
document.body.appendChild(scr);

Step 4

Widget initialization.

var widget = new CryptopayWidget({
widgetKey: 'bd3476f9-57Bc-4517-b499-afb83e1538ес',
accounts: ['BTC', 'ETH', 'LTC', 'XRP'],
embedded: 'true',
elId: 'cryptopay-widget',
styleOptions: {
closeButtons: 'false'
}
});

Parameter

Usage

Description

widgetKey

Required

Your widget key - Step 1

accounts

Required

Choose which cryptocurrencies you want your customers to pay with. Can be BTC, ETH, LTC, XRP

embedded

Optional

If false, the widget will popup on the page

If true, the widget will be embedded

elId

Optional

cryptopay-widget by default. The place on your web page where the widget will be plugged in

styleOptions

Optional

Use this optional parameter to customize your widget appearance

closeButtons

Optional

Use false to hide the blue Close buttons. See the screenshots below

Step 5

Widget calling.

widget.pay({
amount: 10,
currency: 'EUR',
customId: '2a713ee9-d401-4d97-9909-b67d6755c1c7',
onOpen: function () {},
onClose: function () {}
});

Parameter

Type

Usage

Description

amount

number (double)

Required

Purchase amount

currency

string

Required

Purchase currency

customId

string

Required

Purchase reference ID in your system

onOpen

function

Optional

Function to be called upon widget opening

onClose

function

Optional

Function to be called upon widget closing