DengiOnline

2018-04-26 03:00:16

Mobile payment via MegaFon, Beeline or MTS

When invoices are created in the background, the mode_type parameter acquires special value — mobilePayment.

Also 3 more mandatory parameters are added to the usual parameter list.

Parameter Description Format Mandatory

mode_type

Background payment mode ID

mobilePayment

Yes

sendMobilePayment

Mobile payment mode ID

1

Yes

qiwi_phone

Mobile phone number used for the payment

10 digits (without country code)

Yes

md5

Request signature. Formed as hash using md5 algorithm. Consists of the following parameters concatenated in lowercase:

  • Project secret key

  • Project ID in the System

  • nickname parameter value

  • amount

  • qiwi_phone parameter value

  • secret key

md5(strtolower(secret key.project.nickname.floatval(amount).phone.secret key))

Yes

After processing the data provided by the Project the System sends a response in UTF-8 encoded XML format containing the following nodes: 

Parameter Description Format

status

Invoicing status code

0 -request is successful
-1 - request failed

comment

Status comment and the list of all errors

string

ODpaymentID

Payment ID in the System in case of successful payment

integer

Response example (success)

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>0</status>
    <comment>Request was processed successfully</comment>
    <ODpaymentID>3386642</ODpaymentID>
</response>

Response example (failure)

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>-1</status>
    <comment><![CDATA[User phone number is not found or is invalid for MegaFon, Beeline or MTS]]></comment>
</response>

Request example for mobile payment invoicing via MegaFon, Beeline or MTS (PHP)

<?php
$secret = 'XXXXXX';
 
$vars = array(
    'project' => 123,
    'nickname' => 'payment to test project',
    'mode_type' => 'mobilePayment',
    'amount' => 10,
    'qiwi_phone' => '9211234567',
    'sendMobilePayment' => 1,
    'paymentCurrency' => 'RUB'
);
$vars['md5'] = md5(strtolower($secret.$vars['project'].$vars['nickname'].floatval($vars['amount']). $vars['qiwi_phone'].$secret));
$vars = http_build_query($vars);
$ch = curl_init('https://www.onlinedengi.ru/wmpaycheck.php');
 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
?>