var conditions = jQuery.parseJSON('null'); var current_currency = 'usd'; var course = jQuery.parseJSON('{"usd":3368.1}'); var partner_course = undefined; var partner_currency = 'usd'; var partners_schema = jQuery.parseJSON('{"btc2cashin":"https","pm2cashin":"https","btc2wm":"https","pm2btc":"https","pm2wm":"http","pm2cryptocheck":"https","btc2cryptocheck":"https","cryptocheck2pm":"https","cryptocheck2btc":"https","cryptocheck2cashin":"https"}'); var partners_courses = jQuery.parseJSON('{"btc2wm":{"usd":3267.06,"rur":214645.64},"pm2btc":{"btc":-401862.62},"pm2wm":{"usd":0.92,"rur":60.44},"pm2cryptocheck":null,"btc2cryptocheck":null,"cryptocheck2pm":null,"cryptocheck2btc":null}'); var promo_course = jQuery.parseJSON('{"usd":3401.78}'); var btc_calc = false; $(function () { $('.payment-form').on('submit', function (event) { $('.pay').prop('disabled', true); }); $('.pay').removeProp('disabled'); if (window.location.hash.substr(1) == 'voucher') { $('input#voucher').prop('checked', true); } }); function compound_details($field, $linked_field) { if ($field.val()) { $('.cashin-details').removeAttr('required'); } else { if (!$linked_field.val()) { $('.cashin-details').attr('required', 'required'); } else { $('.cashin-details').removeAttr('required'); } } $('#hidden-details').val( $field.data('label') + ': ' + $field.val() + ' ' + $linked_field.data('label') + ': ' + $linked_field.val() ); } function clear_promo(promo_obj) { if ($(promo_obj).val().length > 0) { $(promo_obj).val($(promo_obj).val().toString().replace(/[^0-9a-zA-Z]/g, '')); var source = document.getElementById('source'); if (source) { recalc(source); } } } function get_payment_course(course_from_partner) { if (course_from_partner !== 'undefined' && course_from_partner) { return partner_course ? partner_course : course; } var payment_course = course; if ($('#promo_code').val().length == 7) { payment_course = promo_course; } return payment_course; } function get_current_currency(course_from_partner) { if (course_from_partner !== 'undefined' && course_from_partner) { return partner_currency; } return current_currency; } function recalc(source, target, course_from_partner) { var payment_course = get_payment_course(course_from_partner); $(source).val($(source).val().toString() .replace(/,/g, '.') .replace(/[^0-9\.]/g, '') .replace(/^0([\d].+)/, '$1')); if (btc_calc) { $(source).val($(source).val().toString() .replace(/(\.\d{5})(.+)/, '$1') .replace(/^(,)/, '')); } else { $(source).val($(source).val().toString() .replace(/(\.\d{2})(.+)/, '$1') .replace(/^(0|,|\.|0\.)/, '')); } var calc_currency = get_current_currency(course_from_partner); var target_amount = parseFloat($(source).val()) * payment_course[calc_currency]; if (isNaN(target_amount)) { target_amount = 0.00; } if (typeof target !== 'undefined') { $(target).val(target_amount.toFixed(2)); return; } $('#target').val(target_amount.toFixed(2)); } function recalc_reverse(target, source, course_from_partner) { var payment_course = get_payment_course(course_from_partner); $(target).val($(target).val().toString() .replace(/,/g, '.') .replace(/[^0-9\.]/g, '') .replace(/^0([\d].+)/, '$1') .replace(/(\.\d{2})(.+)/, '$1') .replace(/^(0|,|\.|0\.)/, '')); var calc_currency = get_current_currency(course_from_partner); if (conditions) { $.each(conditions, function (i, condition) { if (parseFloat(condition['amount']) <= $(target).val()) { payment_course[calc_currency] = parseFloat(condition['course']); } }); } var source_amount = parseFloat($(target).val()) / payment_course[calc_currency]; if (btc_calc) { if (isNaN(source_amount)) { source_amount = 0.00000; } } else { if (isNaN(source_amount)) { source_amount = 0.00; } else { source_amount += 0.005; //round to up } } if (typeof source !== 'undefined') { if (btc_calc) { $(source).val(source_amount.toFixed(5)); } else { $(source).val(source_amount.toFixed(2)); } return; } $('#source').val(source_amount.toFixed(btc_calc ? 5 : 2)); } function setAmount() { var data = {}; if ($('.crypto-currency').length) { data['crypto_currency'] = $('.crypto-currency').val() } $.post('/course', data, function (response) { if (!response.course) { return; } course = response.course; promo_course = response.promo_course; $('#header-course').html(response.course_render); $('#promo_course').html(response.promo_course_render); var source = document.getElementById('source'); if (source) { recalc(source); } }); } function setPartnerCurrency(e) { partner_currency = $(e).val(); } function get_cryptocheck_status() { } function formatNumber (text) { return text.replace(/k|к|r|л/i, '000') .replace(',', '.') .replace(/[^0-9\.]/g, '') .replace(/^0([\d].+)/, '$1') .replace(/(\.\d{8})(.+)/, '$1'); } function setBitcoinQR(selector, address) { var original_text = 'bitcoin:' + address; var text = original_text; var $container = $(selector); $container.find('.amount').on('change textInput input', function () { var amount = formatNumber($(this).val().trim()); $(this).val(amount); if (amount && $.isNumeric(amount) && amount > 0) { text = original_text + '?amount=' + amount; } else { text = original_text; } $container.find('.qr').html('').qrcode({ text: text }); }); $container.find('.amount').change(); $container.slideDown(); } var ajax = {}; ajax.x = function () { try { return new ActiveXObject('Msxml2.XMLHTTP') } catch (e1) { try { return new ActiveXObject('Microsoft.XMLHTTP') } catch (e2) { return new XMLHttpRequest() } } }; ajax.send = function (url, callback, method, data) { var x = ajax.x(); x.open(method, url, false); x.onreadystatechange = function () { if (x.readyState == 4) { callback(x.responseText); } }; x.send(data) }; var course_timer = null; $(document).ready(function () { $('#ticket_button a').click(function () { var wrapper = $('#ticket_wrapper'); wrapper.animate({ left: parseInt(wrapper.css('left'), 10) == 0 ? -380 : 0 }, 500) }); $('#send_ticket').click(function () { $.post('/create_ticket', $('#ticket_form').serialize(), function (data) { var msg = $('#ticket_content').find('.msg'); msg.addClass('alert'); if (data.status == 'ok') { msg.html('Message sent successfully'); $('#ticket_form').find('.f_text').val(''); } else { msg.html('Wrong JIT/Email'); } }); }); var $radio = $('.radio-field'); $radio.find('input:checked').parent().addClass('checked'); $radio.find('label').click(function () { $(this).parent().parent().parent().find('.radio-field').removeClass('checked').find('input').removeAttr('checked'); $(this).parent().addClass('checked'); $(this).parent().find('input').attr('checked', 'checked').change(); }); if ($('.crypto-currency').length) { $('.crypto-currency').change(function () { setAmount(); }); } }); $(function() { var partners = $('#partners'); var partners_container = $('#partners-container'); var clear_partners = function() { partners_container.html($('#first-partner').html()); }; if (partners_container.length) { var all_partners = partners_container.data('partners').split(','); all_partners.pop(); clear_partners(); } Array.prototype.in_array = function(p_val) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] == p_val) { return true; } } return false; }; var showAllPartners = function(inactive) { if (inactive) { clear_partners(); partners.css('background-color', 'rgba(255, 255, 255, 0.30)'); partners.css('border-color', '#E0E0E0'); partners.removeClass('inactive'); } else { partners_container.html($('#all-partners').html()); partners.css('background-color', 'white'); partners.css('border-color', '#DDDDDD'); partners.addClass('inactive'); } }; var initTypes = function() { $('#partners-calc').slideUp('slow'); var selected_type = $('#in-types').find('.in-type.selected'); if (!selected_type.length) { $('#in-types .in-type').first().addClass('selected'); selected_type = $('#in-types .in-type').first(); } var out_types = $('#out-types .out-type'); out_types.removeClass('selected'); out_types.removeClass('active'); $('#go-to-partner').addClass('inactive'); out_types.each(function() { var current_partner = selected_type.data('id') + '2' + $(this).data('id'); if (all_partners.in_array(current_partner) || (selected_type.data('id') != 'pmr' && $(this).data('id') == 'card')) { $(this).addClass('active'); } }); }; var getPartnerName = function() { var in_type = $('#in-types').find('.in-type.selected'); var out_type = $('#out-types').find('.out-type.selected'); if (out_type.data('id') == 'card') { return 'all2card'; } if (in_type.length && out_type.length) { return in_type.data('id') + 2 + out_type.data('id'); } return undefined; }; var getPartnerURL = function() { var partner = getPartnerName(); if (partner) { var schema = partners_schema[partner]; return schema + '://' + partner + '.me'; } return undefined; }; $('.partners-show-all').live('click', function(e) { e.preventDefault(); showAllPartners(partners.hasClass('inactive')); initTypes(); }); $('#in-types .in-type').live('click', function() { $('#in-types .in-type').removeClass('selected'); $(this).addClass('selected'); initTypes(); }); $('#out-types .out-type.active').live('click', function() { $('#out-types .out-type').removeClass('selected'); $(this).addClass('selected'); $('#go-to-partner').removeClass('inactive'); var partner_name = getPartnerName(); partner_course = partners_courses[partner_name]; if (partner_course) { if ($('#out-types').find('.out-type.selected').data('id') === 'btc') { $('#partner_source').attr('placeholder', '(сумма к получению)').val(''); $('#partner_target').attr('placeholder', '(сумма к оплате)').val(''); } else { $('#partner_source').attr('placeholder', '(сумма к оплате)').val(''); $('#partner_target').attr('placeholder', '(сумма к получению)').val(''); } $("#partner_currency").chosen({disable_search_threshold: 10, display_disabled_options: false, width: '75px'}); partner_currency = Object.keys(partner_course)[0]; if (Object.keys(partner_course).length > 1) { $("#partner_currency").find('.rur').removeAttr('disabled'); } else { $("#partner_currency").find('.rur').attr('disabled', true); $("#partner_currency").find('.rur').removeAttr('selected'); } $("#partner_currency").trigger("chosen:updated"); $('#partners-calc').slideDown('slow'); } }); $('#go-to-partner').live('click', function() { var url = getPartnerURL(); if (url) { // window.open(url); document.location.href = url; } else { $('#out-types').find('.out-type.active').fadeIn(100).fadeOut(100).fadeIn(100); } }); $('#partner_source').keyup(function() { }); $('#partner_target').keyup(function() { }); });
Курс обмена:

Курс обмена: 1 BTC = 3368.1 USD (Резерв: 100000 PM USD)

Другие направления: показать все
  • btc
  • pm
  • cryptocheck
  • cashin
  • wm
  • btc
  • cryptocheck
  • pm

Документация API


1. Создание платежа:

Платеж создается POST-запросом на URL /api/payment

Параметры:
  • account - аккаунт для пополнения
  • comment - комментарий к платежу

Пример создание платежа:

 curl --request POST --url https://btc2pm.me/api/payment --data "account=U7777777&comment=Order123"

Результат запроса:

{"status":"ok","data":{"address":"1BnthCrombAntezJaDqCgfnEtUM3CX84Qt","id":"jakgMKyTPMjA5ODQ=","hash":"f8aa88"}}


2. Проверка статуса платежа:

Статус платежа можно првоерить GET-запросом на URL /api/status/{id}/{hash}

Параметры:
  • id - номер платежа, выданный при создании платежа
  • hash - секретный параметр, выданный при создании платежа

Пример создание платежа:

curl --request GET --url https://btc2pm.me/api/status/V7AaCxWPiMjA5ODE=/9f6ffb

Результат запроса:

{"status":"error","data":"No payment"}

или

{"status":"ok","data": {
"status": "ok",
"account": "U7777777",
"amount": 10.0,
"txid": "6ac788e29b0291b05e708a6d6fa563d89bac5cfad00739eac54c0b7928892cf6",
"comment": "Order123"
}}