How-to

Integrating a widget is a fairly straight forward process.

Step 1

  • Log into your account

  • Navigate to the Settings → Widget section

  • Generate a widget key

Step 2

Use the following lines in your website code.

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);

Sandbox env: https://widget-business-sandbox.cryptopay.me/widget.js Production env: https://business-widget.cryptopay.me/widget.js

Step 3

Widget initialization.

const widget = new CryptopayWidget({
widgetKey: 'bd3476f9-578c-4517-b499-afb83e1538ec',
accounts: ['BTC', 'ETH', 'LTC', 'XRP'],
embedded: 'true',
styleOptions.closeButtons: 'false'
});

Parameter

Usage

Description

widgetKey

Required

Your widget key. See the Step 1

accounts

Required

Choose which cryptocurrencies you want your customers to pay with

embedded

Optional

If false, the widget will popup on the page

If true, the widget will be embed

styleOptions.closeButtons

Optional

Use false to hide the blue Close buttons

Step 4

Widget calling.

widget.pay({
amount: 100,
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

Optional

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