MinterPay widget for your website or online shop

Register Your Account

Register

Create Your Site/Widget

New Site

Embedding

Button Tag

Place our script tag and any amount of payment buttons on your website. See the example:

<!-- MinterPay script -->
<script type="text/javascript" src="https://minterpay.com/pay/app.js"></script>
<!-- MinterPay button 1 -->
<button class="btn btn-success j-minterpay-new"
        data-site="__YOUR_SITE_ID__" data-order="product-666"
        data-amount="70" data-currency="rub" data-customer="user1"
        data-note="order notes or description">
	Pay product #666 with BIP
</button>
<!-- MinterPay button 2 -->
<button class="btn btn-success j-minterpay-new"
        data-site="__YOUR_SITE_ID__" data-order="product-777"
        data-amount="70" data-currency="rub" data-customer="user2"
        data-note="order notes or description">
	Pay product #777 with BIP
</button>
<!-- Other buttons ... -->

Style these buttons any way you wish. For example, in Bootstrap CSS framework they look like:

Button data- attributes:

  • data-site * — your website/shop/widget ID;
  • data-order * — unique (website-wise) order ID (for example, product ID), string up to 64 characters;
  • data-amount * — order payment amount, positive numeric up to 20 digits with 8 decimal points;
  • data-currency * — order payment currency, see the list of supported currencies below;
  • data-customer — any user identity information (for example, user ID), string up to 64 characters;
  • data-email — user’s email if present, string up to 128 characters;
  • data-note — any additional information about the payment or order (visible in your account), string/text.

(* means required attribute.)

POST Form

Coming soon...

<form action="https://minterpay.com/payment" method="post">
	<input type="hidden" name="site" value="__YOUR_SITE_ID__">
	<input type="hidden" name="order" value="<your store’s unique order ID>">
	<input type="hidden" name="currency" value="<order sum currency: BIP, RUB or USD>">
	<input type="hidden" name="amount" value="<order sum in selected currency, positive decimal>">
	<input type="hidden" name="note" value="<any additional information, string up to 500 characters>">
	<input type="hidden" name="customer" value="<user identity information>">
	<input type="submit" value="Pay">
</form>

Currencies

data-currency attribute (and <input name="currency"> value) of payment widget can accept one of the following currency codes:

  • BIP
  • RUB (₽)
  • USD ($)
  • EUR (€)
  • AUD
  • AZN
  • GBP (£)
  • AMD
  • BYN
  • BGN
  • BRL
  • HUF (ƒ)
  • HKD
  • DKK
  • INR (₹)
  • KZT
  • CAD
  • KGS
  • CNY (元)
  • MDL
  • NOK
  • PLN
  • RON
  • XDR
  • SGD
  • TJS
  • TRY (₺)
  • TMT
  • UZS
  • UAH (₴)
  • CZK
  • SEK
  • CHF
  • ZAR
  • KRW
  • JPY (¥)

BIP value means exact amount of BIP, which will be sent to your widget’s wallet after successful payment. Amounts in other currencies will be converted to BIPs and then will be expanded with your shop’s additional fee (specified in Site/Widget settings).

Customer’s Workflow

Every payment has its own unique wallet in Minter blockchain. After clicking the button user will be redirected to the payment page:

New payment

Then user transfers their BIPs to the specified wallet and clicks on [Confirm Payment] button. When payment is fully paid and successfully confirmed, user will see the success page:

Payment successfully paid

After that, BIPs will be sent to your shop’s wallet. You will see the transaction in your MinterPay account.

If paid amount is greater than requested one, then excess amount of BIPs will be returned to customer’s wallet as a change.

Payment Webhook

When payment is processed MinterPay sends a POST HTTP request to your shop’s Webhook URL with JSON payload data in the request’s body. The data has a signature field designed to verify that the request came from MinterPay server.

Data signature is calculated as SHA‑256 hash of these data fields separated by comma:

signature = SHA‑256('<id>,<order>,<note>,<currency>,<amount>,<bipAmount>,<customer>,<customerEmail>,<status>,<createdAt>,<paidAt>,<sentRevenueAt>,<sentRevenueAt>,<site.secret>')

After that, you can compare the calculated signature with the corresponding value provided in the data.

Example webhook POST request body:

{
	"id": "payment.id",
	"order": "payment.order",
	"note": "payment.note",
	"currency": "bip",
	"amount": 666,
	"bipAmount": 672.69,
	"customer": "payment.customer",
	"customerEmail": "payment.customerEmail",
	"status": "payment.status",
	"createdAt": "payment.createdAt",
	"paidAt": "payment.paidAt",
	"sentRevenueAt": "payment.sentRevenueAt",
	"signature": "a31589525f926e19db72268d3a28867976967e76dc8ed782ad0f77ce70755918"
}

PHP implementation:

function signData($data, $secret)
{
	return hash(
		'sha256',
		implode(',', [
			$data['id'],
			$data['order'],
			$data['note'],
			$data['currency'],
			$data['amount'],
			$data['bipAmount'],
			$data['customer'],
			$data['customerEmail'],
			$data['status'],
			$data['createdAt'],
			$data['paidAt'],
			$data['sentRevenueAt'],
			$secret,
		])
	);
}

function isDataSignatureValid($data, $secret)
{
	if (!isset($data['signature'])) {
		return false;
	}

	return $data['signature'] === signData($data, $secret);
}

//////// Request Validating Example

// Webhook request body data
$receivedData = json_decode(file_get_contents('php://input'));
// For example we received this
$receivedData = json_decode(
	'{
		"id": "payment.id",
		"order": "payment.order",
		"note": "payment.note",
		"currency": "bip",
		"amount": 666,
		"bipAmount": 672.69,
		"customer": "payment.customer",
		"customerEmail": "payment.customerEmail",
		"status": "payment.status",
		"createdAt": "payment.createdAt",
		"paidAt": "payment.paidAt",
		"sentRevenueAt": "payment.sentRevenueAt",
		"signature": "a31589525f926e19db72268d3a28867976967e76dc8ed782ad0f77ce70755918"
	}',
	true
);

// Your shop’s secret
$secret = 'signature-secret';
echo 'Received data: ', var_export($receivedData, true), PHP_EOL;
// Should print received data object as associative array
echo 'Calculated signature: ', signData($receivedData, $secret), PHP_EOL;
// Should print: a31589525f926e19db72268d3a28867976967e76dc8ed782ad0f77ce70755918
// (the same as in $receivedData['signature'])
echo 'Signature ',  isDataSignatureValid($receivedData, $secret) ? 'valid.' : 'NOT VALID!', PHP_EOL;
// Should print: Signature valid.

Online Shop Engines and CMS

You can download MinterPay plugins for various CMS and implement Minter payments in your online shop.

News and Help

MinterPay news can be found in our Telegram channel @minterpay_com

If you need some assistance or any other help, don’t hesitate to contact us: [email protected]